function hidesubnav(hideid){
	if(flyactive==false){
		document.getElementById(hideid).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);
	}
}
//flyouts
flyactive=false;
function hideflyout(hideid2){
	if(flyactive==false){
		document.getElementById(hideid2).style.visibility='hidden';
	}
}
function flyout(id,vis){
	var d=id.parentNode.childNodes[2];
	if(vis=='show'){
		try{
			window.clearTimeout(timer2);
			document.getElementById(hideid2).style.visibility='hidden'; //hide the previously active subnav
		}catch(e){}
		d.style.visibility='visible';
	}else{
		//alert(vis);
		hideid2=d.id;
		timer2=window.setTimeout("hideflyout('"+hideid2+"')",50);
	}
}
flyactive2=false;
function hideflyout2(hideid3){
	if(flyactive2==false){
		document.getElementById(hideid3).style.visibility='hidden';
	}
}
function flyout2(id,vis){
	var d=id.parentNode.childNodes[2];
	if(vis=='show'){
		try{
			window.clearTimeout(timer3);
			document.getElementById(hideid3).style.visibility='hidden'; //hide the previously active subnav
		}catch(e){}
		d.style.visibility='visible';
	}else{
		//alert(vis);
		hideid3=d.id;
		timer3=window.setTimeout("hideflyout2('"+hideid3+"')",50);
	}
}
function swapimage(o,state){
	// use firstChild if you have wrapped the image in an <a>
	o=o.firstChild;
	if(state=='over' && o.name!=currnav){ //if this page isn't active, change the image state
		o.src="images/nav_"+o.name+"_o.jpg";
		return true;
	}
	if(state=='down'){
		o.removeAttribute('onmouseover');
		o.src="images/nav_"+o.name+"_d.jpg";
		return true;
	}
	else if(o.name!=currnav){ //if this page isn't active, change the image state
		o.src="images/nav_"+o.name+".jpg";
	}
}
function preloadnav(){
	o=document.images;
	//the needle to find in the haystack
	needle="nav_";
	iarr=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);
		}
	}
}
function setnav(){
	try{
		o=document.getElementById(currnav);
		o.src="images/nav_"+currnav+"_d.jpg";
	}catch(e){}
}