//
//  Dynamiczne menu v1.5
//  
//  Copyright (C) 2002-2005   Marek Wojtkowiak, Tomasz Wojtkowiak
//  All rights reserved.
//  
//  Author: Marek Wojtkowiak
//  Date: 22.03.2005
//  

var za=new Array;var zb=new Array;var zc;var zd=new Array;var st_id=null;var ie4=document.all;var ns6=document.getElementById&&!document.all;
function ze(id){if (ie4) return document.all[id];if (ns6) return document.getElementById(id);}
function zf(zg){return zg.substr(zg.length-1,1);}
function zh(zg){if (ze("a_"+zg.id)!=null) ze("a_"+zg.id).style.color = pkc;zg.style.backgroundColor=pkt;zg.style.border=pgr+"px "+psr;zg.style.borderColor=pkr;}
function zi(zg){if (ze("a_"+zg.id)!=null) ze("a_"+zg.id).style.color=zkc;zg.style.backgroundColor=zkt;zg.style.border=zgr+"px "+zsr;zg.style.borderColor=zkr;}
function zl(zg){var menu;var layer;var objParent;var xParent;var yParent;var nazwaMenu;eval("menu="+zg.id);layer=ze("menu"+menu.poziom);if (menu.podmenu>0){if (zd[menu.poziom]){zh(zd[menu.poziom]);}zd[menu.poziom] = zg;zw(menu.poziom+1,menu.nazwa,menu.podmenu);xParent=0;yParent=0;objParent=layer.offsetParent;while (objParent){xParent+=objParent.offsetLeft;yParent+=objParent.offsetTop;objParent=objParent.offsetParent;}zt(menu.poziom+1,xParent+layer.offsetLeft+layer.offsetWidth+xd,yParent+layer.offsetTop+zg.offsetTop+yd);zr(menu.poziom+2);}else{if (zd[menu.poziom]){zh(zd[menu.poziom]);}zd[menu.poziom]=null;zr(menu.poziom+1);}zgZaznaczony=zg;if (menu.opis.length>0){zi(zg);};}
function zm(zg){var menu;eval("menu="+zg.id);if (!za[menu.poziom+1]){if (menu.opis.length>0){zh(zg);};}}
function zn(zg){var menu;eval("menu="+zg.id);window.location.replace(menu.link);}
function zj(zg){var poziom;clearTimeout(st_id);zc=true;poziom=zf(zg.id);zb[poziom]=true;if (zg.id!="menu1"){zg.style.visibility='visible';}}
function zk(zg){var poziom;clearTimeout(st_id);zc=false;poziom=zf(zg.id);zb[poziom]=false;if (zg.id!="menu1"){if (!za[poziom-1]){zr(poziom);}if (za[poziom+1]){zr(poziom);}}st_id=setTimeout("zp();",1000);}
function zp(){if (!zc){if (zd[1]){zh(zd[1]);}}zr(2);}
function zt(poziom,x,y){ze("menu"+poziom).style.left=x;ze("menu"+poziom).style.top=y;ze("menu"+poziom).style.visibility='visible';za[poziom] = true;}
function zs(poziom){ze("menu"+poziom).style.visibility='hidden';za[poziom] = false;}
function zr(poziom){if (!zc){for (w=poziom;w<=8;w++){zs(w);}}}
function zo(){var zghtml;zghtml="";for (w=1;w<=8;w++){za[w]=false;zb[w]=false;if (w==1){zghtml+="<div style=\"position: relative; z-index: "+(100+w)+";\" id=\"menu"+w+"\" onmouseover=\"zj(this);\" onmouseout=\"zk(this);\"></div>";}else{zghtml+="<div style=\"position: absolute; z-index: "+(100+w)+"; visibility: hidden;\" id=\"menu"+w+"\" onmouseover=\"zj(this);\" onmouseout=\"zk(this);\"></div>";}}document.write(zghtml);}
function zw(poziom,nazwamenu,ilepozycji){var zghtml;var menu;var szerokosc;var wysokosc;var kursor;var styl_a="";var typpodmenu=0;szerokosc=0;wysokosc=0;for (m=1;m<=ilepozycji;m++){eval("menu="+nazwamenu+"_"+m);menu.nazwa=nazwamenu+"_"+m; 	  menu.nr=m;menu.poziom=poziom;if (szerokosc<menu.szerokosc) szerokosc=menu.szerokosc;}szerokosc+=(gr*2)+(om*2)+(pgr*2);zghtml="";zghtml+="<table id=\"table_"+"menu"+poziom+"\" width=\""+szerokosc+"px\" cellspacing=\""+om+"px\" style=\"background-color: "+km+"; border: "+gr+"px "+sr+"; border-color: "+kr+";\" >";wysokosc=0;for (m=1;m<=ilepozycji;m++){eval("menu="+nazwamenu+"_"+m);if (menu.podmenu==0){if (menu.link.length>0){kursor="hand";zghtml+="<tr id=\"tr_"+nazwamenu+"_"+m+"\" style=\"cursor: "+kursor+"; height: "+menu.wysokosc+"px;\"><td id=\""+nazwamenu+"_"+m+"\" style=\"background: url("+menu.grafika+") no-repeat; border: "+pgr+"px "+psr+"; border-color: "+pkr+"; cursor: "+kursor+";\" onclick=\"zn(this);\"; onmouseover=\"zl(this);\" onmouseout=\"zm(this);\">";styl_a="font-family: "+cnm+"; font-size: "+crm+"; color: "+pkc+"; left: 0px; top: 0px; width: "+szerokosc+"px; display: block; text-decoration: none; white-space: nowrap;";zghtml+="<a id=\"a_"+nazwamenu+"_"+m+"\" style=\""+styl_a+"\" href=\""+menu.link+"\" onclick=\"return false;\">";zghtml+="<span style=\"position: relative; cursor: "+kursor+"; left: "+lmd+"px; top: "+tmd+"px;\">"+menu.opis+"</span>";zghtml+="</a></td></tr>";}else{zghtml+="<tr id=\"tr_"+nazwamenu+"_"+m+"\" style=\"cursor: default; height: "+menu.wysokosc+"px;\"><td id=\""+nazwamenu+"_"+m+"\" style=\"border: "+pgr+"px "+psr+"; border-color: "+pkr+"; background: url("+menu.grafika+") no-repeat; cursor: default;\"  onmouseover=\"zl(this);\" onmouseout=\"zm(this);\">";zghtml+="</td></tr>";}}else{kursor="default";zghtml+="<tr id=\"tr_"+nazwamenu+"_"+m+"\" style=\"cursor: "+kursor+"; height: "+menu.wysokosc+"px;\"><td id=\""+nazwamenu+"_"+m+"\" style=\"border: "+pgr+"px "+psr+"; border-color: "+pkr+"; background: url("+menu.grafika+") no-repeat; cursor: "+kursor+";\"  onmouseover=\"zl(this);\" onmouseout=\"zm(this);\">";styl_a ="font-family: "+cnm+"; font-size: "+crm+"; color: "+pkc+"; left: "+lmd+"px; top: "+tmd+"px; width: "+(szerokosc-lmd)+"px; cursor: "+kursor+"; position: relative; display: block; text-decoration: none; white-space: nowrap;";zghtml+="<span id=\"a_"+nazwamenu+"_"+m+"\" style=\""+styl_a+"\">"+menu.opis+"<img style=\"border: 0px; position: absolute; top: "+tkd+"px; left: "+(szerokosc-lmd-rkd)+"px; cursor: "+kursor+";\" SRC=\""+knm+"\"></span>";zghtml+="</td></tr>";}wysokosc+=menu.wysokosc+(om);}zghtml+="</table>";ze("menu"+poziom).innerHTML=zghtml;ze("menu"+poziom).style.width=szerokosc;ze("menu"+poziom).style.height=wysokosc+(gr)+(om)+(pgr);}
function MenuStart(){zo();zw(1,nw,im);zt(1,xm,ym);}