var myTWin,udalosti,menuHideTime;
myTWin = window.myTWin;
menuHideTime=new Array();
if(!window.ActiveXObject){
udalosti='W3C';
window.addEventListener('load',loadDefaultUdalost,true);
//window.addEventListener('unload',unloadDefault,true);

}else{
udalosti='MSIE';
window.attachEvent('onload',loadDefaultUdalost);
//window.attachEvent('onunload',unloadDefault);

}
function loadDefaultUdalost(e){
//var menu_strom=document.getElementById("menu_strom");
var menu_strom=document.getElementsByClassName("strom");
if(menu_strom){
count=menu_strom.length;
//serializaceStromu(menu_strom,'liClass');

if(udalosti=='W3C'){
for(x=0;x<count;x++){
menu_strom[x].addEventListener('click',menu_prepnout,true);
korekcePosledniho(menu_strom[x]);
}
}else{
for(x=0;x<count;x++){
menu_strom[x].attachEvent('onclick',menu_prepnout);
korekcePosledniho(menu_strom[x]);
}
}
}
var hlavni_menu=document.getElementsByClassName("hlavni_menu");
if(hlavni_menu){
count=hlavni_menu.length;
for(x=0;x<count;x++){
pridatUdalostiHlavniMenu(hlavni_menu[x],x);
}
}

var images = new Array('G-iko/nvg_strom/luplitem.gif',/*'G-iko/nvg_strom/new.gif',*/'G-iko/nvg_strom/lineup.gif','G-iko/nvg_strom/lineplus.gif','G-iko/nvg_strom/lineminus.gif','G-iko/nvg_strom/corner.gif','G-iko/nvg_strom/cornerplus.gif','G-iko/nvg_strom/cornerminus.gif');
var downloader = new Array();
var pocet = images.length;

for (var i=0;i<pocet;i++) {
downloader[i] = new Image();
downloader[i].src = AktualDir+images[i];
}

}
function pridatUdalostiHlavniMenu(h,x){
UL=h.getElementsByTagName("ul");
z_index=UL.length;
for(d=0;d<UL.length;d++){
LI=UL[d].parentNode;
if(PSFhlavniMenuTyp=='top'){
LI.style.zIndex=z_index;
z_index=z_index-1;
}
LI.setAttribute('id',"hlavni_menu_"+x+"_"+d);
if(udalosti=='W3C'){
LI.addEventListener('mouseover',function(e){zobrazUlSubmenu(this/*.className='r'*/);},true);
LI.addEventListener('mouseout',function(e){skryjULSubmenu(this.id);},true);
}else{
//LI.setAttribute('onmouseover',"zobrazUlSubmenu(document.getElementById('hlavni_menu_"+x+"_"+d+"'));");
//LI.setAttribute('onmouseout',"skryjULSubmenu('hlavni_menu_"+x+"_"+d+"');");
LI.setAttribute('onmouseover',"zobrazUlSubmenu(this);");
LI.setAttribute('onmouseout',"skryjULSubmenu(this.id);");
}
};
if(udalosti=='MSIE' && d>0){
menuHTML=h.innerHTML;
h.innerHTML=menuHTML;
}
}
function skryjULSubmenu(id){
menuHideTime[id]=setTimeout("document.getElementById('"+id+"').className='s';",250);
}
function zobrazUlSubmenu(el){
if (menuHideTime[el.id]){
clearTimeout(menuHideTime[el.id]);
menuHideTime[el.id] = null;
}
pageIn=document.getElementsByClassName('pageIn');
topleftE=Element.viewportOffset(pageIn[0]);
widthHeightE=Element.getDimensions(pageIn[0]);
levyKrajStranky=topleftE[0];
pravyKrajStranky=topleftE[0]+widthHeightE.width;
if(PSFhlavniMenuTyp=='right')submenuSmer='right';
else submenuSmer='left';
TLLi=Element.viewportOffset(el);
WHLi=Element.getDimensions(el);
if(WHLi.width!=0)WLi=WHLi.width;
else{
if(udalosti=='MSIE'){
sirkaIE=parseInt(el.style.width);
if(sirkaIE>0)WLi=sirkaIE;
else WLi=170;
}else WLi=170;
}
RLi=TLLi[0]+WLi;
WHUl=Element.getDimensions(el.lastChild);
if(submenuSmer=='left'){
rodicClass=el.parentNode.className;
if(rodicClass=='hlavni_menu top'){
RUl=TLLi[0]+10+WHUl.width;
if(RUl>pravyKrajStranky)el.lastChild.style.left=((WHLi.width-10)-WHUl.width)+'px';
else el.lastChild.style.left='10px';
}else{
if(WHUl.width!=0)WUl=WHUl.width;
else WUl=178;
RUl=(RLi-10)+WUl;
if(RUl>pravyKrajStranky)el.lastChild.style.left=(10-WUl)+'px';
else el.lastChild.style.left=(WLi-10)+'px';
}
}else{
if(WHUl.width!=0)WUl=WHUl.width;
else WUl=178;
LUl=(TLLi[0]+10)-WUl;
if(LUl>levyKrajStranky)el.lastChild.style.left=(10-WUl)+'px';
else el.lastChild.style.left=(WLi-10)+'px';
}
el.className='r';
}
function korekcePosledniho(el){
UL=el.parentNode.getElementsByTagName("ul");
for(d=0;d<UL.length;d++){
if(UL[d].childNodes.length>0){
LI=UL[d].lastChild;
tridaLI=LI.className;
if(tridaLI=='')LI.className='c';
if(tridaLI=='r'){
LI.className='rc';
if(LI.childNodes[1])LI.childNodes[1].className='rc';
};
if(tridaLI=='s'){
LI.className='sc';
if(LI.childNodes[1])LI.childNodes[1].className='sc';
};};};};
/*function serializaceStromu(menu_strom,c){
liClass=vratCookie(c);
if(liClass!=false){
poleLiClass=liClass.split(':');
li=menu_strom.getElementsByTagName('LI');
count=li.length;
x=0;
for(n=0;n<count;n++){
className=li[n].className;
if(className){
if(x<=poleLiClass.length){
li[n].className=poleLiClass[x];
x++;
};};};};};
function vratCookie(c){stringCookie=document.cookie;polecookie=unescape(stringCookie).split('; ');count=polecookie.length;x=false;for(n=0;n<count;n++){cookieS=polecookie[n].split('\=');if(cookieS[0]==c){x=cookieS[1];};};return x;};
function unloadDefault(e){
var menu_strom=document.getElementById("menu_strom");
li=menu_strom.getElementsByTagName('LI');
liClass='';
count=li.length;
for(n=0;n<count;n++){
className=li[n].className;//[n].getAttribute('class');
if(className!=''){
if(liClass=='')liClass=className;
else liClass+=':'+className;
}
}
if(liClass!='')document.cookie="liClass="+liClass;
}*/
function menu_prepnout(e) {
   var zdroj,trida;
   e = e || window.event;
   zdroj = e.target || e.srcElement;
   trida = zdroj.className;
   if (zdroj.nodeName.toLowerCase()=="li" && (trida=="s" || trida=="r")) {
      zdroj.className = (trida=="r") ? "s" : "r";
   }else{
   if (zdroj.nodeName.toLowerCase()=="li" && (trida=="sc" || trida=="rc")) {
      zdroj.className = (trida=="rc") ? "sc" : "rc";
   }
   }
   }
