
ua=navigator.userAgent;
OP=ua.match(/Opera.[5-9]/i)!=null;
IE=!OP&&ua.match(/msie.[4-9]/i)!=null;
N4=!OP&&!IE&&ua.match(/mozilla.4/i)!=null;

ofsH=8;
nbsp=" ";
rt="<!--el-->";
mi=[];
c=0;
d=document;

function Item(m,w) {
	this.l;
	this.m=m;
	this.w=w;
}

function Menu(n) {
	this.n=n;
	this.m="<table border=0 cellpadding=0 cellspacing=2><tr>"+rt+"</tr></table>";
	this.sm="";
	this.bg=["#CECECE","#909090","#CECECE","#909090"];
	this.cl=["#000000","#FFFFFF","#000000","#FFFFFF"];
	this.mf="Verdana,Arial";
	this.mfs="11px";
	this.mfw="normal";
	this.smf=this.mf;
	this.smfs=this.mfs;
	this.smfw=this.mfw;
	this.bc="#0000FF";
	this.bw=1;
}

function addM(mo,mid,text,url,w) {
	mi[mid]=new Item(mo,w);
	mo.m=mo.m.replace(rt,item(mid,mo.bg[3],mo.n,url,nbsp+text+nbsp)+rt);
}

function addSM(mo,mid,text,url) {
	mi[mid+"sub"+c]=new Item(mo,0);
	ls="<!--"+mid+"-->";
	if(mo.sm.indexOf(ls)<0) mo.sm+=(N4?"<layer":"<div")+" id="+mid+"sub onmouseover=sE(this,1) onmouseout=sE(this,0) "+(N4?"visibility=hide  width="+mi[mid].w:"style=position:absolute;visibility:hidden")+"><table width="+mi[mid].w+" border=0 cellpadding=4 cellspacing=8><tr><td bgcolor="+mo.bc+"><table width=100% border=0 cellpadding=0 cellspacing="+mo.bw+">"+ls+"</table></td></tr></table>"+(N4?"</layer>":"</div>");
	mo.sm=mo.sm.replace(ls,"<tr>"+item(mid+"sub"+c,mo.bg[0],mo.n+"sub",url,nbsp+text+nbsp)+"</tr>"+ls);
	c++;
}

function writeStyle(o) {
	s=IE?"cursor:hand":N4?"text-decoration:none":"cursor:default";
	d.write('<style>.'+o.n+',.'+o.n+'n{font-family:'+o.mf+';font-size:'+o.mfs+';font-weight:'+o.mfw+';'+s+'}.'+o.n+'sub,.'+o.n+'subn{font-family:'+o.smf+';font-size:'+o.smfs+';font-weight:'+o.smfw+';'+s+'}.'+o.n+'{color:'+o.cl[0]+'}.'+o.n+'sub{color:'+o.cl[2]+'}</style>');
}

function hl(o,t) {
	e=mi[o.id];
	c=(e.w>0)<<1|t;
	bg=e.m.bg[c];
	cl=e.m.cl[c];
	if(N4) {
		w=o.clip.width;
		with(o.document) {
			linkColor=cl;
			vlinkColor=cl;
			alinkColor=cl;
			bgColor=bg;
			open();
			write(e.l);
			close();
		}
		o.clip.width=w;
	}
	else {
		OP?o.style.background=bg:o.style.backgroundColor=bg;
		o.style.color=cl;
	}
	sm=gE(o.id+"sub");
	if(e.w && sm) {
		if(t) {
			if(N4) {
				sm.left=o.pageX;
				sm.top=o.pageY+o.clip.height;
			}
			else{
				mnp=o;
				ofsL=0;
				ofsT=0;
				do {
					ofsL+=mnp.offsetLeft;
					ofsT+=13.2;
					mnp=mnp.offsetParent;
				}
				while(mnp!=null);
				s=sm.style;
				s.left=ofsL;
				s.top=ofsT+(OP?ofsH:o.offsetHeight);
			}
			sE(sm,1);
		}
		else sE(sm,0);
	}
}

function item(id,bg,cl,u,t) {
	mi[id].l=a(cl+"n",u,t);
	return "<td bgcolor="+bg+(N4?"><ilayer><layer width=100%":" class="+cl+(u?" onmousedown=document.location='"+u+"'":""))+" id="+id+" onmouseover=hl(this,1) onmouseout=hl(this,0)>"+(N4?a(cl,u,t)+"</layer></ilayer>":t)+"</td>";
}

function a(cl,u,t) {
	return "<a class="+cl+" href="+(u?u:"#")+">"+t+"</a>";
}

function gE(e,f) {
	if(N4) {
		f=(f)?f:self;
		var V=f.document.layers;
		if(V[e]) return V[e];
		for(var W=0;W<V.length;) t=gE(e,V[W++]);
		return t;
	}
	if(IE) return d.all[e];
	return d.getElementById(e);
}

function a(cl,u,t) {
	return "<a class="+cl+" href="+(u?u:"#")+">"+t+"</a>";
}

function gE(e,f) {
	if(N4) {
		f=(f)?f:self;
		var V=f.document.layers;
		if(V[e]) return V[e];
		for(var W=0;W<V.length;) t=gE(e,V[W++]);
		return t;
	}
	if(IE) return d.all[e];
	return d.getElementById(e);
}

function gS(e) {
	return N4? gE(e):gE(e).style;
}

function sE(e,v) {
	(N4?e:e.style).visibility=v?N4?'show':'visible':N4?'hide':'hidden';
}


