// Dropdown menu script (c) 2003 by Gleb Erty
//
// based on ScriptBreaker source
//  

var counter = 0
var container = new Array()

var dom = (document.getElementById) ? true : false;
var nn4 = (document.layers) ? true : false;
var ie4 = (!dom && document.all) ? true : false;
var opera = (window.opera) ? true : false;
var show_style = (nn4) ? 'show' : 'visible';
var hide_style = (nn4) ? 'hide' : 'hidden';

function getlayer(id) 
{	return (dom) ? document.getElementById(id).style : ((ie4) ? document.all[id].style : ((nn4) ? document.layers[id] : null));
}

function header(nr,al,ap,last)
{
 id = "mb_"+counter+"_" + nr;
 this.id = id;
 this.counter = counter;
 this.menunum = nr;
 this.onmouseover = doopen;
 this.onmouseout = doclose;
 this.ap = ap;
// str = "<td valign=center id='tt"+nr+"'><a class='link' href=\""+al[1]+"\" style='text-decoration:none;position:relative;' onmouseover='container["+counter+"].container["+nr+"].onmouseover()' onmouseout='container["+counter+"].hide_all()'><div class='menu' id="+this.id+" style='height:"+ap[1]+";'><img src='/skin/1x1.gif' height=5 border=0><br><NOBR>&nbsp;"+al[0]+"&nbsp;</NOBR></div></a>"
 str = "<td valign=center id='tt"+nr+"'><a class='link' href=\""+al[1]+"\" style='text-decoration:none;position:relative;' onmouseover='container["+counter+"].container["+nr+"].onmouseover()' onmouseout='container["+counter+"].hide_all()'><div class='menu' id="+this.id+" style='height:"+ap[1]+";'><NOBR>&nbsp;"+al[0]+"&nbsp;</NOBR></div></a>"
// str = "<td valign=center id='tt"+nr+"'><a class='link' href=\""+al[1]+"\" style='text-decoration:none;position:relative;vertical-align: bottom;' onmouseover='container["+counter+"].container["+nr+"].onmouseover()' onmouseout='container["+counter+"].hide_all()'><div class='menu' id="+this.id+" style='height:"+ap[1]+";background-color: #FFFFFF;'><NOBR style='background-color: #808080;vertical-align: middle;'>&nbsp;"+al[0]+"&nbsp;</NOBR></div></a>"
 document.write(str)
 this.element = document.getElementById(this.id)
 var itemsa = new Array()
 
 document.write("<div id='dd"+nr+"' style='visibility:"+hide_style+"'>")

// document.write("<div id='dt"+nr+"' style='top:" + (ap[2]-ap[1]-5) + ";position:absolute;visibility:"+hide_style+"'><IMG src='/skin/1x1.gif' width=1 height=1>")
 document.write("<div id='dt"+nr+"' style='top:" + (ap[2]+4) + ";position:absolute;visibility:"+hide_style+"'><IMG src='/skin/1x1.gif' width=1 height=1>")

 if (al[4].length > 1)
 {	//document.write("<TABLE width="+(ap[0]+2)+" height="+(((al[4].length-1)*ap[1])+2))
	document.write("<TABLE width="+(ap[0]+2)+" height="+(((al[4].length-1)*ap[1]+2)))
	document.write(" cellspacing=0 cellpadding=0 border=0 background='/skin/2/"+al[2]+"' style='background-repeat: no-repeat;'><tr>")
	if (ap[6] == "")
	{	document.write("<nobr><td rowspan=3><IMG src='/skin/1x1.gif'' width=1 height=1></td>")
		document.write("<td width=100%><IMG src='/skin/1x1.gif' width=1 height=1></td>")
		document.write("<td rowspan=3><IMG src='/skin/1x1.gif' width=1 height=1></td>")
	}
	else
	{	document.write("<nobr><td rowspan=3 bgcolor="+ap[6]+"><IMG src='/skin/1x1.gif'' width=1 height=1></td>")
		document.write("<td width=100% bgcolor="+ap[6]+"><IMG src='/skin/1x1.gif' width=1 height=1></td>")
		document.write("<td rowspan=3 bgcolor="+ap[6]+"><IMG src='/skin/1x1.gif' width=1 height=1></td>")
	}
//	document.write("</tr><tr>")
//	document.write("<td height=100%><IMG src='/skin/1x1.gif' width=1 height=1></td>")
//	document.write("</tr><tr>")
	if (ap[6] != "") document.write("<td bgcolor="+ap[6]+"><IMG src='/skin/1x1.gif' width=1 height=1></td>")
	else document.write("<td><IMG src='/skin/1x1.gif' width=1 height=1></td>")
	document.write("</tr></table></div>")

	for (j=0;j<al[4].length;j++)
	{	if (al[4][j][1] != "") 
		{	itemsa[j] = new item(nr,j,al[4][j],ap,this.bottom,this.left);
		}
	}
	if (ap[6] != "") 
	{	if (i!=last) document.write("</td><td valign=center><B style='color: '"+this.ap[6]+"></B>|</td></div>");
		else document.write("</td><td>&nbsp;</td></div>");
	}
	else
	{	if (i!=last) document.write("</td><td valign=center><B>&nbsp;$nbsp;</B></td></div>");
		else document.write("</td><td>&nbsp;</td></div>");
	}
 }
 else 
 {	if (ap[6] != "") 
	{	if (i!=last) document.write("</td><td valign=center><B style='color: '"+this.ap[6]+"></B>|</td></div>");
		else document.write("</td><td>&nbsp;</td></div>");
	}
	else
	{	if (i!=last) document.write("</td><td valign=center><B>&nbsp;$nbsp;</B></td></div>");
		else document.write("</td><td>&nbsp;</td></div>");
	}
	document.write("</div>");
 }

 this.container = itemsa
}

