<!-- 
/*
------------------------------------------------------------------------------
File Name: simple_menu.js
Company: pH2 Enterprises
Author: Phillip J. Henslee II <ph2@ph2enterprises.com> ©2002
Purpose: Creates simple drop down menu
Functions: 6
Date Created: January 15, 2002
Last Modified: February 21, 2002
Dependent Files: config.js, detection.js, utility_lib.js, simple_menu_data.js
File Status: Optional

** Begin Simple Menu Functions **
These functions create simple drop-down menus. These menus work
in IE 4 or greater and Netscape 4 or greater. Use code generator to create
these menus for you and create example pages.
------------------------------------------------------------------------
*/


/* 
------------------------------------------------------------------------
Function getPosition()
Purpose: return the real position of an element
Arguments: 1
Arg 0: i
Arg 1: which
------------------------------------------------------------------------
*/ 
function getPosition(i,which) {
  iPos = 0
  while (i!=null) {
    iPos += i["offset" + which]
    i = i.offsetParent
  }
  return iPos
}

/* 
------------------------------------------------------------------------
Function showMenu()
Purpose: makes the current menu visiable.
Arguments: 1
Arg 0: sMenu - name of the menu to show
------------------------------------------------------------------------
*/ 

function showMenu(sMenu){
var theMenuObj;
	
if(document.getElementById)
	{ 
	theMenuObj = document.getElementById(sMenu);
	theRegObj = document.getElementById("menureg1");
	//theMenuObj.style.left = getPosition(theRegObj,"Left")
	//alert(getPosition(theRegObj,"Left"));
	theMenuObj.style.visibility = 'visible';
	}
else if(document.all)
	{ 
	theMenuObj = document.all[sMenu];
	theMenuObj.style.visibility = 'visible';
	}
else if(document.layers)
	{ 
	theMenuObj = document.layers[sMenu];
	theMenuObj.visibility = 'show';
	}
}


/* 
------------------------------------------------------------------------
Function hideMenu()
Purpose: makes the current menu hidden.
Arguments: 1
Arg 0: sMenu - name of the menu to hide
------------------------------------------------------------------------
*/ 

function hideMenu(sMenu){
var theMenuObj;
	
if(document.getElementById)
	{
	theMenuObj = document.getElementById(sMenu);
	theMenuObj.style.visibility = 'hidden';
	}
else if(document.all)
	{ 
	theMenuObj = document.all[sMenu];
	theMenuObj.style.visibility = 'hidden';
	}
else if(document.layers)
	{
	theMenuObj = document.layers[sMenu];
	theMenuObj.visibility = 'hide';
	}
}

/* 
------------------------------------------------------------------------
Function menuOver()
Purpose: menu rollover event
Arguments: 1
Arg 0: sMenu - name of the menu 
------------------------------------------------------------------------
*/ 

function menuOver(sMenu,sColor,sfontColor){

	var theMenuObj;

	if(document.getElementById)
		{
		theMenuObj = document.getElementById(sMenu);
		theMenuObj.style.backgroundColor= sColor;
		theMenuObj.style.color= sfontColor;
		}
		
	else if(document.all)
		{ 
		theMenuObj = document.all[sMenu];
		theMenuObj.style.backgroundColor= sColor;
		theMenuObj.style.color= sfontColor;
		}
	else if(document.layers)
		{
		theMenuObj = eval(sMenu);
		theMenuObj.bgColor= sColor; 
		theMenuObj.color = sfontColor;
		}	
}

/* 
------------------------------------------------------------------------
Function menuOut()
Purpose: menu rollout event
Arguments: 1
Arg 0: sMenu - name of the menu
------------------------------------------------------------------------
*/

function menuOut(sMenu,sColor,sfontColor){

	var theMenuObj;

	if(document.getElementById)
		{
		theMenuObj = document.getElementById(sMenu);
		theMenuObj.style.backgroundColor=sColor;
		theMenuObj.style.color=sfontColor;
		}
	else if(document.all)
		{	
		theMenuObj = document.all[sMenu];
		theMenuObj.style.backgroundColor=sColor;
		theMenuObj.style.color=sfontColor;
		}
	else if(document.layers)
		{
		theMenuObj = eval(sMenu);
		theMenuObj.bgColor=sColor; 
		}
	
}


/* 
------------------------------------------------------------------------
Function buildMenuDiv()
Purpose: creates a div for each menu
Arguments: 4
Arg 0: sMenu - name of the menu to show
------------------------------------------------------------------------
*/ 

var tdID = 0;
var separator="<img src=images/spacer.gif height=1 width=1>";
var alreadyRendered = false;

