active=false;
function hidesubnav(hideid){
	o=document.getElementById(hideid);
	o.style.visibility='hidden';
}
function subnav(id,vis){
	d=document.getElementById(id);
	if(vis=='show'){
		try{
			window.clearTimeout(timer);
			document.getElementById(hideid).style.visibility='hidden'; //hide the previously active subnav
		}catch(e){}
		d.style.visibility='visible';
	}else{
		//alert(vis);
		hideid=id;
		timer=window.setTimeout("hidesubnav('"+hideid+"')",50);
	}
}
function swapimage(o,state){
	// use firstChild if you have wrapped the image in an <a> make sure there's no linebreaks in the code
	o=o.firstChild;
	if(state=='over' && o.name!=currnav){ //if this page isn't active, change the image state
		o.src="media/images/nav"+o.name+"_o.gif";
		return true;
	}
	if(state=='down'){
		o.removeAttribute('onmouseover');
		o.src="media/images/nav"+o.name+"_d.gif";
		return true;
	}
	else if(o.name!=currnav){ //if this page isn't active, change the image state
		o.src="media/images/nav"+o.name+".gif";
	}
}
function preloadnav(){
	o=document.images;
	//the needle to find in the haystack
	needle="nav";
	iarr=new Array();
	iarr2=new Array();
	for(i=0;i<o.length;i++){
		file=o[i].src.split('.');
		filext=file[file.length-1]; //extension is the last item of the array
		file=file.slice(0,file.length-1); //remove last item to get the file path
		filepath=file.join('.');
		//only preload images with needle in the file path
		if(filepath.indexOf(needle)>0){
			newfile=filepath+"_o."+filext;
			iarr[i]=new Image;
			iarr[i].src=newfile;
			//alert(newfile);
			newfile2=filepath+"_d."+filext;
			iarr2[i]=new Image;
			iarr2[i].src=newfile2;
			//alert(newfile2);
			//alert(newfile);
		}
	}
}
function setnav(){
	try{
		o=document.getElementById(currnav);
		o.src="media/images/nav"+currnav+"_d.gif";
	}catch(e){}
}