//*---------------------------------------------------
// GO BACK
//--------------------------------------------------*/

function goback() {
   history.back(1)
}
// -->

//*---------------------------------------------------
// DEMO WINDOW FUNCTION
//--------------------------------------------------*/

function openWin() {
   thepage = eval(args[1]);
   window.open(thepage,"demoWin","width=640,height=480,toolbar=no,location=no,copyhistory=no,resizable=no,alwaysRaised=yes"); 
}

//*---------------------------------------------------
// IMAGE ROLLOVER FUNCTION
//--------------------------------------------------*/


function changeImages() {
   if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src =  eval(changeImages.arguments[i+1] + ".src");
 	 }
  }
}

//*---------------------------------------------------
// MENU FUNCTIONS
//--------------------------------------------------*/


//*---------------------------------------------------
// Shows the div or layer passed in.
//--------------------------------------------------*/
function showMenu(){
	args = showMenu.arguments;
	if(br=="N"){
		var args, theObj;
		args = showMenu.arguments;
		theObj = eval(args[1]);
  		if (theObj) if(theObj.visibility=='hide'){theObj.visibility = 'show';}
	}
	else if(br=="IE"){
		theObj=eval(args[0]);
		if (theObj) if(theObj.style.visibility=='hidden'){hideElement('select');theObj.style.visibility = 'visible'}
		}
	else{return}
}

//*---------------------------------------------------
// Hides the div or layer passed in.
//--------------------------------------------------*/
function hideMenu(){
	args = hideMenu.arguments;
	if(br=="N"){
		var args, theObj;
		args = hideMenu.arguments;
		theObj = eval(args[1]);
		if (theObj) if(theObj.visibility=='show'){theObj.visibility = 'hide';}
	}
	else if(br=="IE"){
		theObj=eval(args[0]);
		if (theObj) if(theObj.style.visibility=='visible'){showElement('select');theObj.style.visibility = 'hidden'}
		}
	else{return}
}

//*---------------------------------------------------
// Hides active drop down menu that is passed in.
//--------------------------------------------------*/
function hideDiv(){
	args = hideDiv.arguments;
	if(br=="N"){}
	else if(br=="IE"){
		theObj=eval(args[0]);
		// calculate active size of menu
		leftDiv=theObj.offsetLeft +2
		rightDiv=theObj.offsetLeft + theObj.clientWidth -2
		topDiv=theObj.offsetTop +2
		bottomDiv=theObj.offsetTop + theObj.clientHeight -2
		if(window.event.clientY > bottomDiv || 
			window.event.clientY < topDiv || 
			window.event.clientX < leftDiv || 
			window.event.clientX > rightDiv)
			{theObj.style.visibility = 'hidden';showElement('select');}				
		}
	else{return}
}

//*---------------------------------------------------
// IE: Change background color of passed in menu item
// to highlight.
//--------------------------------------------------*/
function divOn(){
	args = divOn.arguments;
	if(br=="N"){}
	else if(br=="IE"){
		theObj=eval(args[0]);
		if(theObj.style.backgroundColor=="#333366"){
			theObj.style.backgroundColor="#3366cc";
		}
	}
	else{return}
}

//*---------------------------------------------------
// IE: Change background color of passed in menu item
// to turn highlight off.
//--------------------------------------------------*/
function divOff(){
	args = divOff.arguments;
	if(br=="N"){}
	else if(br=="IE"){
	theObj=eval(args[0]);
		if(theObj.style.backgroundColor=="#3366cc"){
			theObj.style.backgroundColor="#333366";
		}
	}
	else{return}
}

//*---------------------------------------------------
// NETSCAPE: Change background color of passed in menu item
// to highlight.
//--------------------------------------------------*/
function menuOn(){
	var args, theMenu;
	args = menuOn.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor="#3366cc" 
}

//*---------------------------------------------------
// NETSCAPE: Change background color of passed in menu 
// item to turn highlight off.
//--------------------------------------------------*/
function menuOff(){
	var args, theMenu;
	args = menuOff.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor="#003399" 
}

//*---------------------------------------------------
// Go to URL passed in.
//--------------------------------------------------*/
function gotoUrl(){
	args = gotoUrl.arguments;
	location.href=args[0]
}

//*---------------------------------------------------
// Hide the specified HTML element.
//--------------------------------------------------*/
function hideElement(HTMLtag)
{
	for (i = 0; i < document.all.tags(HTMLtag).length; i++)
	{
		obj = document.all.tags(HTMLtag)[i];
		obj.style.visibility = "hidden";
	}
}

//*---------------------------------------------------
// Show the specified HTML element.
//--------------------------------------------------*/
function showElement(HTMLtag)
{
	for (i = 0; i < document.all.tags(HTMLtag).length; i++)
	{
		obj = document.all.tags(HTMLtag)[i];
		obj.style.visibility = "visible";
	}
}

