

// Script for top navigation Drop Downs. - Start

//browser functions.
var br
if(navigator.appName == "Netscape" && navigator.appVersion.charAt(0)=="4"){br="N";}
else if(navigator.appName == "Microsoft Internet Explorer" && document.all != null){br="IE";}
else if(navigator.appName == "Netscape" && document.getElementById != null && navigator.appVersion.charAt(0)=="5"){br="N6";}
else if(navigator.appName == "Netscape" && document.getElementById != null && navigator.appVersion.charAt(0)=="6"){br="N6";}
else{br=null}

// define menu attributes here

menuColor="#000000"
menuColorOn="FF7F00"     
fontColorOn="#FFFFFF"
fontColorOff="FFFFFF"    
lineColor = "#000000"

separator="<img src=/media/spacer.gif height=1 width=1>"
// 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'){
				// activate hideElement to hide <select> boxes
				//hideElement('SELECT');
				theObj.style.visibility = 'visible'
			}
		}
	}
	else if(br=="N6"){
		var args, theObj;
		args = showDDNav.arguments;
		theObj = eval(args[2]);
		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'){showElement('SELECT');theObj.style.visibility = 'hidden'}
	}
	else if(br=="N6"){
		var args, theObj;
		args = hideDDNav.arguments;
		theObj=eval(args[2]);
		if(theObj) if(theObj.style.visibility=='visible'){theObj.style.visibility = 'hidden';}
	}
	else{return}
}

// hides drop down menu when menu is active 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';
			 // activate showElement to show <select> menu's
			 //showElement('SELECT');
			}
		}
	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]);
		theObj.style.backgroundColor=menuColorOn;
	}
	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]);
		theObj.style.backgroundColor=menuColor;
	}
	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=menuColorOn
}

// highlight off menuitem in netscape expected arg is active menuitem

function menuOut(){
	var args, theMenu;
	args = menuOut.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor=menuColor
}

// goes to specified url expected arg is url

function gotoUrl(){
	args = gotoUrl.arguments;
	location.href = (args[0]);
}

// hides specified tag

function hideElement(HTMLtag)
{
	for (i = 0; i < document.all.tags(HTMLtag).length; i++)
	{
		obj = document.all.tags(HTMLtag)[i];
		obj.style.visibility = "hidden";
	}
}

// shows specified tag

function showElement(HTMLtag)
{
	for (i = 1; i < document.all.tags(HTMLtag).length; i++)
	{
		obj = document.all.tags(HTMLtag)[i];
		obj.style.visibility = "visible";
	}
}

// build the divs for IE expected args are 'div name','x in menudata aray','menu left coord','top in pixels'

var tdID = 0
function doDiv(){
	args = doDiv.arguments;
	var divID = args[0];
	var x = args[1];
	var divLeft = args[2];
	var divTop = args[3];
	var divWidth = args[4];

	objDiv = "<div id=\"" + divID + "\" style=\"position:absolute; width:" + divWidth + "px; z-index:2; top:"+ divTop +"px; margin-left: " + divLeft + "px; background-color: #000000; border:1 solid #FF9900; visibility: hidden;\" onMouseover=\"showDDNav('document.all[\\'"+ divID +"\\']')\"  onMouseout=\"hideDiv('document.all[\\'" + divID + "\\']')\">"
	
	for (y = 0; y < 17; y++){
	    if(menuData[x][y][0]!=null){

		   if(menuData[x][y][0]=="bar"){

		   objDiv += "<div id=\"spacer\" style=\"position:relative; height:3px; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; font-size:1;\"></div>"
		   objDiv += "<div id=\"bar\" style=\"position:relative; height:1; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; background-color:#CCCCCC;\">" + separator + "</div>"
	           objDiv += "<div id=\"spacer\" style=\"position:relative; height:3px; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; font-size:1;\"></div>"

		   } else {
		   objDiv += "<div id=\"x" + tdID + "\" style=\"position:relative; background-color:"+ menuColor +"; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5;\" onMouseover=\"divOver('document.all[\\'x" + tdID + "\\']')\" onMouseout=\"divOut('document.all[\\'x" + tdID + "\\']')\" class=\"noline\" >&nbsp;<a href=\""+ menuData[x][y][1]+ "\">"+ menuData[x][y][0] +"</a>"+"&nbsp;</div>"
		   }

		tdID = tdID +1
	   }
	}
	objDiv += "</div>"
	document.write("<strong>" + objDiv + "</strong>")
}

// build the layers for netscape expected args are 'div name','x in menudata aray','menu left coord','top in pixels'

