
////////////////////Please leave this notice////////////////////
//
//	DropDown Menu 1.0
//	By Evgeny Novikov (java@aladin.ru)
//	http://java.skyteam.ru
//	It works only with IE5.0(++) and Netscape6.0(++)
//  Modified by Tom Craig (www.nextmeta.com) to work with Mac IE5.0
//	Free to use!
//
////////////////////Last modified 2003-04-11////////////////////

// Decide browser version
var ns4 = (document.layers)? true:false;
var ns6 = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;
var ie5 = false;
var mac = false;

if (navigator.appVersion.indexOf('Mac') != -1)
	mac = true;

if (ie4) {
	if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) {
		ie5 = true;
	}
	if (ns6) {
		ns6 = false;
	}
}

//	Modify following four lines to customize your menu
var tdColor="#ffffcd";		// menu item text color
var tdBgColor="#9a0000";	// menu item background color
var hlColor="#CD9933";		// highlight text color
var hlBgColor="#663300";	// highlight background color
//	After change, modify same values in your *.css file

var md=750;
var ti=-1;
var oTd=new Object;
oTd=null;

function doMenu(td){
	clearTimeout(ti);
//	td.style.backgroundColor=hlBgColor;
	td.style.color=hlColor;
	document.thisForm.style.visibility="hidden"; 
	var i;
	var sT="";
	var tda=new Array();
	tda=td.id.split("_");
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		for(i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			if(tdo[i]!=tda[i]){
				document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
				document.getElementById("td"+sT).style.color=tdColor;
				if(document.getElementById("tbl"+sT)!=null)
					document.getElementById("tbl"+sT).style.visibility="hidden";
			}
		}			
	}
	oTd=td;
	sT="tbl";
	for(i=1;i<tda.length;i++)
		sT+="_"+tda[i];
	if(document.getElementById(sT)!=null)
		document.getElementById(sT).style.visibility="visible";

}

function clearMenu(){
	document.thisForm.style.visibility="visible"; 
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		var sT="";
		for(var i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
			document.getElementById("td"+sT).style.color=tdColor;
			if(document.getElementById("tbl"+sT)!=null)
				document.getElementById("tbl"+sT).style.visibility="hidden";
		}
		oTd=null;
		// document.getElementById("mainmenu").style.visibility="hidden";
		// if(ns4) document.layers["mainmenu"].visibility = "hide";			
	}
}

function runMenu(strURL){
	location.href=strURL;
}

function getoffsetTop(itemID) {
itemRef=document.getElementById(itemID);
        var iHeight=0;
        while (itemRef.tagName!="BODY")
        {
        	iHeight+=itemRef.offsetTop;
            itemRef=itemRef.offsetParent;
        }
        iHeight=(ie5)?iHeight:iHeight;
        return  iHeight;
        } 

var tt="";
var sT="";
var pT=new Array();
var tA=new Array();

function getCoord(st){
	tA=st.split("_");
	if(tA.length>2){
		tA=tA.slice(0,-1);
		tt=tA.join("_");
		return (getoffsetTop("shim"+st)+0)+"px;left:"+
			(document.getElementById("tbl"+tt).offsetLeft+document.getElementById("td"+st).offsetWidth+0)+"px\">";
	}
	return (document.getElementById("mainmenu").offsetTop+document.getElementById("td"+st).offsetHeight+3)+"px;left:"+
		  (document.getElementById("mainmenu").offsetLeft+document.getElementById("td"+st).offsetLeft+0)+"px\">";
}

var sH="<table class=\"menu\" id=\"mainmenu\" BORDER=\"0\" CELLSPACING=\"0\" BGCOLOR=\"#9A0000\"><tr>";
var p=0;
var j=0;
while(eval("typeof(td_"+ ++j +")!=\"undefined\"")){
	sH+="<td id=\"td_"+j+"\" STYLE=\"padding-right: 15px\" Class=MainNavMenu onmouseover=\"doMenu(this); this.className='MainNavMenuOn'\" onmouseout=\"ti=setTimeout('clearMenu()',md); this.className='MainNavMenu'\"";
	sH+=(eval("typeof(url_"+j+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url_"+j)+"')\"><IMG SRC=\"images/shim.gif\" id=\"shim_"+j+"\" ALIGN=TOP WIDTH=1 HEIGHT=1 BORDER=0 ALT=\"\">":">";
	sH+=eval("td_"+j)+"</td>";
	if (eval("typeof(td_"+j+"_1)!=\"undefined\""))
		pT[p++]="_"+j;
}
sH+="</tr></table>";
document.write(sH);
for(var q=0;typeof(pT[q])!="undefined";q++){
	sT=pT[q];
	sH="";
	j=0;
	sH+="<table class=\"menu\" id=\"tbl"+sT+"\" NOWRAP cellspacing=\"0\" cellpadding=\"2\" BGCOLOR=\"#9a0000\" style=\"background-color: transparent; top:"+getCoord(sT);
	sH+="<tr><td STYLE=\"padding: 0px\"><TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD WIDTH=100% BGCOLOR=\"#9a0000\"><IMG SRC=\"images/shim.gif\" WIDTH=100% HEIGHT=1 BORDER=0></TD><TD WIDTH=\"10\"><IMG SRC=\"images/menu_top_right.gif\" WIDTH=10 HEIGHT=10 BORDER=0></TD></TR></TABLE></td></tr>";
	while (eval("typeof(td"+sT+"_"+ ++j +")!=\"undefined\"")){
		sH+="<tr><td id=\"td"+sT+"_"+j+"\" Class=SubNavMenu onmouseover=\"doMenu(this); this.className='SubNavMenuOn'\" onmouseout=\"ti=setTimeout('clearMenu()',md); this.className='SubNavMenu'\"";
		sH+=(eval("typeof(url"+sT+"_"+j+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url"+sT+"_"+j)+"')\">&nbsp;&nbsp;<IMG SRC=\"images/shim.gif\" id=\"shim"+sT+"_"+j+"\" ALIGN=TOP WIDTH=1 HEIGHT=1 BORDER=0 ALT=\"\">":">";
		sH+=eval("td"+sT+"_"+j)+"&nbsp;&nbsp;</td></tr>";
		if (eval("typeof(td"+sT+"_"+j+"_1)!=\"undefined\""))
			pT[p++]=sT+"_"+j;
	}
	sH+="<tr><td STYLE=\"padding: 0px\"><TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD WIDTH=\"10\"><IMG SRC=\"images/menu_bottom_left.gif\" WIDTH=10 HEIGHT=10 BORDER=0></TD><TD WIDTH=100% BGCOLOR=\"#9a0000\"><IMG SRC=\"images/shim.gif\" WIDTH=100% HEIGHT=1 BORDER=0></TD><TD WIDTH=\"10\"><IMG SRC=\"images/menu_bottom_right.gif\" WIDTH=10 HEIGHT=10 BORDER=0></TD></TR></TABLE></td></tr></table>";
	document.write(sH);
}

function showMenu() {
	document.getElementById("mainmenu").style.visibility="visible";
}

function hideMenu() {
	document.getElementById("mainmenu").style.visibility="hidden";
}

document.getElementById("mainmenu").style.visibility="visible";


