function DMenu(MID, PID, MText, MLink){
	this.MyID=MID;
	this.ParentID=PID;
	this.MyText=MText;
	this.MyLink=MLink;
}
function MenuProp(MW, MFnt, MFSize, MBGCOut, MFGCOut, MIMGOut, MBGCOvr, MFGCOvr, MIMGOvr){
	this.tmr="";
	this.MWidth=MW;
	this.MFont=MFnt;
	this.FSize=MFSize;
	this.BGCOut=MBGCOut;
	this.FGCOut=MFGCOut;
	this.IMGOut=MIMGOut;
	this.BGCOvr=MBGCOvr;
	this.FGCOvr=MFGCOvr;
	this.IMGOvr=MIMGOvr;
	this.AllMenus=new Array();
	this.ActiveMenu=""
	this.ActiveChild="";
}
function PMnCM(Prnt, Chld){
	this.Parent=Prnt;
	this.Child=Chld;
}

function ShowMenu(cname, ME, pname,e){
	var IE=document.all?true:false;
	ME.style.background =MenuP.BGCOvr;
	ME.style.color=MenuP.FGCOvr;
	MenuP.ActiveMenu=pname;
	TMs=MenuP.AllMenus.length;

	if(MenuP.ActiveChild!=pname){
		for(i=0; i<TMs; i++){
			if(MenuP.AllMenus[TMs-i-1].Parent!=pname){
				MenuP.AllMenus[TMs-i-1].Child.style.visibility="hidden";
				MenuP.AllMenus[TMs-i-1].Parent.style.visibility="hidden";
				MenuP.AllMenus.pop();			
			}
			else{
				MenuP.AllMenus[TMs-i-1].Child.style.visibility="hidden";
				MenuP.AllMenus.pop();
				break;
			}
		}
	}
	if(cname){
		cname.style.visibility="visible";
		MenuP.AllMenus[MenuP.AllMenus.length]=new PMnCM(pname,cname);
		MenuP.ActiveChild=cname;
		if(IE){
			cname.style.left=window.event.clientX-window.event.offsetX+MenuP.MWidth-20;			
			cname.style.top=window.event.clientY+document.body.scrollTop-window.event.offsetY-2;
		}else{
			cname.style.left=(pname.offsetLeft)+MenuP.MWidth+8;
			cname.style.top=(pname.offsetTop+ME.offsetTop);
		}
	}else
		MenuP.ActiveChild=pname;
	TMs=MenuP.AllMenus.length;

}

function CloseAll(){
var Lnth;
Lnth=MenuP.AllMenus.length;
	for(i=0; i<Lnth; i++){
		MenuP.AllMenus[Lnth-1-i].Child.style.visibility="hidden";
		MenuP.AllMenus.pop();
	}
}

function MOut(ME){
	ME.style.background=MenuP.BGCOut;
	ME.style.color=MenuP.FGCOut;
	MenuP.tmr=setTimeout("CloseAll();",1000);
}
function MOver(CNAME, me, PNAME,E){
	clearTimeout(MenuP.tmr);
	ShowMenu(CNAME,me,PNAME,E);
}

function WriteMenu(){
var IE=document.all?true:false;
var TLink="";
	LastParent=-1;
	for (i=0; i<=Menu.length-1; i++){
		if (LastParent!=Menu[i].ParentID){
			if (LastParent!=-1){
				document.write("</table>");
			}
		document.write("<table id='TBL"+ Menu[i].ParentID +"' width="+ MenuP.MWidth +" cellspacing=0 cellpadding='5' bgcolor='' style='position:absolute; visibility:hidden; font-family:verdana; color:"+MenuP.FGCOut+"; font-size:"+MenuP.FSize+";'>");
		}	
			if(Menu[i].MyLink=="")
				TLink="";
			else
			   TLink="onclick=\"CloseAll();location.href='"+Menu[i].MyLink+"';\"";
			   
			document.write("<tr id='TR"+ Menu[i].MyID +"' style='cursor:pointer;' "+TLink+">");
				document.write("<td height='25' width='10' class='bt_line_top' bgcolor='"+ MenuP.BGCOut +"' onMouseOver=\"MOver(document.all.TBL"+ Menu[i].MyID +", this, TBL"+ Menu[i].ParentID +", event);\" onMouseOut=\"MOut(this);\" style='padding-left:0px;'>");
					document.write("<img src='images/bt_arow.gif' width='20' height='14' align='texttop' /> ");
				document.write("</td>");
				document.write("<td height='25' class='bt_line_top' bgcolor='"+ MenuP.BGCOut +"' onMouseOver=\"MOver(document.all.TBL"+ Menu[i].MyID +", this, TBL"+ Menu[i].ParentID +", event);\" onMouseOut=\"MOut(this);\" style='padding-left:0px;'>");// filter: alpha (opacity=88);border:1px solid #FFFFFF;'>
					document.write(Menu[i].MyText);
				document.write("</td>");
			document.write("</tr>");
		LastParent=Menu[i].ParentID;
	}
	document.write("</table>");
	TBL0.style.visibility='visible';
	if(IE)
		TBL0.style.position='fixed';//relative, absolute, static, fixed, inherit
	else
		TBL0.style.position='relative';
}

