function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&id.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function checkDaysInMonth(dateArray) { // determines that the day number associated with a month is valid; used by validateDate() function
	monthLengthArray = [31,28,31,30,31,30,31,31,30,31,30,31]
	if (eval(dateArray[2]) % 4 == 0) {
		monthLengthArray[1] = 29
	}
	monthDays = monthLengthArray[dateArray[0]-1]
	if (dateArray[1] > monthDays) {
		return false
	}
	return true
}

function validateDate(date) { // validates that date is valid
	var dateArray = date.split("/")
	//dateArray[0] = month
	//dateArray[1] = day
	//dateArray[2] = year
	if (isNaN(dateArray[0]) || isNaN(dateArray[1]) || isNaN(dateArray[2])) {
		//alert("Invalid date!")
		return false
	}
	if (dateArray[0] == null || dateArray[1] == null || dateArray[2] == null) {
		//alert("Invalid date!")
		return false
	}
	if (dateArray[0] == "" || dateArray[1] == "" || dateArray[2] == "") {
		//alert("Invalid date!")
		return false
	}
	//check month is between 1 and 12
	if (eval(dateArray[0]) < 1 || eval(dateArray[0]) > 12) { 
		//alert("You entered an invalid month!")
		return false
	}
	//check if days in month correct
	if (!(checkDaysInMonth(dateArray))) {
		//alert ("The month you selected only has " + monthDays + " days in it.")
		return false
	}
	//check year is between 2001 and 2009
	if (eval(dateArray[2]) > 2000) {
		dateArray[2] = (dateArray[2]-2000)
	}
	if (eval(dateArray[2]) < 1 || eval(dateArray[2]) > 10) {
		//alert("Invalid year!")
		return false
	} 
	return true
}

function isInteger(theNum) {
	var validChars = "0123456789"
	//check that all characters in number are OK
	for (var i = 0; i < (theNum.length); i++) { 
		testChar = theNum.charAt(i)
		if (validChars.indexOf(testChar) == "-1") { //testChar is not valid
			return false
		}
	}	
	return true
}

function validateEmail(emailAddress) { // validate email addresses
	var emailad = emailAddress
	if (emailad.indexOf("@") == -1) { // not valid email address
		return false
	}
	var emailLength = emailad.length
	if (emailad.lastIndexOf(".") != emailLength-4) { // not valid
		return false
	}
	return true
}

