//Menu Code Copyright 2005 by Harold Blackorby/HUGHES
//May not be reused without written permission
function showlinks(x)
{
//first reset all boxes to visible
for (i = 1; i < 7; i++)
{
    if (document.getElementById('box' + i))
    {
    resetbox = document.getElementById('box' + i)
    resetbox.style.display = "block"
    }
}
//set the selected box to hidden
var selitem = document.getElementById('box' + x)
selitem.style.display = "none"
}
function search()
{
var x = document.getElementById('Header1$TextBox1').value
x = x.replace(" ", "%20");
//alert(x)
location.href = 'http://db1.spiderline.com/exec/search?a=100785&q=' + x
}
function searchhome()
{
var x = document.getElementById('homesearch').value
x = x.replace(" ", "%20");
//alert(x)
location.href = 'http://db1.spiderline.com/exec/search?a=100785&q=' + x
}
function Is() {
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ns = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
  this.ns4up = (this.ns && (this.major >= 4));
  this.ns4 = (this.ns && (this.major == 4));
  this.ns6up = (this.ns && (this.major >= 5));
  this.ns7up = (this.ns && (this.major >= 7));
  this.ie = (agent.indexOf("msie") != -1);
  this.ie4up = (this.ie && (this.major >= 4));
  this.win = (agent.indexOf("win")!=-1);
  this.mac = (agent.indexOf("mac")!=-1);
  this.ff = (agent.indexOf("firefox") != -1);
}
var is = new Is();
var screen_width;
var screen_height;
var available_width;
var available_height;
var doc;
var sty;
var htm;
var xdiff;
var ydiff;
var allready;
var prevMenu = "";
var prevSubMenu = "";
var numMenus = -1;
var numSubs = 0;
var aryMenu = new Array();
var arySub = new Array();
var lastTimeout = "";
var rollColor = "#0b679f"; // when the box is being rolled over
var baseColor = "#123068"; // after the box has been rolled over
var rollSubColor = "#ff0000";
var baseSubColor = "#808080";

// added by Rudi to resolve issues with Netscape 4 in Mac
var NaN;
var undefined;


function roll(obj) {
	hideMenu();
//	document[obj].src = "graphics/menu/" + obj + "_d.gif";
}
function rollBack(obj) {
//	if (pageSection != obj)
//	{	
//		document[obj].src = "graphics/menu/" + obj + "_l.gif";
//	}
	
}
function showMenu(menu,x,y)
{
	//hideMenu();
	if (allready)
	{
		if (lastTimeout != "")
		{
			clearTimeout(lastTimeout);
			lastTimeout = "";
		}
		lastTimeout = setTimeout("hideMenu();",8000);
		
			available_width=document.body.clientWidth;
		
		available_width = available_width - 760;
		xoffset = parseInt(available_width / 2,10);
		
		if (menu.indexOf("sub") == -1)
		{
			menuID = menu.substring(4,menu.length);
			x = aryMenu[menuID - 1][2];
			y = aryMenu[menuID - 1][3];
		}
		else
		{
			menuID = menu.substring(3,menu.length);
			x = arySub[menuID][3];
			y = arySub[menuID][4];
			if(is.ns4) {
				y = y-4;
			}
		}
		
		if (x == "" || x == null)
			x = 0;
		
		if (y == "" || y == null)
			y = 0;

		if (is.ie4up || is.ns4up)
		{
			myLyr = eval(doc + menu + sty);
			if (myLyr)
			{
				myLyr.top = y + ydiff + "px";
				myLyr.left = x + xdiff + xoffset + "px";
				myLyr.visibility = "visible";
			}
		}
	}
	prevMenu = menu;
}

function hideSubs()
{
    if (allready) {
	if (is.ie4up || is.ns4up) {
		j = 1
		while (j <= numSubs)
		{
			myLyr = eval(doc + arySub[j][1] + sty);
			myLyr.visibility = "hidden";
			j++;
		}
	}
	}
	return true;
}

function hideMenu()
{
		if (allready) {
			j = 0
			while (j <= numMenus)
			{
				myLyr = eval(doc + aryMenu[j][1] + sty);
				myLyr.visibility = "hidden";
				j++;
			}
			hideSubs();
		}
		return true;
}

function hideMenuOne(menu)
{
	if (menu != "" && allready) {
		myLyr = eval(doc + menu + sty);
		myLyr.visibility = "hidden";
	}
	return true;
}

function changeColor(menu,color)
{
	if (allready) {
		menu = menu.id;	
		myLyr = eval(doc + menu + sty);
		myLyr.background = eval(color);
		//alert(myLyr.background)
	}
}

function changeAColor(menu,color)
{
	if (allready) {
		myLyr = eval(doc + menu + sty);
		myLyr.background = eval(color);
	}
}

