var onlayer="none";
var activelayer="none";
var lastlayer="none";
var d = "document.images";
var ie = 0;
var op = 0;
var ns6 = 0;
var samecolor = 0;
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf('gecko')!=-1){ns6=1;}
if (document.all) {
	if (agt.indexOf('opera')==-1){
		ie=1;
	}
	else{
		op=1;
	}
}

function getObj(objId)
{
  if (document.layers) { //Netscape 4
     return eval('document.' + objId);
  }
  else if (navigator.userAgent.indexOf("Opera") != -1) { //Opera
     return eval('document.all.' + objId);
  }
  else if (document.all && !document.getElementById) { //IE 4
     return eval('document.all.' + objId);
  }
  else if (document.getElementById) { //Netscape 6 & IE 5
     return document.getElementById(objId);
  }
}

function fadein(what) {
	if(getObj(what).filters.blendTrans){
    	if (getObj(what).filters.blendTrans.status==0) {
        	getObj(what).filters.blendTrans.Apply();
        	getObj(what).style.visibility = "visible";
        	getObj(what).filters.blendTrans.Play();
    	}
	} else {
	getObj(what).style.visibility = "visible";}
}

function show(what,link){
if (!getObj('ref').offsetLeft) {
//UNDONE: this conditional doesn't seem to help, instead the div placement gets out-of-whack
//	if ((document.body.offsetWidth / 2) - (375 - MenuLeft) > MenuLeft) {
//		getObj(what).style.left = (document.body.offsetWidth / 2) - (375 - MenuLeft);
//	} else {
//		getObj(what).style.left = MenuLeft;
//	}

	getObj(what).style.left = MenuLeft;
}
else {
	getObj(what).style.left = getObj('ref').offsetLeft + MenuLeft;
}

if(lastlayer != "none"){
eval(d + "." +lastlayer+ "Img.src='/images/mnu-" + lastlayer + ".gif'")
getObj(lastlayer).style.visibility="hidden";}
if(ie){fadein(what);}
else{getObj(what).style.visibility="visible";}
eval(d + "." +what+ "Img.src='/images/mnu-" + what + "-over.gif'");
activelayer=what;
}

function hide(what){
lastlayer=activelayer;
activelayer="none";
window.setTimeout("hidenow('" +what+ "')", 500);
}

function on(what){
onlayer = what;
}

function off(what){
onlayer="none";
window.setTimeout("hidenow('" +what+ "')", 250);
}

function hidenow(what){
if(onlayer != what && activelayer != what){
eval(d + "." +what+ "Img.src='/images/mnu-" + what + ".gif'")
getObj(what).style.visibility="hidden";
}
}

function BuildLinks(what) {
var temp = what + "Content";
var theov = "";
var theout = "";

if (MenuOvColor != ""){
theov = theov + "this.style.backgroundColor=aaa" + MenuOvColor + "aaa;"
theout = theout + "this.style.backgroundColor=aaa" + MenuColor + "aaa;"
}

if (op==1){
/*
document.write("<div id='tester' class='ovmenutext' visibility='hidden' height='0' width='0'></div>");
document.write("<div id='tester2' class='menutext' visibility='hidden' height='0' width='0'></div>");
if (tester.style.color == tester2.style.color){
samecolor = 1;
}else{
theov = theov + "this.style.color=tester.style.color;"
theout = theout + "this.style.color=tester2.style.color;"}
*/
}else{
	theov = theov + "this.className=aaaovmenutextaaa;"
	theout = theout + "this.className=aaamenutextaaa;"
}

if (ns6==1)
theov = theov + "this.style.cursor=aaapointeraaa;"
else
theov = theov + "this.style.cursor=aaahandaaa;"

eval("var " + temp + "= '<table width=150 cellspacing=4 cellpadding=0 border=0>'");

for(var y = 0; y < eval(what + "arr.length"); y++){

eval(temp + "=" + temp + "+ '<tr><td height='+ MenuHeight +' bgcolor=' + MenuColor + ' valign=center width=100%'")

if (theov != ""){
eval(temp + "=" + temp + "+ ' onmouseover=bbb' + theov + 'bbb'")
eval(temp + "=" + temp + "+ ' onmouseout=bbb' + theout + 'bbb'")
}

tempcode = eval(what + "Linksarr[y].toLowerCase()");
if (tempcode.indexOf("javascript:")!=-1){
tempcode = tempcode.replace("javascript:","");
eval(temp + "=" + temp + "+ ' onclick=bbb'+ tempcode +';bbb'")
} else {
eval(temp + "=" + temp + "+ ' onclick=bbbdocument.location=aaa' + " + what + "Linksarr[y] + 'aaa;bbb'")
}

if (MenuOvColor=="" && samecolor==1){
var tdcontent = "<a class=aaamenutextaaa href=aaa" + eval(what + "Linksarr[y]") + "aaa>" + eval(what + "arr[y]") + "</a>";}
else{
var tdcontent = eval(what + "arr[y]");}

eval(temp + "=" + temp + "+ 'class=menutext><img src=/images/spacer.gif width=4 height=1>' + tdcontent  + '</td></tr>'")
}
eval(temp + "=" + temp + "+ '</table>'")
atemp = eval(temp)

atemp = atemp.replace(/aaa/g, "'")
atemp = atemp.replace(/bbb/g, '"')
return atemp;
}

function BuildLayers(){
for(var x = 0; x < menuarr.length; x++){
document.write('<div id="' + menuarr[x] + '"');
document.write(' style="width:150px;filter:Shadow(color=gray, Direction=135, Strength=8)blendTrans(duration=.25);visibility:hidden;position:absolute;left:0;top:'+ Top +';"');
Top = Top + 28;
document.write(" onMouseOver=on('" + menuarr[x] + "'); onMouseOut=off('" + menuarr[x] + "');>");
document.write(eval("BuildLinks('" + menuarr[x] + "')"));
document.write('</div>');
}}


