
// Based upon http://www.jessett.com/web_sites/dhtml/create_dhtml_menu.shtml

var activeSub=0;
var SubNum=0;

function reDo(){ window.location.reload() }
	window.onresize = reDo;

// global vars
var timerID = null;
var timerOn = true;
var timecount = 100;
var what = null;
var newbrowser = true;
var check = false;

if (document.images) { 
  imagedir = 'img/nav/';

 compA = new Image(); compA.src=imagedir+'competition_off.gif';
 compB = new Image(); compB.src=imagedir+'competition_on.gif';

 resultsA = new Image(); resultsA.src=imagedir+'results_off.gif';
 resultsB = new Image(); resultsB.src=imagedir+'results_on.gif';

 aboutA = new Image(); aboutA.src=imagedir+'about_off.gif';
 aboutB = new Image(); aboutB.src=imagedir+'about_on.gif';

 pressA = new Image(); pressA.src=imagedir+'press_off.gif';
 pressB = new Image(); pressB.src=imagedir+'press_on.gif';

 marketA = new Image(); marketA.src=imagedir+'marketing_off.gif';
 marketB = new Image(); marketB.src=imagedir+'marketing_on.gif';

 storeB = new Image(); storeB.src=imagedir+'store_on.gif';
 storeA = new Image(); storeA.src=imagedir+'store_off.gif';

 contactB = new Image(); contactB.src=imagedir+'contact_on.gif';
 contactA = new Image(); contactA.src=imagedir+'contact_off.gif';

 homeB = new Image(); homeB.src=imagedir+'home_on.gif';
 homeA = new Image(); homeA.src=imagedir+'home_off.gif';

}



function init(){
	if (document.layers) { //alert("Netscape 4");
		layerRef="document.layers";
		styleSwitch="";
		visibleVar="show";
		screenSize = window.innerWidth;
		what ="ns4";
	}
	else if(document.all){ //alert ("IE");
		layerRef="document.all";
		styleSwitch=".style";
		visibleVar="visible";
		screenSize = document.body.clientWidth + 18;
		what ="ie";
	}
	else if(document.getElementById){ //alert ("Netscape 6");
		layerRef="document.getElementByID";
		styleSwitch=".style";
		visibleVar="visible";
		what="moz";
	} 
	else{ //alert("Older than 4.0 browser.");
		what="none";
		newbrowser = false;
	}

	window.status='Altamont Motorsports Park';
	check = true;

	hideAll();  
}

function showLayer(layerName){
    	if(check){
       		if (what =="none") { return; }
        	else if (what == "moz"){
			document.getElementById(layerName).style.visibility="visible";
       			}
       		else{
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
		}
	 }
       	else {
		// alert ("Please wait for the page to finish loading.");
       		return;
		}
}


function hideLayer(layerName){
   	if(check){
       		if (what =="none") { return; }
       		else if (what == "moz"){
       			document.getElementById(layerName).style.visibility="hidden";
       			}
       		else{
               		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
			}
       	}
       	else {
		// alert ("Please wait for the page to finish loading.");
       		return;
	}
}


function startTime() { if (timerOn == false) {
	timerID=setTimeout("hideAll();",timecount); 
	timerOn = true;
} }

function stopTime() { if (timerOn) {
	clearTimeout(timerID);
	timerID = null;
	timerOn = false;
} }


function showOn(imgName) { 
	//if(timerOn) {
		if (document.images) document[imgName].src = eval(imgName + "B.src");
	//}
}

function showOff(imgName) { 
	//if(timerOn!=true) {
		if (document.images) document[imgName].src = eval(imgName + "A.src");
	//}
}

//function imgOn(imgName) { if (document.images) { document[imgName].src = eval(imgName + "on.src"); } }

//function imgOff(imgName) { if (document.images) { document[imgName].src = eval(imgName + "off.src"); } }


function onLoad(){ init(); }