//*---------------------------------------------------
// IE: Build the divs for menu. Pass in
// 'menu name','x in menudata aray',
// 'menu left coord','arrow alignment','top in pixels' 
//--------------------------------------------------*/
var tdID = 0
function doDiv(){
	args = doDiv.arguments;
	var divID = args[0];
	var x = args[1];
	var divLeft = args[2];
	var arrowPos = args[3];
	var divTop = args[4];
	
	objDiv = "<div id=\"" + divID + "\" style=\"position:absolute; left:"+ divLeft +"px; top:"+ divTop +"px; width:180px; z-index:3; background-color:#000000; visibility:hidden; padding-left:5;\" onMouseover=\"showMenu('document.all[\\'"+ divID +"\\']')\"  onMouseout=\"hideDiv('document.all[\\'" + divID + "\\']')\">"
	
	
	for (y = 0; y < 16; y++){
	    if(menuData[x][y][0]!=null){
		objDiv += "<div id=\"line\" style=\"position:relative; background-color:#000000; width:170px;\"><img src=/images/bar.gif width=170 height=2></div>";
		objDiv += "<div id=\"x" + tdID + "\" style=\"position:relative; background-color:#333366; width:170px;\" onMouseover=\"divOn('document.all[\\'x" + tdID + "\\']')\" onMouseout=\"divOff('document.all[\\'x" + tdID + "\\']')\"><span class=\"nav\" onClick=\"gotoUrl('"+menuData[x][y][1]+"')\">"+ menuData[x][y][0] +"&nbsp;</span></div>"
		tdID = tdID +1
		}
	}
	
	objDiv +="<div id=\"line\" style=\"position:relative; background-color:#000000; width:170px; height:6px;\"><img src=/images/bar.gif width=170 height=1></div></div>"
	
	document.write(objDiv);
}

//*---------------------------------------------------
// NETSCAPE: Build layers for menu. Pass in
// 'menu name','x in menudata aray',
// 'menu left coord','arrow alignment','top in pixels' 
//--------------------------------------------------*/
function doLayer(){
	args = doLayer.arguments;
	var nestLayerID=0
	var layerID = args[0];
	var x = args[1];
	var layerLeft = args[2];
	var arrowPos = args[3];
	var layerTop = args[4];

	if(navigator.platform.indexOf("Win") < 0){layerInc=16;layerStyle="netMenuMac";}
	else{layerInc=19;layerStyle="netMenu";}	
		
	objDiv = "<layer id=\""+ layerID +"\" Z-INDEX=1 BGCOLOR=\"#000000\" WIDTH=180 LEFT="+ layerLeft +" TOP="+ layerTop +" VISIBILITY=HIDE onmouseover=\"showMenu('','document.layers[\\'"+ layerID +"\\']')\" onmouseout=\"hideMenu('','document.layers[\\'"+ layerID +"\\']')\">"
	objDiv +="<layer id=\"arrow\" BGCOLOR=\"#000000\" WIDTH=180 HEIGHT=10 Z-INDEX=5 TOP=0><img src=/images/arrow.gif width=19 height=6 hspace=3 align="+ arrowPos +"></layer>"
	objDiv +="<layer id=\"line\" BGCOLOR=\"#000000\" WIDTH=180 HEIGHT=2 Z-INDEX=7 TOP=19><center><img src=/images/bar.gif width=170 height=2></center></layer>"
	
	var nestTop=21
		for (y = 0; y < 16; y++){
		    if(menuData[x][y][0]!=null){
			
	objDiv += "<layer id=\"x"+nestLayerID+"\" CLIP=\"5,0,225,20\" class=\""+ layerStyle +"\" Z-INDEX=7 BGCOLOR=\"#000000\" HEIGHT=21 WIDTH=180 TOP="+ nestTop +" onmouseover=\"menuOn('document.layers[\\'"+ layerID +"\\'].document.layers[\\'x"+nestLayerID+"\\']')\" onmouseout=\"menuOff('document.layers[\\'"+ layerID +"\\'].document.layers[\\'x"+nestLayerID+"\\']')\"><a id=navstyle  href=javascript:gotoUrl('"+menuData[x][y][1]+"')><font color=#FFFFFF>"+ menuData[x][y][0]
	objDiv +="</font></a></layer>"		

	nestLayerID=nestLayerID+1
	nestTop=nestTop+layerInc
	objDiv +="<layer id=\"line2\" BGCOLOR=\"#000000\" WIDTH=180 HEIGHT=2 Z-INDEX=7 TOP="+ nestTop +"><center><img src=/images/bar.gif width=170 height=2></center></layer>"
	nestTop=nestTop+2
			}
		}
	objDiv +="<layer id=\"lineEnd\" BGCOLOR=\"#000000\" WIDTH=180 HEIGHT=8 Z-INDEX=7 TOP="+ nestTop +"></layer></layer>"

	document.write(objDiv)
}