var qm_si,qm_li,qm_lo,timeTimeout,menu_hideTimer,qm_ts;
var showTimer=0;
var hideTimer=500;
var qp="parentNode";
var qc="className";
var browser=navigator.userAgent;
var browser_opera=browser.indexOf("Opera")+1;
var browser_safari=browser.indexOf("afari")+1;
var browser_safari2=browser_safari&&window.XMLHttpRequest;
var browser_netscape=browser.indexOf("Netscape")+1;
var browser_version=parseFloat(navigator.vendorSub);;;

function menu_create(menuID,v,rl,fl,nf,l){
	var w="onmouseover";
	if(!l){
		l=1;
		menu_hideTimer=hideTimer;
		menuID=document.getElementById("menu"+menuID);
		menuID[w]=function(e){kill_event(e)};
		document[w]=qm_bo;
		menuID.style.zoom=1;
		if(!v)
			menuID.ch=1;
	}
	if(fl)menuID.fl=1;
	if(rl)
		menuID.rl=1;		
	menuID.style.zIndex=l+""+1;
	var lsp;
	var sp=menuID.childNodes;
	
	for(var i=0;i<sp.length;i++){
		var b=sp[i];
		if(b.tagName=="A"){
			lsp=b;
			b[w]=qm_oo;
			b.qmts=showTimer;
			if(l==1&&v){
				b.style.styleFloat="none";
				b.style.cssFloat="none";
			}
		}
		if(b.tagName=="DIV"){
			if(window.showHelp&&!window.XMLHttpRequest)
				sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'>&nbsp;</span>");
				x2("qmparent",lsp,1);
				lsp.cdiv=b;
				b.idiv=lsp;
				if(browser_netscape&&browser_version<8&&!b.style.width)
					b.style.width=b.offsetWidth+"px";
					new menu_create(b,null,rl,fl,nf,l+1);
		}
	}
};;

function qm_bo(e){
	clearTimeout(timeTimeout);
	timeTimeout=null;
	if(qm_li&&!timeTimeout)
		timeTimeout=setTimeout("x0()",menu_hideTimer);
};;

function x0(){
	var a;
	if((a=qm_li)){
		do{qm_uo(a);}
		while((a=a[qp])&&!qm_a(a))}
	qm_li=null;
};;

function qm_a(a){
	if(a[qc].indexOf("menu_class")+1)
	return 1;
};;

function qm_uo(a,go){
	if(!go&&a.qmtree)
		return;
	if(window.qmad&&qmad.bhide)eval(qmad.bhide);
	a.style.visibility="";
	x2("qmactive",a.idiv);};;;

function qm_oo(e,o,nt){
if(!o)
	o=this;
if(window.qmad&&qmad.bhover&&!nt)
	eval(qmad.bhover);
if(window.qmwait){
	kill_event(e);
	return;
}
clearTimeout(timeTimeout);
timeTimeout=null;
if(!nt&&o.qmts){
	qm_si=o;
	timeTimeout=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);
	return;
}
var a=o;
if(a[qp].isrun){
	kill_event(e);
	return;
}
var go=true;
while((a=a[qp])&&!qm_a(a)){
	if(a==qm_li)
		go=false;
}
if(qm_li&&go){
	a=o;
	if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li))qm_uo(qm_li);
	a=qm_li;
	while((a=a[qp])&&!qm_a(a)){
		if(a!=o[qp])
			qm_uo(a);
		else  break;
	}
}
var b=o;
var c=o.cdiv;
if(b.cdiv){
	var aw=b.offsetWidth;
	var ah=b.offsetHeight;
	var ax=b.offsetLeft;
	var ay=b.offsetTop;
	if(c[qp].ch){
		aw=0;
		if(c.fl)ax=0;
	} else {
		if(c.rl){
			ax=ax-c.offsetWidth;
			aw=0;
		}
		ah=0;
	}
	if(browser_opera){
		ax-=b[qp].clientLeft;
		ay-=b[qp].clientTop;
	}
	if(browser_safari2){
		ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");
		ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");
	}
	if(!c.ismove){
		c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";
	}
	x2("qmactive",o,1);
	if(window.qmad&&qmad.bvis)eval(qmad.bvis);
		c.style.visibility="inherit";
	qm_li=c;
} else   if(!qm_a(b[qp]))
	qm_li=b[qp];
	else  
	qm_li=null;
kill_event(e);
};;

function qm_gcs(obj,sname,jname){
	var v;
	if(document.defaultView&&document.defaultView.getComputedStyle)
		v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);
	else   if(obj.currentStyle)v=obj.currentStyle[jname];
	if(v&&!isNaN(v=parseInt(v)))return v;
	else  return 0;
};;

function x2(name,b,add){
	var a=b[qc];
	if(add){
		if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}
		else {
			b[qc]=a.replace(" "+name,"");
			b[qc]=b[qc].replace(name,"");
			}
};;

function kill_event(e){
	if(!e)
		e=event;
		e.cancelBubble=true;
		if(e.stopPropagation&&!(browser_safari&&e.type=="click"))e.stopPropagation();
	}