function OpenMyWin(p){
if (myTWin!=null && !myTWin.closed){setTimeout('OpenMyWin("'+p+'");', 1000);}else{setTimeout('FCEloader(\'none\');', 1000);if(p!=false){self.location.href=p;};};};
function Otevri_okno(rX,rY,c){lX=((screen.width)/2)-(rX/2);lY=((screen.height)/2)-(rY/2);if(lX==false){lX=100;};if(lY==false){lY=100;};msg=window.open(AktualDir+'nahled_obrazku.php?jmeno='+c,'','toolbar=0, menubar=0, location=0, directories=0, scrollbars=1, resizable=1, status=0, width='+(rX+1)+', height='+(rY+1)+', top='+lY+', left='+lX);msg.focus();return false;};
function Otevri_popup(rX,rY,c){
lX=((screen.width)/2)-(rX/2);lY=((screen.height)/2)-(rY/2);if(lX==false){lX=100;};if(lY==false){lY=100;};msg=window.open(c,'','toolbar=0, menubar=0, location=0, directories=0, scrollbars=1, resizable=1, status=0, width='+rX+', height='+rY+',top='+lY+', left='+lX);msg.focus();return false;};
function Otevri_popup2(rX,rY,c,n){
lX=((screen.width)/2)-(rX/2);lY=((screen.height)/2)-(rY/2);if(lX==false){lX=100;};if(lY==false){lY=100;};myTWin = window.open(c,n,'toolbar=0, menubar=0, location=0, directories=0, scrollbars=1, resizable=1, status=0, width='+rX+', height='+rY+',top='+lY+', left='+lX);myTWin.focus();return false;};
function zaskrtni(f,S,s)
{for(i=0;i<f.length;i++){if(S.checked==true)
{s.checked = true;if(f[i].checked==false)f[i].checked = true;else f[i].checked = false;
}else{s.checked = false;if(f[i].checked==true){f[i].checked = false;}else{f[i].checked = true;};
};};};
function winH(){
if (window.innerHeight)return window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
return document.documentElement.clientHeight;
else if (document.body && document.body.clientHeight)
return document.body.clientHeight;
else return null;
}
function winW(){
if (window.innerWidth) return window.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth)
return document.documentElement.clientWidth;
else if (document.body && document.body.clientWidth)
return document.body.clientWidth;
else return null;
};
function mujScrollY(){
var s;if(document.documentElement && document.documentElement.scrollTop){s=document.documentElement.scrollTop;}else if(document.body){s=document.body.scrollTop;}else{s=0;};return s};
function getMouseXY(e){
if(window.ActiveXObject){mouseX = event.clientX + document.body.scrollLeft;mouseY = event.clientY + mujScrollY();}else{mouseX=e.pageX;mouseY=e.pageY;};};
function FCEloader(b){
l=document.getElementById("loaderIMG");
if(b=="block"){
document.body.style.cursor='progress';
lX=(winW()/2)-150;
lY=(winH()/2)-200;
s=mujScrollY();
if(loaderPosition=='fixed'){
l.style.position='fixed';
}else{
lY=lY+s;
}
l.style.left=lX+"px"
l.style.top=lY+"px";
l.style.zIndex="10000";
}else{
l.style.zIndex="1";
document.body.style.cursor='auto';
};
l.style.display=b;
};
function addBookmark (url, title){
if (window.sidebar){window.sidebar.addPanel(title, url,"");}else if( window.external ){window.external.AddFavorite( url, title);}else if(window.opera && window.print){return true;};};
function kontrolaEmailu(email,povolit){
if (window.RegExp && povolit==true)
{

emailKontrola=document.getElementById(email);
emailKontrola.style.background="white";
znaky=new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$");
if (!znaky.test(emailKontrola.value))
{
//window.alert("Zadaná adresa není platným e-mailem!");
povolit=false;
emailKontrola.style.background="yellow";
alert("Zadali jste neplatnou Vaší e-mailovou adresu.");
//emailKontrola.focus();
}
return povolit;
}
/*if(povolit==false){
alert("Zadali jste neplatnou Vaší e-mailovou adresu.");
//alert("Některý z povinných údajů je chybný, nebo není vyplněn.");
}*/
return povolit;
}
function kontrolaPole(pole,p){
if (p==true){s=pole.split(",");for(i=0;i<s.length;i++){n=document.getElementById(s[i]);n.style.background="white";if(n.value!=false && p!=false){p=true;}else{p=false;};if(n.value==false){n.style.background="yellow";};};};if(p==false){alert("Některý z povinných údajů není vyplněn.");};return p;};
function formatInspektor(typ,pole,p){
if (window.RegExp && p==true)
{
i=document.getElementById(pole);
i.style.background="white";
if(typ=="mail"){
znaky=new RegExp("^[_a-zA-Z0-9.-]+[@]{1}[_a-zA-Z0-9.-]+[.]{1}[a-zA-Z]{2,4}$");
sprava="Zadali jste neplatnou Vaší e-mailovou adresu. Vzor 'franta@blabla.cz'";
}else if(typ=="www"){
znaky=new RegExp("^((http:|https:)//[_a-zA-Z0-9.-]+.[a-zA-Z]{2,4}(/{1}[-_~&=?.a-z0-9]*)*)$");
sprava="Zadali jste nesprávný formát URL adresy.";
}else if(typ=="tel/fax"){
znaky=new RegExp("^[+]{1}[0-9]{3}[0-9]{9}$");//číslo je ve tvaru +420123456789
sprava="Zadali jste nesprávný formát Tel/fax čísla. Vzor '+420123456789'";
}else if(typ=="icq"){
znaky=new RegExp("^[0-9]{6,10}$");
sprava="Zadali jste nesprávný formát ICQ čísla. Vzor '305402420'";
}else if(typ=="dic"){
znaky=new RegExp("^[a-zA-Z]{2}[0-9]{8,10}$");
sprava="Zadali jste nesprávný formát DIČ. Vzor 'CZ01020304'";
}else if(typ=="ico"){
znaky=new RegExp("^[0-9]{8}$");
sprava="Zadali jste nesprávný formát IČO. Vzor '12345678'";
}else if(typ=="psc"){
znaky=new RegExp("^[0-9]{5}$");
sprava="Zadali jste nesprávný formát PSČ. Vzor '50012'";
}else if(typ=="kvalita"){
znaky=new RegExp("^[0-9]{1,3}$");
sprava="Zadali jste nesprávný formát Kvality. Vzor '80'";
}else if(typ=="cislo"){
znaky=new RegExp("^[0-9.]{1,10}$");
sprava="Zadali jste nesprávný formát Čísla. Vzor '80' a nebo s desetinou tečkou '80.1'";
};
if (!znaky.test(i.value) && i.value!=false)
{
p=false;
i.style.background="yellow";
alert(sprava);
};
};
return p;
};
function presunOkno(idOkna){
if(IE || NS || OPERA)
{
	document.getElementById(idOkna).ondragdrop = function(posunx, posuny)
	{
		// Nastav novou pozici objektu
		this.style.left = (this.left + posunx)+"px";
		if((this.top + posuny)<0)thisPosunY=0;
		else thisPosunY=this.top + posuny;
		this.style.top  = thisPosunY+"px";
	}
	startDrag(document.getElementById(idOkna),1);
}
};
function konecPresunu(idOkna){
stopDrag(document.getElementById(idOkna));
};
function zIndexOken(t){
for(i=0;i<poleOkna.length;i++){
x=document.getElementById(poleOkna[i]);
if(poleOkna[i]==t){x.style.zIndex=100;
}else{z=x.style.zIndex-1;x.style.zIndex=(z>10)?z:10};
};};
function povinnyUdajForm(e,v){
p=document.createElement('b');p.style.color="red";t=document.createTextNode(v);p.appendChild(t);e.appendChild(p);};
function addslashes(s){
s=s.replace(/\'/g,'\\\'');
s=s.replace(/\"/g,'\\"');
s=s.replace(/\\/g,'\\\\');
s=s.replace(/\0/g,'\\0');
return s;
};
function stripslashes(s){
s=s.replace(/\\'/g,'\'');
s=s.replace(/\\"/g,'"');
s=s.replace(/\\\\/g,'\\');
s=s.replace(/\\0/g,'\0');
return s;
};
function createLabel(e,f,v){
l=document.createElement('label');l.setAttribute("for",f);l.style.cursor="pointer";t=document.createTextNode(v);l.appendChild(t);e.appendChild(l);};
function InputCheckbox(e,i,n,v,t){
r=document.createElement('input');r.type="checkbox";r.setAttribute("id", i);r.setAttribute("name",n);r.setAttribute("value", v);e.appendChild(r);createLabel(e,i,t);return r};
function InputRadio(e,i,n,v,t){
r=document.createElement('input');r.type="radio";r.setAttribute("id", i);r.setAttribute("name",n);r.setAttribute("value", v);e.appendChild(r);createLabel(e,i,t);return r};
function radioChecked(v){
s=0;r=document.getElementsByName(v);for(i=0; i<r.length; i++){if(r.item(i).checked==true){s=r.item(i).getAttribute('value');};};return s;};
function zaokrouhleni(v,zo){switch(zo){case 1:rV=(Math.round((v)*10,1))/10;break;case 2:rV=Math.round( (v) * 2 ) / 2;break;case 3:rV=Math.round(v);break;case 4:rV=Math.ceil(v);break;};return rV;};