
////////////////////Last modified 2007-03-26////////////////////

//	Modify following four lines to customize your menu
var tdColor="#fff";		// menu item text color
var hlColor="#fff";		// highlight text color
var hlBgColor="#6ba245";	// highlight background color
//	After change, modify same values in your *.css file
var tdBgColor="#5c9236";	// menu item background color


//for the sub menus
document.write("<style>table.menu td	{background-color:"+tdBgColor+";color: " + tdColor + " !important;}</style>");
//document.write("<style>table.menu td	{background:url('images/idem_all/fdo10.jpg'); color: " + tdColor + " !important;}</style>");


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

function doMenu(td){
	clearTimeout(ti);
	//changes backgroound color when mouse over
	td.style.backgroundColor=hlBgColor;
	//td.style.background="url(images/idem_all/fdo9.jpg)";
	td.style.color=hlColor;
	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.background="url(images/idem_all/fdo9.jpg)";
				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 sh(td){
	document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
}
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];
			//document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
			//document.getElementById("td"+sT).style.background="url(images/idem_all/fdo10.jpg)"
			document.getElementById("td"+sT).style.color=tdColor;
			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+4)+"px;left:"+
			(document.getElementById("tbl"+tt).offsetLeft+document.getElementById("td"+st).offsetWidth-2)+"px\">";
	}
	return (document.getElementById("mainmenu").offsetTop+document.getElementById("td"+st).offsetHeight+1)+"px;left:"+
		  (document.getElementById("mainmenu").offsetLeft+document.getElementById("td"+st).offsetLeft+10)+"px\">";
}

var sH="<table width=\"950\" border=\"0\" align=\"center\" class=\"menu\" id=\"mainmenu\" cellspacing=\"0\" style=\"border:0;\"><tr>";
var p=0;
var j=0;
while(eval("typeof(td_"+ ++j +")!=\"undefined\"")){
	sH+="<td align=\"center\" id=\"td_"+j+"\" onmouseover=\"doMenu(this)\" onmouseout=\"sh(this);ti=setTimeout('clearMenu()',md)\"";
	
	sH+=(eval("typeof(url_"+j+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url_"+j)+"')\">":">";
	sH+=eval("td_"+j)+"</td>";
	if (eval("typeof(td_"+j+"_1)!=\"undefined\""))
		pT[p++]="_"+j;
}
sH+="<td width=\"4\" align=\"right\" valign=\"top\" background=\"images/idem_all/ctt_2.jpg\" class=\"borderShL\">&nbsp;</td></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+"\" cellspacing=\"0\" style=\"top:"+getCoord(sT);
	while (eval("typeof(td"+sT+"_"+ ++j +")!=\"undefined\"")){
		sH+="<tr><td id=\"td"+sT+"_"+j+"\" onmouseover=\"doMenu(this)\" onmouseout=\"sh(this);ti=setTimeout('clearMenu()',md)\"";
		sH+=(eval("typeof(url"+sT+"_"+j+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url"+sT+"_"+j)+"')\">":">";
		sH+=eval("td"+sT+"_"+j)+"</td></tr>";
		if (eval("typeof(td"+sT+"_"+j+"_1)!=\"undefined\""))
			pT[p++]=sT+"_"+j;
	}
	sH+="</table>";
	document.write(sH);
}
document.getElementById("mainmenu").style.visibility="visible";

