//added by charles 20041006 changeImages function used below in the expandIt fuction
function changeImages() {
    if (document.images) {
        for (var i=0; i<changeImages.arguments.length; i+=2) {
            document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
        }
    }
}



 //builds menu (netscape 4 only)
 function arrange(whichMenu, firstLayer) {	
  nextY = document.layers[firstLayer].pageY + document.layers[firstLayer].document.height;
  for (i=firstLayer+1; i<document.layers.length; i++) {	 
   whichEl = document.layers[i];   
   if (whichEl.id.indexOf(whichMenu) != -1) {
		if (whichEl.visibility != "hide") {
		 whichEl.pageY = nextY;
		 nextY += whichEl.document.height;
		}		
   }   
  }  
  //right side sub nav & cart
  if (location.href.indexOf("") == -1) {
		if (whichMenu == "el_") { //adjust cart height if sub nav ("el_") changes		
			document.layers['cart1'].pageY = nextY + 10;		
			document.layers['cart2'].pageY = nextY + 37;			
			if (document.layers['cart2'].visibility != "hide") {document.layers['promo'].pageY = document.layers['cart2'].pageY + document.layers['cart2'].document.height}
			else {document.layers['promo'].pageY = document.layers['cart2'].pageY}			
		}  
		else {document.layers['navbottom'].pageY = nextY} //move stuff under main nav if it changes	
	}
	//shopelvis cart & nav bottom
	else {
		document.layers['cart1'].pageY = nextY;		
		document.layers['cart2'].pageY = nextY + 37;			
		document.layers['navbottom'].pageY = document.layers['cart2'].pageY + 27; //below cart
	}
 }  
 
 //called on page load (both ie & netscape)
 function initIt(){			
 
 	if (newBrowser){
	docContents = document.getElementsByTagName("div");
			for (i=0; i<docContents.length; i++) {																															
				if (docContents[i].id.indexOf("Child") !=  -1 && docContents[i].id != preexpanded && docContents[i].id != preexpandedmain || docContents[i].id == "cart2") {					
					docContents[i].style.display = "none";		
				}
				else {		
					docContents[i].style.display = "block";						
				}										
			}
	
	}
	else if ( IE4) {			
		if (newBrowser) {docContents = document.getElementsByTagName("div"); cartDiv = document.getElementById("cart2");} 
		else {docContents = document.all.tags("div"); cartDiv = document.all("cart2");}		
		cartDiv.style.display = "none";								
		for (i=0; i<docContents.length; i++) {						
			if (docContents(i).id.indexOf("Child") != -1 && docContents(i).id != preexpanded && docContents(i).id != preexpandedmain || docContents(i).id == "cart2") {								
				docContents(i).style.display = "none";		
			}
			else {
			docContents(i).style.display = "block";
			}							
		}							
	}		
	else if (NS4) {	
   for (i=0; i<document.layers.length; i++) {				
		whichEl = document.layers[i];				
    if (whichEl.id.indexOf("Child") != -1 && whichEl.id != preexpanded && whichEl.id != preexpandedmain || whichEl.id == "cart2") {			
			whichEl.visibility = "hide";
		}			
		else {whichEl.visibility = "show";}
   }   
   if (location.href.indexOf("") == -1) {
		arrange('el_', 0);
		arrange('main', 1);      
	 }
	 else {arrange('main', 0)}
  }     
 }
 
 //determine which expand function to call
 function expandIt(el, whichMenu, thisRow) {
  //added by charles to change both the images to plus, after this the function will continue to change whatever plus to minus is needed
//  changeImages('mainOne', 'http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg');
//  changeImages('mainTwo', 'http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg');
  if (!ver4) return;  
  if (newBrowser) {expandNew(el, whichMenu, thisRow)}
  else if(IE4) {expandIE4(el, whichMenu, thisRow)}
	else {expandNS(el, whichMenu, thisRow)}	
 }
 
 
 //expand menu function (5.0+ )
 function expandNew(el, whichMenu, thisRow) { 	
  //whichEl = el + "Child";
  whichEl = document.getElementById(el + "Child");
  whichIm = document.getElementById(el);
    
  //only expand one row at a time
	//*******************************************************	
  //loop through plus/minus images, change all to true
  if (newBrowser) {tempImg = document.getElementsByTagName("img")} else {tempImg = document.all.tags("img")}		
	for(i=0; i<tempImg.length; i++) {		
		if (tempImg[i].name.indexOf(whichMenu) != -1) {							
			//mainnav bullets
//			if (tempImg[i].src.indexOf("dk_1") != -1) {tempImg[i].src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//			else if (tempImg[i].src.indexOf("dk_2") != -1) {tempImg[i].src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//			else if (tempImg[i].src.indexOf("lt_1") != -1) {tempImg[i].src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
//			else if (tempImg[i].src.indexOf("lt_2") != -1) {tempImg[i].src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
			//plus-minuses
//			else if (tempImg[i].src.indexOf("_dk1") != -1) {tempImg[i].src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//			else if (tempImg[i].src.indexOf("_dk2") != -1) {tempImg[i].src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//			else if (tempImg[i].src.indexOf("_lt1") != -1) {tempImg[i].src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}			
//			else if (tempImg[i].src.indexOf("_lt2") != -1) {tempImg[i].src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}				
										
		}		
	}		
	
	//loop through divs, change display to "none"
	if (newBrowser) {tempColl = document.getElementsByTagName("div")} else {tempColl = document.all.tags("div")}	
  for (i=0; i<tempColl.length; i++) {
		if (tempColl[i].id.indexOf("Child") != -1 && tempColl[i].id.indexOf(whichMenu) != -1 && tempColl[i].id != whichEl.id) {tempColl[i].style.display = "none";} 		
	}	
	//*******************************************************	
                        
  //expand selected div
  if (whichEl.style.display == "none") {
		whichEl.style.display = "block"; 
//		if (thisRow == "_dk1") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_dkblu.jpg"}
//		else if (thisRow == "_dk2") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_dkblu.jpg"}
//		else if (thisRow == "_lt1") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_ltblu.jpg"}
//		else if (thisRow == "_lt2") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_ltblu.jpg"}		
//		else {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_dkblu.jpg"}			
		
		
	}
  else {		
		whichEl.style.display = "none"; 
//		if (thisRow == "_dk1") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//		else if (thisRow == "_dk2") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//		else if (thisRow == "_lt1") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}		
//		else if (thisRow == "_lt2") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}				
//		else {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}					
		
	}	 
 }
 
 //expand menu function (ie4 )
 function expandIE4(el, whichMenu, thisRow) { 	
  whichEl = eval(el + "Child");
  if (newBrowser) {whichIm = document.getElementById(el)}
  else {whichIm = document.all(el)}
    
  //only expand one row at a time
	//*******************************************************	
  //loop through plus/minus images, change all to true
  if (newBrowser) {tempImg = document.getElementsByTagName("img")} else {tempImg = document.all.tags("img")}		
	for(i=0; i<tempImg.length; i++) {		
		if (tempImg(i).name.indexOf(whichMenu) != -1) {							
			//mainnav bullets
//			if (tempImg(i).src.indexOf("dk_1") != -1) {tempImg(i).src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//			else if (tempImg(i).src.indexOf("dk_2") != -1) {tempImg(i).src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//			else if (tempImg(i).src.indexOf("lt_1") != -1) {tempImg(i).src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
//			else if (tempImg(i).src.indexOf("lt_2") != -1) {tempImg(i).src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
			//plus-minuses
//			else if (tempImg(i).src.indexOf("_dk1") != -1) {tempImg(i).src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//			else if (tempImg(i).src.indexOf("_dk2") != -1) {tempImg(i).src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//			else if (tempImg(i).src.indexOf("_lt1") != -1) {tempImg(i).src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}			
//			else if (tempImg(i).src.indexOf("_lt2") != -1) {tempImg(i).src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}				
										
		}		
	}		
	
	//loop through divs, change display to "none"
	if (newBrowser) {tempColl = document.getElementsByTagName("div")} else {tempColl = document.all.tags("div")}	
  for (i=0; i<tempColl.length; i++) {
		if (tempColl(i).id.indexOf("Child") != -1 && tempColl(i).id.indexOf(whichMenu) != -1 && tempColl(i).id != whichEl.id) {tempColl(i).style.display = "none";} 		
	}	
	//*******************************************************	
                        
  //expand selected div
  if (whichEl.style.display == "none") {
		whichEl.style.display = "block"; 
//		if (thisRow == "_dk1") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_dkblu.jpg"}
//		else if (thisRow == "_dk2") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_dkblu.jpg"}
//		else if (thisRow == "_lt1") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_ltblu.jpg"}
//		else if (thisRow == "_lt2") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_ltblu.jpg"}		
//		else {whichIm.src = ""}			
		
	
	}
  else {		
		whichEl.style.display = "none"; 
//		if (thisRow == "_dk1") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//		else if (thisRow == "_dk2") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//		else if (thisRow == "_lt1") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}		
//		else if (thisRow == "_lt2") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}				
//		else {whichIm.src = ""}					
		
	}	 
 }
 
 //expand menu function (netscape 4 only)
 function expandNS(el, whichMenu, thisRow) {		
  whichEl = eval("document." + el + "Child");
  whichIm = eval("document." + el + "Parent.document.images['imEx']");             	
	
	//only expand one row at a time
	//*******************************************************	  
  for (i=0; i<document.layers.length; i++) {
		thisEl = document.layers[i];								
    if (thisEl.id.indexOf("Child") != -1 && thisEl.id.indexOf(whichMenu) != -1 && thisEl.id != whichEl.id) {thisEl.visibility = "hide";}	//change visibility to none
		else if(thisEl.id.indexOf("Parent") != -1 && thisEl.id.indexOf(whichMenu) != -1) {
			thisIm = eval("document." + thisEl.id + ".document.images['imEx']");	
			//mainnav bullets
			if (thisIm.src.indexOf("dk_1") != -1) {thisIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
			else if (thisIm.src.indexOf("dk_2") != -1) {thisIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
			else if (thisIm.src.indexOf("lt_1") != -1) {thisIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
			else if (thisIm.src.indexOf("lt_2") != -1) {thisIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
			//mainnav plus					
			else if (thisIm.src.indexOf("_dk1") != -1) {thisIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
			else if (thisIm.src.indexOf("_dk2") != -1) {thisIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
			else if (thisIm.src.indexOf("_lt1") != -1) {thisIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
			else if (thisIm.src.indexOf("_lt2") != -1) {thisIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
		
			
		} 
	}	    	
	//*******************************************************
	
  //expand selected layer
  if (whichEl.visibility == "hide") {
		whichEl.visibility = "show";
//		if (thisRow == "_dk1") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_dkblu.jpg"}
//		else if (thisRow == "_dk2") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_dkblu.jpg"}
//		else if (thisRow == "_lt1") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_ltblu.jpg"}
//		else if (thisRow == "_lt2") {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_ltblu.jpg"}		
//		else {whichIm.src = "http://www.standard.netdetective.net/images/yellow_minus_ltblu.jpg"}		
	}	
  else {
		whichEl.visibility = "hide"; 
//		if (thisRow == "_dk1") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//		else if (thisRow == "_dk2") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_dkblu.jpg"}
//		else if (thisRow == "_lt1") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
//		else if (thisRow == "_lt2") {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}
//		else {whichIm.src = "http://www.standard.netdetective.net/images/red_darrow_ltblu.jpg"}			
  }      
  if (location.href.indexOf("") == -1) {
		arrange('el_', 0);
		arrange('main', 1);      
	 }
	 else {arrange('main', 0)
	} 
 } 