function buildMenuDiv(divID,arrMenuItems,posLeft,posTop,imenuWidth,color,colorActive,fontColor,fontColorActive,borderColor,lineColor,style,useDivisions,useCaps,capHeight,capColor,isPreview){
	
	var isFirstItem = true;
	
	if (isNav6) {
	
		strMenuDiv = "<div id=\"" + divID + "\" style=\"position:absolute; width:" + ((imenuWidth -2))  + "; z-index:1; top:"+ posTop +"px; left: " + posLeft + "px; background-color:" + color +"; border:1px  solid " + borderColor +"; visibility: hidden;\" onMouseover=\"showMenu(\'"+ divID +"\');\"  onMouseout=\"hideMenu(\'" + divID + "\');\">"        
	    
	    if(useCaps){
			  	strMenuDiv += "<div id=\"topcap\" style=\"position:relative; height:" + capHeight +"px; width:" + (imenuWidth -2)  + "; z-index:3; left: 0; background-color:" + capColor + ";\">" + separator + "</div>"
	    }
	    
	    for (x = 0; x < arrMenuItems.length; x++){
	    
          if(arrMenuItems[x][0]!=null){
	        if (!isFirstItem & useDivisions == true){
	      	strMenuDiv += "<div id=\"division\" style=\"position:relative; height:1; width:" + (imenuWidth -2)  + "; z-index:3; left: 0; background-color:" + lineColor + ";\">" + separator + "</div>"
	        }
	      	strMenuDiv += "<div id=\"menuItem" + tdID + "\" style=\"position:relative; background-color:"+ color +"; padding:1px; padding-left:3px; z-index:2; \" onMouseover=\"menuOver(\'menuItem" + tdID + "\',\'" + colorActive +"\',\'"+ fontColorActive +"\');\" onMouseout=\"menuOut(\'menuItem" + tdID + "\',\'" + color + "\',\'" + fontColor +"\' );\" class=\" " + style + "\" onClick=\"loadURL('"+ arrMenuItems[x][1] + "')\">" + arrMenuItems[x][0] + "</div>";
	    	tdID = tdID +1
	    	isFirstItem = false;
	    	}
	      	}
		
		if(useCaps){
			  	strMenuDiv += "<div id=\"topcap\" style=\"position:relative; height:" + capHeight +"px; width:" + (imenuWidth -2)  + "; z-index:3; left: 0; background-color:" + capColor + ";\">" + separator + "</div>"
	    }
		
		strMenuDiv += "</div>"
		document.write(strMenuDiv);
		if(debugState){  
			alert(strMenuDiv);
        }
        
    }else{
        
		strMenuDiv = "<div id=\"" + divID + "\" style=\"position:absolute; width:" + ((imenuWidth -2))  + "; z-index:1; top:"+ posTop +"px; left: " + posLeft + "px; background-color:" + color +"; border:1px  solid " + borderColor +"; visibility: hidden;\" onMouseover=\"showMenu(\'"+ divID +"\');\""
		
		if (!isPreview){
		strMenuDiv += " onMouseout=\"hideMenu(\'" + divID + "\');\">" 
		}else{
		strMenuDiv += ">"
		}      
	    
	      if(useCaps){
			  	strMenuDiv += "<div id=\"topcap\" style=\";position:relative; height:" + capHeight +"px; width:" + (imenuWidth -2)  + "; z-index:3; left: 0; background-color:" + capColor + ";\">" + separator + "</div>"
	    }
	    
	    for (x = 0; x < arrMenuItems.length; x++){
	    
          if(arrMenuItems[x][0]!=null){
	        if (!isFirstItem & useDivisions == true){
	      	strMenuDiv += "<div id=\"division\" style=\"position:relative; height:1; width:" + (imenuWidth -2)  + "; z-index:3; left: 0; background-color:" + lineColor + ";\">" + separator + "</div>"
	        }
	      	strMenuDiv += "<div id=\"menuItem" + tdID + "\" style=\"position:relative; background-color:"+ color +"; padding:2px; padding-left:3px; width:" + (imenuWidth -2)  + "; z-index:2; left:0px;\" onMouseover=\"menuOver(\'menuItem" + tdID + "\',\'" + colorActive +"\',\'"+ fontColorActive +"\');\" onMouseout=\"menuOut(\'menuItem" + tdID + "\',\'" + color + "\',\'" + fontColor +"\' );\" class=\"" + style + "\" onClick=\"loadURL('"+ arrMenuItems[x][1] + "')\">" + arrMenuItems[x][0] + "</div>";
	    	tdID = tdID +1
	    	isFirstItem = false;
	    	}
	      	}
		
		 if(useCaps){
			  	strMenuDiv += "<div id=\"topcap\" style=\"position:relative; height:" + capHeight +"px; width:" + (imenuWidth -2)  + "; z-index:3; left: 0; background-color:" + capColor + ";\">" + separator + "</div>"
	    }
		
		strMenuDiv += "</div>"
		
		if (isPreview){
			if(alreadyRendered){
			lastMenu = document.getElementById("testmenu")
			document.body.removeChild(lastMenu);
			}
			var testmenu = document.createElement("DIV");
			testmenu.id = 'testmenu';
			testmenu.innerHTML = strMenuDiv
			document.body.appendChild(testmenu);
			alreadyRendered = true;
		}else{
			document.write(strMenuDiv);
		}
		
		
		if(debugState){  
			alert(strMenuDiv);
        }
        
    }
	
}

