// VERSION: 1 (27/4/2004)

var md=700;
var ti=-1;
var oTd=new Object;
oTd=null;

function reLoad()
{
	window.location.reload();
}

window.onresize = reLoad;

function doMenu(td){
	clearTimeout(ti);
	var nav_id = getNavbarId();
	var i;
	var sT="";
	var tda=new Array();
	tda=td.id.split("_");
        if(tda.length > 2)
        {
                td.style.backgroundColor=hlSubmenuBgColor;
                td.style.color=hlSubmenuColor;

        }
        else
        {
                td.style.backgroundColor=hlMenuBgColor;
                td.style.color=hlMenuColor;

		if(nav_id > 0)
		{
			var nav_td = document.getElementById("td_"+nav_id);
			if( nav_td != null)
			{
				if( nav_td != td)
				{
       		        		nav_td.style.backgroundColor=tdMenuBgColor;
       			         	nav_td.style.color=tdMenuColor;

					var nav_tbl = document.getElementById("tbl_"+nav_id);
					if( nav_tbl != null) nav_tbl.style.visibility="hidden";
				}
			}
		}
        }

	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]){
				if(i == 1)
				{
					document.getElementById("td"+sT).style.backgroundColor=tdMenuBgColor;
					document.getElementById("td"+sT).style.color=tdMenuColor;
				}
				else
				{
					document.getElementById("td"+sT).style.backgroundColor=tdSubmenuBgColor;
					document.getElementById("td"+sT).style.color=tdSubmenuColor;
				}

				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(){
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		var sT="";

		for(var i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			if(i == 1)
			{
				document.getElementById("td"+sT).style.backgroundColor=tdMenuBgColor;
				document.getElementById("td"+sT).style.color=tdMenuColor;
			}
			else
			{
				document.getElementById("td"+sT).style.backgroundColor=tdSubmenuBgColor;
				document.getElementById("td"+sT).style.color=tdSubmenuColor;
			}

			if(document.getElementById("tbl"+sT)!=null)
			{
				document.getElementById("tbl"+sT).style.visibility="hidden";
			}
		}
		oTd=null;			
	}
}


function runMenu(strURL){
	location.href=strURL;
}

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 (document.getElementById("tbl"+tt).offsetTop+document.getElementById("td"+st).offsetTop-1)+"px;left:"+(document.getElementById("tbl"+tt).offsetLeft+document.getElementById("td"+st).offsetWidth+0)+"px\">";
	}
	return (document.getElementById("mainmenu").offsetTop+document.getElementById("td"+st).offsetHeight+0)+"px;left:"+(document.getElementById("mainmenu").offsetLeft+document.getElementById("td"+st).offsetLeft)+"px\">";
}

var top_pos = getMenuTop();
var left_pos = getMenuLeft();

var sH="<table class=\"menu\" id=\"mainmenu\" cellspacing=\"0\" style=\"position: absolute; top: " + top_pos + "px; left: " + left_pos + "px\"><tr>";
var p=0;
var j=0;
while(eval("typeof(td_"+ ++j +")!=\"undefined\"")){
	var img = '';
	if (eval("typeof(img_"+j+")!=\"undefined\"")) {
		var img = 'background="'+eval("img_"+j)+'"';
	}
	sH+="<td id=\"td_"+j+"\" "+img+" onmouseover=\"doMenu(this)\" onmouseout=\"ti=setTimeout('clearMenu()',md)\"";
/*
	if (eval("typeof(img_"+j+")!=\"undefined\"")) {
		var img = ' background = "'+eval("img_"+j)+'" ';
		sH+="<img src=\""+src+"\">&nbsp;";
	}
*/
	sH+=(eval("typeof(url_"+j+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url_"+j)+"')\">":">";
	sH+=eval("td_"+j);
	sH+="</td>";
	if (eval("typeof(td_"+j+"_1)!=\"undefined\""))
		pT[p++]="_"+j;
}
sH+="</tr></table>";
document.write(sH);

document.getElementById("mainmenu").style.visibility="visible";
