
/*----------------------------------------------------
// functions.js
//
//--------------------------------------------------*/

//*---------------------------------------------------
// shows the drop down menu 
// expected arg is active div
//--------------------------------------------------*/
function showDDNav(){
	args = showDDNav.arguments;
	if(br=="N"){
		var args, theObj;
		args = showDDNav.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'){theObj.style.visibility = 'visible'}
		}
	else{return}
}

//*---------------------------------------------------
// hides the drop down menu 
// expected arg is active div 
//--------------------------------------------------*/
function hideDDNav(){
	args = hideDDNav.arguments;
	if(br=="N"){
		var args, theObj;
		args = hideDDNav.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'){theObj.style.visibility = 'hidden'}
		}
	else{return}
}

//*---------------------------------------------------
// hides drop down menu if the menu is visiable and you move off of it
// expected arg is active menu
//--------------------------------------------------*/
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';}
		}
	else{return}
}

//*---------------------------------------------------
// highlight menuitem
// expected arg is active menuitem
//--------------------------------------------------*/
function divOver(){
	args = divOver.arguments;
	if(br=="N"){}
	else if(br=="IE"){
		theObj=eval(args[0]);
		if(theObj.style.backgroundColor=="#e5e6c9"){
			theObj.style.backgroundColor="#666666";
		}
	}
	else{return}
}

//*---------------------------------------------------
// highlight off menuitem
// expected arg is active menuitem
//--------------------------------------------------*/
function divOut(){
	args = divOut.arguments;
	if(br=="N"){}
	else if(br=="IE"){
	theObj=eval(args[0]);
		if(theObj.style.backgroundColor=="#666666"){
			theObj.style.backgroundColor="#e5e6c9";
		}
	}
	else{return}
}

//*---------------------------------------------------
// highlight on menuitem in netscape
// expected arg is active menuitem
//--------------------------------------------------*/
function menuOver(){
	var args, theMenu;
	args = menuOver.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor="#e5e6c9" 
}

//*---------------------------------------------------
// highlight off menuitem in netscape
// expected arg is active menuitem
//--------------------------------------------------*/
function menuOut(){
	var args, theMenu;
	args = menuOut.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor="#D7D5A5" 
}

//*---------------------------------------------------
// goes to specified url
// expected arg is url 
//--------------------------------------------------*/
function gotoUrl(){
	args = gotoUrl.arguments;
	window.top.location.href=args[0]
	
}

//*---------------------------------------------------
// build the divs for IE
// expected args are 'div name','x in menudata aray',
// 'menu left coord','layer Width','top in pixels' 
//--------------------------------------------------*/
var tdID = 0
function MakeDiv(){
	args = MakeDiv.arguments;
	var divID = args[0];
	var x = args[1];
	var divLeft = args[2];
	var layerWidth = args[3];
	var divTop = args[4];
	
	objDiv = "<div id=\"" + divID + "\" style=\"position:absolute; left:"+ divLeft +"px; top:"+ divTop +"px; width:"+ layerWidth +"px; z-index:99; background-color:#000000; visibility:hidden; padding-left:5;\" onMouseover=\"showDDNav('document.all[\\'"+ divID +"\\']')\"  onMouseout=\"hideDiv('document.all[\\'" + divID + "\\']')\">"
	
	for (y = 0; y < 17; y++){
	    if(menuData[x][y][0]!=null){
		objDiv += "<div id=\"x" + tdID + "\" style=\"position:relative; background-color:#D7D5A5; z-index:99; padding:2px 0; width:"+ layerWidth +"px;\" onMouseover=\"divOver('document.all[\\'x" + tdID + "\\']')\" onMouseout=\"divOut('document.all[\\'x" + tdID + "\\']')\"><span onClick=\"gotoUrl('" + menuData[x][y][1] + "')\"><font face=\"Verdana, Arial, Helvetica\" color=\"#666666\" size=\"1\">"+ menuData[x][y][0] +"&nbsp;</font></span></div>"
		objDiv += "<div id=\"line\" style=\"position:relative; z-index:99; background-color:#D7D5A5; width:"+ layerWidth +"px;\"><img src=\"http://www.MysteryNet.com/images/mn/bar.gif\" width="+ layerWidth +" height=1></div>";
        tdID = tdID +1
		}
	}
	objDiv +="</div>"
		
	document.write(objDiv);
}

//*---------------------------------------------------
// build the layers for netscape
// expected args are 'div name','x in menudata aray',
// 'menu left coord','layer width','top in pixels' 
//--------------------------------------------------*/
function MakeLayer(){
	args = MakeLayer.arguments;
	var nestLayerID=0
	var layerID = args[0];
	var x = args[1];
	var layerLeft = args[2];
	var layerWidth = 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=99 BGCOLOR=\"#D7D5A5\" WIDTH="+ layerWidth +" LEFT="+ layerLeft +" TOP="+ layerTop +" VISIBILITY=HIDE onmouseover=\"showDDNav('','document.layers[\\'"+ layerID +"\\']')\" onmouseout=\"hideDDNav('','document.layers[\\'"+ layerID +"\\']')\">"
	
	var nestTop=2
		for (y = 0; y < 17; y++){
		    if(menuData[x][y][0]!=null){
			
	objDiv += "<layer id=\"x"+nestLayerID+"\" CLIP=\"0,0,"+ layerWidth +",20\" Z-INDEX=99 BGCOLOR=\"#D7D5A5\" HEIGHT=21 WIDTH="+ layerWidth +" TOP="+ nestTop +" onmouseover=\"menuOver('document.layers[\\'"+ layerID +"\\'].document.layers[\\'x"+nestLayerID+"\\']')\" onmouseout=\"menuOut('document.layers[\\'"+ layerID +"\\'].document.layers[\\'x"+nestLayerID+"\\']')\"><a href=\""+menuData[x][y][1]+"\" CLASS=\"drop\" TARGET=\"_top\" onMouseOver='window.status=\""+ menuData[x][y][1] + "\"; return true'><font face=\"Verdana, Arial, Helvetica\" color=#666666 size=1>"+ menuData[x][y][0]
	objDiv +="</font></a></layer>"		

	nestLayerID=nestLayerID+1
	nestTop=nestTop+layerInc
	objDiv +="<layer id=\"line2\" BGCOLOR=\"#D7D5A5\" WIDTH="+ layerWidth +" HEIGHT=2 Z-INDEX=99 TOP="+ nestTop +"><center><img src=\"http://www.MysteryNet.com/images/mn/bar.gif\" width="+ layerWidth +" height=1></center></layer>"
	nestTop=nestTop+2
			}
		}
	objDiv +="<layer id=\"lineEnd\" BGCOLOR=\"#D7D5A5\" WIDTH="+ layerWidth +" HEIGHT=8 Z-INDEX=99 TOP="+ nestTop +"></layer></layer>"

	document.write(objDiv)
}