/* 
------------------------------------------------------------------------
Function buildMenuLayer()
Purpose: creates a layer for each menu 
Arguments: 4
Arg 0: sMenu - name of the menu to show
------------------------------------------------------------------------
*/ 

function buildMenuLayer(layerID,arrMenuItems,posLeft,posTop,imenuWidth,color,colorActive,fontColor,fontColorActive,borderColor,lineColor,style,useDivisions,useCaps,capHeight,capColor,isPreview){
	
	var nestLayerID=0
	var isFirstItem = true;
			
	strMenuLayer = "<layer id=\""+ layerID +"\" Z-INDEX=1 bgColor=\""+ borderColor + "\" width=" + imenuWidth +" left="+ posLeft +" top="+ posTop +" VISIBILITY=HIDE onMouseOver=\"showMenu(\'"+ layerID +"\');\" onMouseOut=\"hideMenu(\'"+ layerID +"\');\">"
	var nestTop=1
	if(useCaps){
		strMenuLayer += "<layer id=\"division\" bgColor=\""+ lineColor +"\" WIDTH=" + imenuWidth + " HEIGHT=" + capHeight + "Z-INDEX=4 LEFT=1 TOP="+ nestTop +">"+ separator +"</layer>"
		nestTop = nestTop + capHeight
	}
	for (x = 0; x < arrMenuItems.length; x++){
	   if(arrMenuItems[x][0]!=null){
		if (!isFirstItem & useDivisions == true){
			strMenuLayer += "<layer id=\"division\" bgColor=\""+ lineColor +"\" WIDTH=" + imenuWidth + " HEIGHT=1 Z-INDEX=4 LEFT=1 TOP="+ nestTop +">"+ separator +"</layer>"
			nestTop++
		}
		strMenuLayer += "<layer id=\"menuItem"+nestLayerID+"\" Z-INDEX=3 bgColor=\""+ color +"\" HEIGHT=14 WIDTH=" + (imenuWidth -1) +" LEFT=1 TOP="+ nestTop +" onMouseover=\"menuOver('document.layers[\\'"+ layerID +"\\'].document.layers[\\'menuItem"+ nestLayerID +"\\']','" + colorActive +"','" + fontColor +"');\" onMouseOut=\"menuOut('document.layers[\\'"+ layerID +"\\'].document.layers[\\'menuItem"+nestLayerID+"\\']"+ "','" + color +"','" + fontColor +"');\" onClick=\"loadURL('"+arrMenuItems[x][1]+"')\"><a class=" + style + " href=javascript:loadURL('"+arrMenuItems[x][1]+"')>&nbsp;&nbsp;"+arrMenuItems[x][0]
		strMenuLayer +="</a></layer>"		
		nestLayerID++
		nestTop=nestTop+13+1
		isFirstItem = false;
		}
	}
	strMenuLayer += "<layer id=\"division\" bgColor=\""+ lineColor +"\" WIDTH=" + imenuWidth + " HEIGHT=1 Z-INDEX=4 LEFT=1 TOP="+ nestTop +">"+ separator +"</layer>"
	nestTop++
	if(useCaps){
		strMenuLayer += "<layer id=\"division\" bgColor=\""+ lineColor +"\" WIDTH=" + imenuWidth + " HEIGHT=" + capHeight + "Z-INDEX=4 LEFT=1 TOP="+ nestTop +">"+ separator +"</layer>"
		nestTop = nestTop + capHeight
	}
	strMenuLayer +="</layer>"
	document.write(strMenuLayer)
	if(debugState){  
			alert(strMenuLayer);
        }
}

// -->




