function activateImage() {
	var mainHeader = location.href;
	if (mainHeader.match("animals")) {
		document.getElementById("animalsOff").style.display="none";
		document.getElementById("animalsOn").style.display="block";
	}
	
}	

function changeNav(value,secondValue,thirdValue,fourthValue) {
	
	//first we will figure out from the url which navigation button will appear active with the arrow
	var mainHeader = location.href;
	if (mainHeader.match("visitors")) {
		document.getElementById("visitorOff").style.display="none";
		document.getElementById("visitorOn").style.display="block";
	} else if (mainHeader.match("education")) {
		document.getElementById("educationOff").style.display="none";
		document.getElementById("educationOn").style.display="block";
	} else if (mainHeader.match("conservation")) {
		document.getElementById("conservationOff").style.display="none";
		document.getElementById("conservationOn").style.display="block";
	} else if (mainHeader.match("kids")) {
		document.getElementById("kidsOff").style.display="none";
		document.getElementById("kidsOn").style.display="block";
	} else if (mainHeader.match("animals")) {
		document.getElementById("animalsOff").style.display="none";
		document.getElementById("animalsOn").style.display="block";
	} else  {
		
	}
	
	//change the variable by concatenating
	if (value != "") {
		var activateImage = value + "linkOn";
		//change the color of the active link to black
		document.getElementById(value).style.color= '#000000';
	} else {
		
	}
	
	
	
	//change the color of the active subnav link to black
	if (fourthValue != "") {
		document.getElementById(fourthValue).style.color= '#000000';
	} else {
	
	}
	
	if (activateImage != "") {
		//display the little icon next to the active page link
		document.getElementById(activateImage).style.display= "inline";
	} else {
		
	}
	
	//unhide the subnav if you are on the active page of the main link
	if (secondValue == "true") {
		document.getElementById("subNavExist").style.display= "block";
	} else {
	}
	
	if (thirdValue == "true") {
		document.getElementById("subNavExist2").style.display= "block";
	} else {
	}
}
function swapImage(image1,image2,subsection) {

	document.getElementById(image1).style.display= "none";
	document.getElementById(image2).style.display= "block";
	document.getElementById(subsection).style.display= "block";
	
}
function swapImageBack(image1,subsection,image2) {
	
	document.getElementById(image1).style.display= "none";
	document.getElementById(subsection).style.display="none";
	document.getElementById(image2).style.display= "block";	
}
function showSub(subsection) {
	document.getElementById(subsection).style.display= "block";
	
}

function navrollOver(background) {
	
	document.getElementById(background).style.backgroundColor="#a86609";
}
function navrollOut(background) {
	document.getElementById(background).style.backgroundColor="#7f490e";
}
function checkExpandVis(divsub, rolloverimage, offImage) {
	//this function prevents the rollovers if you are on the specific category and the button is in the on state
	var mainHeader = location.href;
	
	if (mainHeader.match("visitors")) {
		//no rollover effect
	} else {
		expand(divsub,rolloverimage,offImage);
	}
}

function checkExpandCons(divsub, rolloverimage, offImage) {
	//this function prevents the rollovers if you are on the specific category and the button is in the on state
	var mainHeader = location.href;
	
	if (mainHeader.match("conservation")) {
		//no rollover effect
	} else {
		expand(divsub,rolloverimage,offImage);
	}
}

function checkExpandEd(divsub, rolloverimage, offImage) {
	//this function prevents the rollovers if you are on the specific category and the button is in the on state
	var mainHeader = location.href;
	
	if (mainHeader.match("education")) {
		//no rollover effect
	} else {
		expand(divsub,rolloverimage,offImage);
	}
}

function checkExpandKids(divsub, rolloverimage, offImage) {
	//this function prevents the rollovers if you are on the specific category and the button is in the on state
	var mainHeader = location.href;
	
	if (mainHeader.match("kids")) {
		//no rollover effect
	} else {
		expand(divsub,rolloverimage,offImage);
	}
}

function checkExpandAnimals(divsub, rolloverimage, offImage) {
	//this function prevents the rollovers if you are on the specific category and the button is in the on state
	var mainHeader = location.href;
	
	if (mainHeader.match("animals")) {
		//no rollover effect
	} else {
		expand(divsub,rolloverimage,offImage);
	}
}

function hideSub(subnav) {
	document.getElementById(subnav).style.display="none";

}

function expand(divsub, rolloverimage, offImage)
{
   var subnav = document.getElementById(divsub);
   var overimage = document.getElementById(rolloverimage);
   var defaultimage = document.getElementById(offImage);
   
   subnav.style.visibility = "visible";
   subnav.style.display = "block";
   overimage.style.visibility = "visible";
   overimage.style.display = "block";
   defaultimage.style.visibility = "hidden";
   defaultimage.style.display = "none";
   
}
function collapse(divsub, rolloverimage, offimage)
{
   var subnav = document.getElementById(divsub);
   var overimage = document.getElementById(rolloverimage);
   var defaultimage = document.getElementById(offimage);
   
   subnav.style.visibility = "hidden";
   subnav.style.display = "none";
   overimage.style.visibility = "hidden";
   overimage.style.display = "none";
   defaultimage.style.visibility = "visible";
   defaultimage.style.display = "block";
}

function checkCollapse(section, divsub, rolloverimage, offimage)
{
   var mainHeader = location.href;
	
	if (mainHeader.match("visitors")) {
		var urlSection = "visitors";
	} else if (mainHeader.match("education")) {
		var urlSection = "education";
	} else if (mainHeader.match("conservation")) {
		var urlSection = "conservation";
	} else if (mainHeader.match("kids")) {
		var urlSection = "kids";
	} else if (mainHeader.match("animals")) {
		var urlSection = "animals";
	}
   
   if (urlSection == section) {
	   //do nothing
   } else {
	   var subnav = document.getElementById(divsub);
	   var overimage = document.getElementById(rolloverimage);
	   var defaultimage = document.getElementById(offimage);
	   
	   subnav.style.visibility = "hidden";
	   subnav.style.display = "none";
	   overimage.style.visibility = "hidden";
	   overimage.style.display = "none";
	   defaultimage.style.visibility = "visible";
	   defaultimage.style.display = "block";
   }
}

function changeAnimalNav(value) {
	var activeImage = value + "On";
	var unactiveImage = value + "Off";
	document.getElementById(unactiveImage).style.display= "none";
	document.getElementById(activeImage).style.display= "inline";
	
	//activate the on image
	var mainHeader = location.href;
	if (mainHeader.match("animals")) {
		document.getElementById("animalsOff").style.display="none";
		document.getElementById("animalsOn").style.display="block";
	}
}
function swapPage(targ,selObj,restore) {
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) {
	  selObj.selectedIndex=0;
	}
}

function openWindow(theURL, winName, features) {
    win = window.open(theURL,winName,features);
    win.focus();
}