// Author: Sergey A Zakharov, sergey@kraft-sp.ru
// Copyright: (c)2002 Sergey A Zakharov
// Small JavaScript Menu: v1.0
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=14;
nbsp="&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;
		// Menu Table Specifications
		this.m="<table border=0 cellpadding=4 cellspacing=2><tr>"+rt+"</tr></table>";
		this.sm="<table border=0 cellpadding=4 cellspacing=2><tr>"+rt+"</tr></table>";
		// Background Colors [Menu, Menu-Highlight, SubMenu, Menu-Highlight]
		this.bg=["#CECECE","#909090","#CECECE","#909090"];
		// Font Colors [Menu, Menu-Highlight, SubMenu, SubMenu-Highlight]
		this.cl=["#0000FF","#FFFFFF","#000000","#FFFFFF"];
		this.mf="Verdana,Arial";     // Menu Font
		this.mfs="11px";             // Menu Font Size
		this.mfw="normal";           // Menu Font Weight
		this.smf="Verdana,Arial";    // SubMenu Font
		this.smfs="11px";            // SubMenu Font Size
		this.smfw="normal";          // SubMenu Font Weight
		this.bc="#0000FF";           // SubMenu Border Color
		this.bw=0                    // SubMenu Border Width
	}

function addM(mo,mid,text,url,w)
	{
		mi[mid]=new Item(mo,w);
		mo.m=mo.m.replace(rt,item(mid,mo.bg[0],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=0 cellspacing=0><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[2],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+=mnp.offsetTop;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 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'
	}