////////////////////Please leave this notice//////////////////////
//								//
//	Dynamic JS Menu 1.0_2					//
//	By Pat Libby (Libbypa@maine.rr.com)			//
//	http://dragonsbane1.topcities.com			//
//	Free to use!						//
//								//
////////////////////Last modified 01-31-2003//// me 11-21-2006 ///////////

var md=250;
var ti=-1;
var oTd=new Object;
oTd=null;

function doMenu(td){
	clearTimeout(ti);
	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]){
				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(document.getElementById("tbl"+sT)!=null)
				document.getElementById("tbl"+sT).style.visibility="hidden";
		}
		oTd=null;
	}
}

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+5)+"px;left:"+
			(document.getElementById("tbl"+tt).offsetLeft+document.getElementById("td"+st).offsetWidth-5)+"px\">";
	}
	return (document.getElementById("mainmenu").offsetTop+document.getElementById("td"+st).offsetTop+5)+"px;left:"+
		  (document.getElementById("mainmenu").offsetLeft+document.getElementById("td"+st).offsetWidth-5+SubMenuPositionCorrection)+"px\">";
}

var sH="<table cellspacing=\"0\" id=\"mainmenu\">";
var p=0;
var j=0;
while(eval("typeof(td_"+ ++j +")!=\"undefined\"")){
	sH+="<tr><td id=\"td_"+j+"\" onmouseover=\"doMenu(this)\" onmouseout=\"ti=setTimeout('clearMenu()',md)\"";
	if (eval("typeof(url_"+j+")!=\"undefined\""))
	{
		add_class = "";
		if (eval("typeof(class_"+j+")!=\"undefined\"")) add_class = "<span class=\""+eval("class_"+j)+"\">&#9658;</class>";
		sH+="><a href=\""+eval("url_"+j)+"\" class=\"main_menu_item_top\">"+eval("td_"+j)+add_class+"</a>";
	}
	else
	{
		sH+=">";
	}
	sH+="</td>";
	if (eval("typeof(td_"+j+"_1)!=\"undefined\""))
	{
		pT[p++]="_"+j;
		sH+="</tr>";
	}
	else
	{
		sH+="</tr>";
	}
}
sH+="</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=\"ti=setTimeout('clearMenu()',md)\"";
		if (eval("typeof(url"+sT+"_"+j+")!=\"undefined\""))
		{
			add_class = "";
			if (eval("typeof(class"+sT+"_"+j+")!=\"undefined\"")) add_class = "<span class=\""+eval("class"+sT+"_"+j)+"\">&#9658;</class>";
			sH+="><a href=\""+eval("url"+sT+"_"+j)+"\" class=\"main_menu_item\">"+eval("td"+sT+"_"+j)+add_class+"</a>";
		}
		else
		{
			sH+=">";
		}
		sH+="</td>";
		if (eval("typeof(td"+sT+"_"+j+"_1)!=\"undefined\""))
		{
			pT[p++]=sT+"_"+j;
			sH+="</tr>";
		}
		else
		{
			sH+="</tr>";
		}
	}
	sH+="</table>";
	document.write(sH);
}

document.getElementById("mainmenu").style.visibility="visible";