function doLayer(){
	args = doLayer.arguments;
	var nestLayerID=0
	var layerID = args[0];
	var x = args[1];
	var layerLeft = args[2];
	var layerTop = args[3];
	var layerWidth = args[4];

	if(navigator.platform.indexOf("Win") < 0){layerInc=16;layerStyle="netMenuMac";}
	else{layerInc=15;layerStyle="netMenu";}

	objDiv = "<layer id=\""+ layerID +"\" Z-INDEX=1 BGCOLOR=\""+ menuColor +"\" WIDTH=" + layerWidth + " LEFT="+ layerLeft +" TOP="+ layerTop +" VISIBILITY=HIDE onmouseover=\"showDDNav('','document.layers[\\'"+ layerID +"\\']')\" onmouseout=\"hideDDNav('','document.layers[\\'"+ layerID +"\\']')\">"

	var nestTop=10
		for (y = 0; y < 17; y++){

		    if(menuData[x][y][0]!=null){

				if(menuData[x][y][0]=="bar"){

			    objDiv += "<layer id=\"spacer\" BGCOLOR=\""+ menuColor +"\" WIDTH=" + eval(layerWidth - 10) + " HEIGHT=5 Z-INDEX=8 LEFT=5 TOP="+ nestTop +">"+ separator +"</layer>"
				nestLayerID=nestLayerID+1
				nestTop=nestTop+5

				objDiv += "<layer id=\"line2\" BGCOLOR=#CCCCCC WIDTH=" + eval(layerWidth - 10) + " HEIGHT=1 Z-INDEX=11 LEFT=5 TOP="+ nestTop +">"+ separator +"</layer>"
				nestLayerID=nestLayerID+1
				nestTop=nestTop+1

				objDiv += "<layer id=\"spacer2\" BGCOLOR=\""+ menuColor +"\" WIDTH=" + eval(layerWidth - 10) + " HEIGHT=5 Z-INDEX=8 LEFT=5 TOP="+ nestTop +">"+ separator +"</layer>"
				nestLayerID=nestLayerID+1
				nestTop=nestTop+5

				} else {

				objDiv += "<layer id=\"x"+nestLayerID+"\" class=\""+ layerStyle +"\" Z-INDEX=7 BGCOLOR=\""+ menuColor +"\" HEIGHT=19 WIDTH=" + eval(layerWidth - 10) + " LEFT=5 TOP="+ nestTop +" onmouseover=\"menuOver('document.layers[\\'"+ layerID +"\\'].document.layers[\\'x"+nestLayerID+"\\']')\" onmouseout=\"menuOut('document.layers[\\'"+ layerID +"\\'].document.layers[\\'x"+nestLayerID+"\\']')\" class=\"noline\"><a   href=javascript:gotoUrl('"+menuData[x][y][1]+"')><font color=" + fontColorOff + ">"+ menuData[x][y][0]
				objDiv +="</font></a></layer>"
				nestLayerID=nestLayerID+1
				nestTop=nestTop+layerInc+1

				}

			}
		}
		objDiv +="<layer id=\"lineEnd\" BGCOLOR=\""+ menuColor +"\" WIDTH=" + layerWidth + " HEIGHT=8 Z-INDEX=7 TOP="+ nestTop +"></layer></layer>"

	document.write("<strong>"+objDiv+"</strong>")
}

var tdID1 = 0
function doLayer1(){
	args = doLayer1.arguments;
	var divID = args[0];
	var x = args[1];
	var divLeft = args[2];
	var divTop = args[3];
	var divWidth = args[4];

	objDiv = "<div id=\"" + divID + "\" style=\"position:absolute; width:" + divWidth + "px; z-index:2; top:"+ divTop +"px; margin-left: " + divLeft + "px; background-color: #FFFFFF; border:1 solid #FF9900; visibility: hidden;\" onMouseover=\"showDDNav('','','document.getElementById(\\'"+ divID +"\\')')\"  onMouseout=\"hideDDNav('','','document.getElementById(\\'" + divID + "\\')')\">"

	for (y = 0; y < 17; y++){
	    if(menuData[x][y][0]!=null){
		   if(menuData[x][y][0]=="bar"){
		   objDiv += "<div id=\"spacer\" style=\"position:relative; height:3px; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; font-size:1;\"></div>"
		   objDiv += "<div id=\"bar\" style=\"position:relative; height:1; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; background-color:#FFFFFF;\">" + separator + "</div>"
	           objDiv += "<div id=\"spacer\" style=\"position:relative; height:3px; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; font-size:1;\"></div>"
		   } else {
		   objDiv += "<div id=\"x" + tdID1 + "\" style=\"position:relative; background-color:"+ menuColor +"; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5;\"   class=\"noline\" >&nbsp;<a href=\""+ menuData[x][y][1]+ "\">"+ menuData[x][y][0] +"</a>"+"&nbsp;</div>"
		   }
		tdID1 = tdID1 +1
	   }
	}
	objDiv += "</div>"
	document.write("<strong>" + objDiv + "</strong>")
}

