function activateImage() {
	var mainHeader = location.href;
	if (mainHeader.match("images")) {
		document.getElementById("imagesOff").style.display="none";
		document.getElementById("imagesOn").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("cultivation")) {
		document.getElementById("visitorOff").style.display="none";
		document.getElementById("visitorOn").style.display="block";
	} else if (mainHeader.match("propagation")) {
		document.getElementById("propagationOff").style.display="none";
		document.getElementById("propagationOn").style.display="block";
	} else if (mainHeader.match("location")) {
		document.getElementById("locationOff").style.display="none";
		document.getElementById("locationOn").style.display="block";
	} else if (mainHeader.match("identification")) {
		document.getElementById("identificationOff").style.display="none";
		document.getElementById("identificationOn").style.display="block";
	} else if (mainHeader.match("images")) {
		document.getElementById("imagesOff").style.display="none";
		document.getElementById("imagesOn").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="#0B530B";
}
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("cultivation")) {
		//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("location")) {
		//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("propagation")) {
		//no rollover effect
	} else {
		expand(divsub,rolloverimage,offImage);
	}
}

function checkExpandidentification(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("identification")) {
		//no rollover effect
	} else {
		expand(divsub,rolloverimage,offImage);
	}
}

function checkExpandimages(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("images")) {
		//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("cultivation")) {
		var urlSection = "cultivation";
	} else if (mainHeader.match("propagation")) {
		var urlSection = "propagation";
	} else if (mainHeader.match("location")) {
		var urlSection = "location";
	} else if (mainHeader.match("identification")) {
		var urlSection = "identification";
	} else if (mainHeader.match("images")) {
		var urlSection = "images";
	}
   
   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("images")) {
		document.getElementById("imagesOff").style.display="none";
		document.getElementById("imagesOn").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();
}

function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{
ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
