//reloads the window if Nav4 resized
function reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);

//browser detection
var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4))?true:false;
var newBrowser;
if (document.getElementById) {newBrowser = true}
ver4 = (NS4 || IE4 || newBrowser) ? true : false;		

//initialize all menu classes & plus/minus images
expanded = ""; //id of pre-expanded menu
galleryClass = "child";
//galleryImg = "true.gif";
sodClass = "child";
/*thisSeasonImg = "true.gif";
scheduleClass = "child";
scheduleImg = "true.gif";
fanCentralClass = "child";
fanCentralImg = "true.gif";
firstTimersClass = "child";
firstTimersImg = "true.gif";
horsemenClass = "child";
horsemenImg = "true.gif";
interactClass = "child";
interactImg = "true.gif";*/

//figure out what directory you're in so the menu can pre-expand
thisPage = location.href;
if (thisPage.indexOf("\/gallery\/") != -1) {
	galleryClass = "childshown";
	//galleryImg = "false.gif";
	expanded = "elOneChild";
}
else if (thisPage.indexOf("\/sod\/") != -1) {
	sodClass = "childshown";
	//sodImg = "false.gif"
	expanded = "elTwoChild";
}
/*else if (thisPage.indexOf("\/schedule\/") != -1) {
	scheduleClass = "childshown";
	scheduleImg = "false.gif"
	expanded = "elThreeChild";
}
else if (thisPage.indexOf("\/fan\-central\/") != -1) {
	fanCentralClass = "childshown";
	fanCentralImg = "false.gif"
	expanded = "elFourChild";
}
else if (thisPage.indexOf("\/first\-timers\/") != -1) {
	firstTimersClass = "childshown";
	firstTimersImg = "false.gif"
	expanded = "elFiveChild";
}
else if (thisPage.indexOf("\/horsemen\/") != -1) {
	horsemenClass = "childshown";
	horsemenImg = "false.gif";
	expanded = "elSixChild";
}
else if (thisPage.indexOf("\/interact\/") != -1) {
	interactClass = "childshown";
	interactImg = "false.gif";
	expanded = "elSevenChild";
}	
*/	
//must build imgArray for each item in menu
var menuItems = 2;
var imgArray = new Array(menuItems-1);	
if (NS4) {
	for(i=0; i<menuItems; i++) {
		imgArray[i] = "imEx";
	}
}
else {
	imgArray[0] = "elOne";
	imgArray[1] = "elTwo";
/*	imgArray[2] = "elThree";
	imgArray[3] = "elFour";
	imgArray[4] = "elFive";
	imgArray[5] = "elSix";
	imgArray[6] = "elSeven";*/
}	

//builds menu (netscape only)
function arrange() {	
	nextY = document.layers[0].pageY + document.layers[0].document.height;
	for (i=0+1; i<document.layers.length; i++) {
		whichEl = document.layers[i];   
		if (whichEl.visibility != "hide") {
			whichEl.pageY = nextY;
			nextY += whichEl.document.height;        
		}
	}
}
 
//called on page load (both ie & netscape)
function initIt() {
    var docContents;
	//5.0 browsers
	if (newBrowser || IE4) {	
		if (newBrowser) docContents = document.getElementsByTagName("div");
		else docContents = document.all.tags("div");  
	
 		for (i=0; i<docContents.length; i++) {																															
 			if (docContents(i).id.indexOf("Child") != -1 && docContents(i).id != expanded) docContents(i).style.display = "none";
 			else docContents(i).style.display = "block";
 		}			
	}			
	//netscape 4
	else if (NS4) {
		for (i=0; i<document.layers.length; i++) {
 			whichEl = document.layers[i];
			if (whichEl.id.indexOf("Child") != -1 && whichEl.id != expanded) whichEl.visibility = "hide"; 		
 			else whichEl.visibility = "show";
 		} 		
 		arrange();
  }  
}
 
//determine which expand function to call
function expandIt(el) {
	if (!ver4) return;  
	if (newBrowser || IE4) expandNew(el)
	else expandNS(el) 
}
 
//expand menu function (5.0+ browsers)
function expandNew(el) { 		
	whichEl = eval(el + "Child");
	//if (newBrowser) whichIm = document.getElementById(el);    
	//else whichIm = document.images[el];     		
/*
	//switch all plus/minus images to plus	
	for(i=0; i<imgArray.length; i++) {
		if (newBrowser) thisImg = document.getElementById(imgArray[i]);    
		else thisImg = document.images[imgArray[i]];  
		if (thisImg.id.indexOf(el) == -1) thisImg.src = "/images/interior/true.gif";
	}		
	
	//hide all other divs (only 1 expanded at a time)
	if (newBrowser) {allDivs = document.getElementsByTagName("div")} else {allDivs = document.all.tags("div")}	
	for (i=0; i<allDivs.length; i++) {
		if (allDivs[i].id.indexOf("Child") != -1 && allDivs[i].id != whichEl.id) {allDivs[i].style.display = "none";} 		
	}	
	*/	
	//expand selected div
	if (whichEl.style.display == "none") {
		whichEl.style.display = "block";
		//whichIm.src = "/images/interior/false.gif";   		 
	}
	else {
		whichEl.style.display = "none";
		//whichIm.src = "/images/interior/true.gif";  
	}	
} 
 
//expand menu function (netscape 4 only)
function expandNS(el) {		
	whichEl = eval("document." + el + "Child");
	//whichIm = eval("document." + el + "Parent.document.images['imEx']");             			
	
	//only expand one layer at a time, hide all others, make plus/minus a plus
	for (i=0; i<document.layers.length; i++) {		
		thisEl = document.layers[i];								
		if (thisEl.id.indexOf("Child") != -1 && thisEl.id != whichEl.id) {thisEl.visibility = thisEl.visibility;}	//change visibility to none
		else if(thisEl.id.indexOf("Parent") != -1 && thisEl.id.indexOf("elEight") == -1) {
	 		//thisIm = eval("document." + thisEl.id + ".document.images['imEx']");	
	 		//thisIm.src = "/images/interior/true.gif"; 	
		} 
	}	   
	
	//expand selected layer
	if (whichEl.visibility == "hide") {	  
		whichEl.visibility = "show";
		//whichIm.src = "/images/interior/false.gif";   
	}
	else {
		whichEl.visibility = "hide";
		//whichIm.src = "/images/interior/true.gif";   
	}      
	arrange();
}
	 
with (document) {
	write("<STYLE TYPE='text/css'>");
	if (NS4) {	
		write(".monkey {position:absolute; visibility:hidden; left:0px; top:170px}");   
		write(".parent {position:absolute; visibility:hidden; left:0px}");
		write(".child {position:absolute; visibility:hidden; left:0px}");
		write(".childshown {position:absolute; visibility:hidden; left:0px}");
	}
	else {
		write(".child {display:none}")
		write(".childshown {display:block}")
	}
	write("</STYLE>");
}
//called on page load (for netscape only)
 function showAll() {
  for (i=firstInd; i<document.layers.length; i++) {
   whichEl = document.layers[i];
   //whichEl.visibility = "show";
  }
 }