function doopen()
{
 container[this.counter].fast_hide();
 clearTimeout(container[this.counter].timer);
 if (this.ap[6] != "") this.element.style.backgroundColor = this.ap[6];
 this.element.style.color = this.ap[4];
 for(k=0;k<this.container.length;k++)
 {	this.container[k].onshow();
 }
 getlayer('dd'+this.menunum).visibility = show_style;
 getlayer('dt'+this.menunum).visibility = show_style;
}

function doclose()
{
 if (this.ap[5] != "") this.element.style.backgroundColor = this.ap[5];
 this.element.style.color = this.ap[3];
 for(k=0;k<this.container.length;k++)
 {	this.container[k].onhide();
 }
 getlayer('dd'+this.menunum).visibility = hide_style;
 getlayer('dt'+this.menunum).visibility = hide_style;
}

function item(nr,nri,ali,api,b,l)
{
 this.id = "i"+nr+"_"+ nri +"_"+counter;
 this.left = l;
 this.counter = counter;
 this.onshow = doshow;
 this.onhide = dohide;
 this.onmouseover = doover;
 this.onmouseout = doout;

 this.api = api;
 document.write("<a href=\""+ali[1]+"\" style='padding-left: 1px; text-decoration:none;position:absolute;top:"+(((nri)*api[1])+1+api[2]+5)+"' onmouseover='container["+counter+"].container["+nr+"].container["+nri+"].onmouseover();' onmouseout='container["+counter+"].container["+nr+"].container["+nri+"].onmouseout();'><div class='menu2' id='"+this.id+"' style='width:"+api[0]+";height:"+api[1]+"; color:" + api[7] + ";'>&nbsp;"+ali[0]+"</div></a>");
 this.element = document.getElementById(this.id);
 this.element.style.visibility = hide_style;
 this.element.style.backgroundColor = this.api[9];
}

function doover()
{	this.element.style.color = this.api[8];
	this.element.style.backgroundColor = this.api[10];
	clearTimeout(container[this.counter].timer);
}

function doout()
{	this.element.style.color = this.api[7];
	this.element.style.backgroundColor= this.api[9];
	container[this.counter].timer = setTimeout("container["+this.counter+"].fast_hide();",1000);
}

function Menu(al,ap)
{
 var headers = new Array()
 var last = al.length-2;
 document.write("<table cellspacing=0 cellpadding=0 border=0><tr>");
 for(i=0;i<al.length;i++)
 {	if (al[i][1].length != 0) headers[i] = new header(i,al[i],ap,last);
	else last--;
 }
 document.write("</tr></table>");
 this.container = headers;
 this.hide_all = dohide_all
 this.fast_hide = catcht
 this.timer = null
 this.counter = counter
 container[counter] = this
 counter++;
}

function doshow(){getlayer(this.id).visibility = show_style;}
function dohide(){getlayer(this.id).visibility = hide_style;}

function dohide_all(){this.visibility = hide_style; this.timer = setTimeout("container["+this.counter+"].fast_hide();",1000);}
function catcht(){ for(i=0;i<this.container.length;i++) this.container[i].onmouseout();}
  