function placePhoto() {
	var numImages = 6
	var randNum = Math.round(Math.random()*(numImages-1))+1
	//document.write(randNum)
	switch(randNum) {
		case 1:
			var altText = "Blue oaks in the rolling hills west of Corning, Tehama County."
			break;
		case 2:
			var altText = "A dramatic sun shines through a blue oak east of Red Bluff, Tehama County."
			break;
		case 3:
			var altText = "Green rolling hills in early spring, Colusa County."
			break;
		case 4:
			var altText = "Whiskeytown Reservoir, Shasta County."
			break;
		case 5:
			var altText = "The summer sun sets behind an ancient Blue Oak, near the Skyway, Butte County."
			break;
		case 6:
			var altText = "Early winter snowfall in the Lakes Basin, Plumas County.";
			break;
	}
	
	document.write("<table border='0' cellpadding='0' cellspacing='0' width='385'>")        
	document.write("  <tr>")
			  
	document.write("    <td bgcolor='#2A403D'><img src='images/spacer.gif' width='114' height='1' border='0' alt=''></td>")
	document.write("    <td bgcolor='#2A403D'><img src='images/spacer.gif' width='5' height='1' border='0' alt=''></td>")
	document.write("    <td bgcolor='#2A403D'><img src='images/spacer.gif' width='8' height='1' border='0' alt=''></td>")
	document.write("    <td bgcolor='#2A403D'><img src='images/spacer.gif' width='12' height='1' border='0' alt=''></td>")
	document.write("    <td bgcolor='#2A403D'><img src='images/spacer.gif' width='16' height='1' border='0' alt=''></td>")
	document.write("    <td bgcolor='#2A403D'><img src='images/spacer.gif' width='8' height='1' border='0' alt=''></td>")
	document.write("    <td bgcolor='#2A403D'><img src='images/spacer.gif' width='19' height='1' border='0' alt=''></td>")
	document.write("   <td bgcolor='#2A403D'><img src='images/spacer.gif' width='49' height='1' border='0' alt=''></td>")
	document.write("   <td bgcolor='#2A403D'><img src='images/spacer.gif' width='78' height='1' border='0' alt=''></td>")
	document.write("   <td bgcolor='#2A403D'><img src='images/spacer.gif' width='76' height='1' border='0' alt=''></td>")
	document.write(" </tr>")
	document.write(" <tr>")
			  
	 document.write("    <td colspan='10'><img name='home_banner1' src='images/home_banner1.jpg' width='385' height='64' border='0' alt='The Northern California Natural History Museum'></td>")
	 document.write("  </tr>")
	  document.write("  <tr>")
			  
	 document.write("    <td colspan='7'><img name='home_banner4' src='images/home_banner4.jpg' width='182' height='18' border='0' alt=''></td>")
	 document.write("    <td colspan='2'><img name='photo1' src='images/" + randNum + "_photo1.jpg' width='127' height='18' border='0' alt='" + altText + "'></td>")
	 document.write("    <td><img name='home_banner5' src='images/home_banner5.jpg' width='76' height='18' border='0' alt=''></td>")
	 document.write("  </tr>   ")
	 document.write("  <tr>")
	 document.write("    <td colspan='5'><a href='mission.html' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_our_mission\",\"\",\"images/home_our_mission_f2.jpg\",\"photo2\",\"\",\"images/" + randNum + "_photo2_f2.jpg\",1);'><img name='home_our_mission' src='images/home_our_mission.jpg' width='155' height='20' border='0' alt='Our Mission'></a></td>")
	 document.write("    <td><img name='photo2' src='images/" + randNum + "_photo2.jpg' width='8' height='20' border='0' alt=''></td>")
	 document.write("    <td rowspan='10' colspan='4'><img name='photo7' src='images/" + randNum + "_photo7.jpg' width='222' height='208' border='0' alt='" + altText + "'></td>")
	 document.write("  </tr>")
			
	 document.write("  <tr>")
	 document.write("    <td colspan='4'><a href='need.html' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_needs_benefits\",\"\",\"images/home_needs_benefits_f2.jpg\",1);'><img name='home_needs_benefits' src='images/home_needs_benefits.jpg' width='139' height='21' border='0' alt='Need & Benefits'></a></td>")
	 document.write("    <td rowspan='9' colspan='2'><img name='photo6' src='images/" + randNum + "_photo6.jpg' width='24' height='188' border='0' alt='" + altText + "'></td>")
	 document.write("  </tr>")
	 document.write("  <tr>")
	 document.write("    <td colspan='3'><a href='facility/index.html' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_facility_site\",\"\",\"images/home_facility_site_f2.jpg\",1);'><img name='home_facility_site' src='images/home_facility_site.jpg' width='127' height='21' border='0' alt='Facility & Site'></a></td>")
	 document.write("    <td rowspan='8'><img name='photo5' src='images/" + randNum + "_photo5.jpg' width='12' height='167' border='0' alt='" + altText + "'></td>")
	 document.write("  </tr>")
	 document.write("  <tr>")
	 document.write("    <td colspan='2'><a href='exhibits/index.html' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_exhibits\",\"\",\"images/home_exhibits_f2.jpg\",1);'><img name='home_exhibits' src='images/home_exhibits.jpg' width='119' height='21' border='0' alt='Exhibits'></a></td>")
	 document.write("    <td rowspan='5'><img name='photo4' src='images/" + randNum + "_photo4.jpg' width='8' height='105' border='0' alt='" + altText + "'></td>")
	 document.write("  </tr>")
		
	 document.write("  <tr>")
	 document.write("    <td><a href='programs/index.html' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_programs\",\"\",\"images/home_programs_f2.jpg\",1);'><img name='home_programs' src='images/home_programs.jpg' width='114' height='21' border='0' alt='Educational Programs'></a></td>")
	 document.write("    <td rowspan='3'><img name='photo3' src='images/" + randNum + "_photo3.jpg' width='5' height='63' border='0' alt='" + altText + "'></td>")
	 document.write("  </tr>")
			
	 document.write("  <tr>")
	 document.write("    <td><a href='news.asp' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_news_events\",\"\",\"images/home_news_events_f2.jpg\",1);'><img name='home_news_events' src='images/home_news_events.jpg' width='114' height='21' border='0' alt='News & Events'></a></td>")
	 document.write("  </tr>")
			
	document.write("  <tr>")
	document.write("    <td><a href='who.asp' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_whos_involved\",\"\",\"images/home_whos_involved_f2.jpg\",1);'><img name='home_whos_involved' src='images/home_whos_involved.jpg' width='114' height='21' border='0' alt='Who's Involved'></a></td>")
	document.write("  </tr>")
			
	document.write("  <tr>")
	document.write("    <td colspan='2'><a href='support.html' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_lend_a_hand\",\"\",\"images/home_lend_a_hand_f2.jpg\",1);'><img name='home_lend_a_hand' src='images/home_lend_a_hand.jpg' width='119' height='21' border='0' alt='Lend a Hand'></a></td>")
	document.write("  </tr>")
			
	document.write("  <tr>")
	document.write("    <td colspan='3'><a href='contact.html' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"home_contact_us\",\"\",\"images/home_contact_us_f2.jpg\",1);'><img name='home_contact_us' src='images/home_contact_us.jpg' width='127' height='21' border='0' alt='Contact Us'></a></td>")
	document.write("  </tr>")
			
	document.write("  <tr>")
	document.write("    <td colspan='3'><img name='test_r13_c1' src='images/test_r13_c1.jpg' width='127' height='20' border='0' alt=''></td>")
	document.write("  </tr>")
			
	document.write("  <tr>")
	document.write("    <td colspan='7'><a href='http://www.adunnphotography.com' target='_blank'><img name='photo8' src='images/" + randNum + "_photo8.jpg' width='182' height='44' border='0' alt='Photography Copyright 2002 by Anthony Dunn'></a></td>")
	document.write("    <td colspan='3' background='images/bottom_banner_bg.jpg'><img name='photo9' src='images/" + randNum + "_photo9.jpg' width='203' height='44' border='0' alt='" + altText + "'></td>")
	document.write("  </tr>")
	document.write("</table>")
}