// Netscape Resize Function for Layers

function reDo(){window.location.reload()}
function setResize(){setTimeout("window.onresize=reDo",500);}
	if(br=="N"){
	window.onload = setResize;
}

menuData = new Array()
for (i=0; i < 10; i++) {
	menuData[i] = new Array(40)
	for (j=0; j < 20; j++) {
		menuData[i][j] = new Array(2)}}
menuData[0][0][0]="maplest";
menuData[0][0][1]="http://www.maplest.narod.ru";
menuData[0][1][0]="relieve        ";
menuData[0][1][1]="http://www.relieve.narod.ru";
menuData[0][2][0]="powertool           ";
menuData[0][2][1]="http://www.powertool.narod.ru";
menuData[0][3][0]="mapler             ";
menuData[0][3][1]="http://www.mapler.narod.ru";
menuData[0][4][0]="newmapler              ";
menuData[0][4][1]="http://www.newmapler.narod.ru";

menuData[1][0][0]="mathler";
menuData[1][0][1]="http://www.mathler.narod.ru";
menuData[1][1][0]="start          ";
menuData[1][1][1]="http://www.wolfstart.narod.ru";
menuData[1][2][0]="news          ";
menuData[1][2][1]="http://www.wolfnews.narod.ru";
menuData[1][3][0]="wolfram.com         ";
menuData[1][3][1]="http://www.wolfram.com";
menuData[1][4][0]="mathworld      ";
menuData[1][4][1]="http://www.mathworld.wolfram.com";
menuData[1][5][0]="superbook";
menuData[1][5][1]="http://www.mathler.narod.ru/superbook.htm";
menuData[1][6][0]="functions";
menuData[1][6][1]="http://www.functions.wolfram.com";
menuData[1][7][0]="webMathematica";
menuData[1][7][1]="http://www.mathler.narod.ru/webmath.htm";
menuData[1][8][0]="a new kind";
menuData[1][8][1]="http://www.mathler.narod.ru/kind.htm";
menuData[1][9][0]="books";
menuData[1][9][1]="http://www.mathler.narod.ru/books.htm";
menuData[1][10][0]="notebooks";
menuData[1][10][1]="http://www.mathler.narod.ru/notebooks.htm";
menuData[1][11][0]="Stephen Wolfram";
menuData[1][11][1]="http://www.mathler.narod.ru/sw.htm";

menuData[2][0][0]="labler    ";
menuData[2][0][1]="http://www.labler.narod.ru";
menuData[2][1][0]="mathworks.com";
menuData[2][1][1]="http://www.mathworks.com";
menuData[2][2][0]="news      ";
menuData[2][2][1]="http://www.mathworks.com/company/events";
menuData[2][3][0]="service    ";
menuData[2][3][1]="http://www.mathworks.com/support/";

menuData[3][0][0]="start";
menuData[3][0][1]="http://www.mathcadler.narod.ru";
menuData[3][1][0]="MathSoft             ";
menuData[3][1][1]="http://www.mathsoft.com";
menuData[3][2][0]="education         ";
menuData[3][2][1]="http://www.mathsoft.com/education/";
menuData[3][3][0]="MathCad        ";
menuData[3][3][1]="http://www.mathsoft.com/mathcad/";
menuData[3][4][0]="StudyWorks!          ";
menuData[3][4][1]="http://www.mathsoft.com/studyworks/";

menuData[4][0][0]="MathType";
menuData[4][0][1]="http://www.dessci.com/free.asp?free=mapler";

if(br=="N"){
	doLayer('companymenu',0,262,53,125)   
	doLayer('productmenu',1,361,53,120)
	doLayer('supportmenu',2,459,53,120)
	doLayer('storemenu',3,557,53,100)
}
else if(br=="IE"){
	doDiv('companymenu',0,262,54,125) 
	doDiv('productmenu',1,360,54,120) 
	doDiv('supportmenu',2,459,54,120)
	doDiv('storemenu',3,557,54,100)
}
else if(br=="N6"){
	doLayer1('companymenu',0,262,54,125)
	doLayer1('productmenu',1,361,54,120)
	doLayer1('supportmenu',2,459,54,120)
	doLayer1('storemenu',3,557,54,100)
}
else{}

// Script for top navigation Drop Downs. - End

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		navbarCom_over = newImage("/imgs/top-nav-companyon.gif");
		navbarPro_over = newImage("/imgs/top-nav-productson.gif");
		navbarSup_over = newImage("/imgs/top-nav-supporton.gif");
		navbarInt_over = newImage("/imgs/top-nav-storeon.gif");
		navbarSea_over = newImage("/imgs/top-nav-searchon.gif");
		preloadFlag = true;
	}
}





