//dynamiczne menu EY
menuc=0;
ismenu=new Array();
menuwidth=new Array(230,150,150,150,150,0);	 //szerokosc kolejnych menu						


function initmenu()
{

	for (i=0;i<menuitems.length;i++)
	{
		if (menuitems[i]!=0)
		{
			ismenu[i]=1;
		}
		else
		{
			ismenu[i]=0;
		}
		
	}
menuc=1;
}

function menudraw()
{
	for (i=0;i<menuitems.length;i++)
	{
		if (menuitems[i]!=0)
		{
		divheight=menuitems[i].length*24;
		divheight2=divheight+30;
		divwidth2=menuwidth[i]+50;
		divheightback=divheight-2;
		document.write('<div id="menu'+i+'" style="position:absolute;width:'+menuwidth[i]+'px;height: '+divheight+'px;top:140px; display:none; z-index:10">');
		
			for (j=0;j<menuitems[i].length;j++)
			{
				document.write('<div style="position:relative;width:'+menuwidth[i]+'px;height:23px;left:0px;top:0px;background: #3f3f3f; padding-top:5px; z-index:10" onmouseover="this.style.background=\'#959595\';" onmouseout="this.style.background=\'#3f3f3f\';" onclick="document.location=\''+menuitems[i][j][1]+'\'">');
				document.write('<a href="'+menuitems[i][j][1]+'" class="menu" style="margin-left:6px; ">'+menuitems[i][j][0]+'</a>');
				document.write('</div>');
				if (j<(menuitems[i].length-1))
				{
					document.write('<div style="position:relative; width:'+menuwidth[i]+'px;height:1px;top:0px;left:0px;background:#797979; z-index:10;"><!-- --></div>');
				}
			}
			
		document.write('<div style="position:relative;width:'+divwidth2+'px;height: '+divheight2+'px;top:-'+divheightback+'px;left:-25px; z-index:9;background:#ffffff;filter:alpha(opacity=0);opacity:0;" onmouseover="closemenus()"><!-- --></div>');
		document.write('</div>');
		}
	}
}

function showmenu(nr,obj)
{
	if (menuc==1)
	{
		closemenus();
		if (ismenu[nr]!=0)
		{
			divleft=obj.offsetParent.offsetLeft+obj.offsetParent.offsetParent.offsetParent.offsetLeft;
			document.getElementById("menu"+nr).style.left=divleft+"px";
			document.getElementById("menu"+nr).style.display="block";
		}
	}
}

function closemenus()
{
	if (menuc==1)
	{
		for (i=0;i<menuitems.length;i++)
		{
			if (ismenu[i]!=0)
			{
				document.getElementById("menu"+i).style.display="none";
			}
		}
	}
}