function writeLeftNav(currentPage){

document.write("<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><table bgcolor='#ffffff' border='0' cellpadding='0' cellspacing='0' width='116'>")
document.write("		      <tr>")
document.write("		        <td><a href='../index.html' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_home','','../images/i_home_f2.jpg',1)'><img name='i_home' src='../images/i_home.jpg' width='116' height='18' border='0' alt='Home Page'></a></td>")
document.write("             </tr>")
document.write("		      <tr>")

if(currentPage="our_mission") {
	 document.write("   <td><img src='../images/i_our_mission_f2.jpg' width='116' height='19'></td>")
} else {
	document.write("		<td><a href='../mission.html' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_our_mission','','../images/i_our_mission_f2.jpg',1)'><img name='i_our_mission' src='../images/i_our_mission.jpg' width='116' height='19' border='0' alt='Our Mission'></a></td>")
}
document.write("             </tr>")
document.write("		      <tr>")

if(currentPage="need_benefits") {
	 document.write("   <td><img src='../images/i_need_benefits_f2.jpg' width='116' height='19'></td>")
} else {
document.write("		        <td><a href='../need.html' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_need_benefits','','../images/i_need_benefits_f2.jpg',1)'><img name='i_need_benefits' src='../images/i_need_benefits.jpg' width='116' height='19' border='0' alt='Needs & Benefits'></a></td>")
}
document.write("             </tr>")
document.write("		      <tr>")

if(currentPage="facility_site") {
	 document.write("   <td><img src='../images/i_facility_site_f2.jpg' width='116' height='19'></td>")
} else {
	document.write("		        <td><a href='../facility/index.html' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_facility_site','','../images/i_facility_site_f2.jpg',1)'><img name='i_facility_site' src='../images/i_facility_site.jpg' width='116' height='19' border='0' alt='Facility & Site'></a></td>")
}
document.write("             </tr>")
document.write("		      <tr>")

if(currentPage="exhibits") {
	 document.write("   <td><img src='../images/i_exhibits_f2.jpg' width='116' height='19'></td>")
} else {
	document.write("		        <td><a href='../exhibits/index.html' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_exhibits','','../images/i_exhibits_f2.jpg',1)'><img name='i_exhibits' src='../images/i_exhibits.jpg' width='116' height='19' border='0' alt='Exhibits'></a></td>")
}
document.write("             </tr>")
document.write("		      <tr>")

if(currentPage="programs") {
	 document.write("   <td><img src='../images/i_programs_f2.jpg' width='116' height='19'></td>")
} else {
	document.write("		        <td><a href='../programs/index.html' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_programs','','../images/i_programs_f2.jpg',1)'><img name='i_programs' src='../images/i_programs.jpg' width='116' height='19' border='0' alt='Educational Programs'></a></td>")
document.write("             </tr>")
}
document.write("		      <tr>")

if(currentPage="news_events") {
	 document.write("   <td><img src='../images/i_news_events_f2.jpg' width='116' height='19'></td>")
} else {
	document.write("		        <td><a href='../who.asp' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_news_events','','../images/i_news_events_f2.jpg',1)'><img name='i_news_events' src='../images/i_news_events.jpg' width='116' height='19' border='0' alt='News & Events'></a></td>")
	}
document.write("             </tr>")
document.write("		      <tr>")

if(currentPage="whos_involved") {
	 document.write("   <td><img src='../images/i_whos_involved_f2.jpg' width='116' height='19'></td>")
} else {
	document.write("		        <td><a href='../who.asp' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_whos_involved','','../images/i_whos_involved_f2.jpg',1)'><img name='i_whos_involved' src='../images/i_whos_involved.jpg' width='116' height='19' border='0' alt='Who's Involved'></a></td>")
}
document.write("             </tr>")
document.write("		      <tr>")

if(currentPage="lend_a_hand") {
	 document.write("   <td><img src='../images/i_lend_a_hand_f2.jpg' width='116' height='19'></td>")
} else {
	document.write("		        <td><a href='../support.html' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_lend_a_hand','','../images/i_lend_a_hand_f2.jpg',1)'><img name='i_lend_a_hand' src='../images/i_lend_a_hand.jpg' width='116' height='19' border='0' alt='Lend a Hand'></a></td>")
}
document.write("             </tr>")
document.write("		      <tr>")

if(currentPage="contact_us") {
	 document.write("   <td><img src='../images/i_contact_us_f2.jpg' width='116' height='19'></td>")
} else {
	document.write("		        <td><a href='../contact.html' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage('i_contact_us','','../images/i_contact_us_f2.jpg',1)'><img name='i_contact_us' src='../images/i_contact_us.jpg' width='116' height='19' border='0' alt='Contact Us'></a></td>")
}

document.write("             </tr>")
document.write("		      <tr>")
document.write("		        <td>&nbsp;</td>")
 document.write("             </tr>")
document.write("		</table>")
}