function writeMenus()
{
	j = 0;
	while (j <= numMenus)
	{
		document.write("<div name='" + aryMenu[j][1] + "' id='" + aryMenu[j][1] + "' class='menu' ");
		document.write("onMouseOver='showMenu(\"" + aryMenu[j][1] + "\");' ");
		document.write("onMouseOut='hideMenuOne(\"" + aryMenu[j][1] + "\");'>");
		document.write("<TABLE border='0' CELLPADDING='0' CELLSPACING='0' WIDTH='160' class='mainmenu'>");
		
		k = 4;
		
		while (k <= (aryMenu[j].length-1))
		{
			document.write("<TR>");
			document.write("<TD class='bbsubmenu" + j + "' id='" + aryMenu[j][1] + "sub" + k + "' name='" + aryMenu[j][1] + "sub" + k + "' ");
			document.write("><A class='menuLinks'");
			strhref = new String(aryMenu[j][k+2]);
			splithref = strhref.split(":new:");
			aryMenu[j][k+2] = splithref[0];			
			if (strhref.indexOf(":new:") > 0)
			{			   
				document.write(" HREF='" + aryMenu[j][k+2] + "' target='_blank'");
			}
			else
			{			   
				document.write(" HREF='" + aryMenu[j][k+2] + "'");
			}
			
			SubMenuID = parseInt(aryMenu[j][k+1],10);
			if ((SubMenuID > 0) && (SubMenuID != NaN))
			{
				document.write(" onmouseover='hideSubs();");
				document.write(" showMenu(\"" + arySub[SubMenuID][1] + "\",");
				document.write(arySub[SubMenuID][2] + "," + arySub[SubMenuID][3] + ")'");
			}
			else
				document.write(" onmouseover='hideSubs();'");
			document.write(">" + aryMenu[j][k] + "</A></TD></TR>");
			k = k + 3;
		}
		document.write("</TABLE>");
		document.write("</div>");
		j++
	}

	j = 1;
	while (j <= numSubs)
	{
		document.write("<div name='" + arySub[j][1] + "' id='" + arySub[j][1] + "' class='menu'");
		document.write(" onMouseOver='showMenu(\"" + arySub[j][1] + "\"); showMenu(\"menu" + arySub[j][0] + "\");'");
		document.write(" onMouseOut='hideMenu();hideSubs();'>");
		document.write("<TABLE CELLPADDING='0' CELLSPACING='0' BORDER='0' WIDTH='140' class='submenu'>");
		k = 5;
		while (k <= (arySub[j].length-1))
		{
			document.write("<TR>");
			document.write("<TD class='blue' id='" + arySub[j][1] + "sub" + k + "' name='" + arySub[j][1] + "sub" + k + "' ");
			document.write("onMouseOver='changeColor(this,\"rollSubColor\");' onMouseOut='changeColor(this,\"baseSubColor\");'><A class='textWhite'");
			
			strsubhref = new String(arySub[j][k+1]);
			splitsubhref = strsubhref.split(":new:");
			arySub[j][k+1] = splitsubhref[0];
			if (strsubhref.indexOf(":new:") > 0)
			{
				document.write(" HREF='" + arySub[j][k+1] + "' target='_blank'");
			}
			else
			{
				document.write(" HREF='" + arySub[j][k+1] + "'");
			}
			
		//	document.write(" HREF='" + arySub[j][k+1] + "'");
			document.write(">" + arySub[j][k] + "</A></TD></TR>");
			k = k + 2;
		}
		document.write("</TABLE>");
		document.write("</div>");
		j++
	}
}

function makeMenu()
{
	numMenus += 1;
	numItems = arguments.length;
	aryMenu[numMenus] = new Array(numItems-1);
	aryMenu[numMenus][0] = arguments[0]
	aryMenu[numMenus][1] = "menu" + arguments[0]
	j = 2;
	while (j <= arguments.length)
	{		
		aryMenu[numMenus][j] = arguments[j-1];
		j++;
	}
}

function makeSub()
{
	numSubs += 1;
	numItems = arguments.length;
	arySub[numSubs] = new Array(numItems-1);
	arySub[numSubs][0] = arguments[1] //the parent menu ID
	arySub[numSubs][1] = "sub" + arguments[0]
	j = 3;
	while (j <= arguments.length)
	{		
		arySub[numSubs][j] = arguments[j-1];
		j++;
	}
}

function startup()
{
	//Basically determines what Document Object Model to use.
	//Note there is one for Netscape 6 >, and IE 4 >.
	//You can also specify a xdifferency and a ydifference to
	//add to the x and y coordinates (to compensate for browser differences)
	screen_width = screen.width;
	screen_height = screen.height;
	
		available_width=document.body.clientWidth;
		available_height=document.body.clientHeight;
	
	
	doc = 'document.getElementById("';
	sty = '").style';
	htm = "";
	xdiff = 0;
	ydiff = 0;
	allready = true;
}
