//Image navigation mouseover, out, and set state menu functions

function initImgNav() {
for (var i=0;i<allImg.length;i++) {
	allImg[i].setAttribute('origSrc', allImg[i].src);
	allImg[i].setAttribute('overSrc', allImg[i].src.replace(/^(.*)(\.[^.]+)$/, "$1_on$2"));
}
//MAIN NAV STATE
//get the folder of the current page (which, in this case is the 3rd element in pathArray)
//the folder name and the id of the image are set up to use the same name
//thus we can use the folder name to set the img source to hover
//designate that this is current page by affixing 'Selected' to its id
//this is used as a flag so we don't change its state in mouseover and out events

pathArray = document.location.href.split("/");
thisFolder = pathArray[3];

if (document.getElementById(thisFolder)) {
	document.getElementById(thisFolder).src=document.getElementById(thisFolder).getAttribute('overSrc');
	document.getElementById(thisFolder).id=document.getElementById(thisFolder).id+'Selected';
	}
}

function imgMouseOver(imgId) {
	if (document.getElementById(imgId) && !(document.getElementById(imgId).id.match(/Selected$/))) {
			document.getElementById(imgId).src=document.getElementById(imgId).getAttribute('overSrc');
		}
 	}
 
function imgMouseOut(imgId) {
	if (document.getElementById(imgId) && !(document.getElementById(imgId).id.match(/Selected$/))){
		document.getElementById(imgId).src=document.getElementById(imgId).getAttribute('origSrc');
		}
	}
