function cancelbuble(evt) {
  if (window.event!=null) {	
    window.event.cancelBubble = true;
  } else {
    evt.cancelBubble = true;
  }  
}

function stch(id,style) {
  o=document.getElementById(id);
  o.className=style;
}

function jclick(URL,id,style,oldid,oldstyle) {
  o=document.getElementById(oldid);
  if (o!=null) o.className=oldstyle;
  o=document.getElementById(id);
  o.className=style;
  if (URL>'') document.location=URL;
}

function btclick(id,URL) {
  o=document.getElementById('BTL_'+id);
  o.className='btleft2';
  o=document.getElementById('BTM_'+id);
  o.className='btmain2';
  o=document.getElementById('BTR_'+id);
  o.className='btright2';
  if (URL>'') document.location=URL;
}

function btover(id) {
  o=document.getElementById('BTL_'+id);
  o.className='btleft1';
  o=document.getElementById('BTM_'+id);
  o.className='btmain1';
  o=document.getElementById('BTR_'+id);
  o.className='btright1';
}

function btout(id) {
  o=document.getElementById('BTL_'+id);
  o.className='btleft0';
  o=document.getElementById('BTM_'+id);
  o.className='btmain0';
  o=document.getElementById('BTR_'+id);
  o.className='btright0';
}

function btmclick(id,URL) {
  o=document.getElementById('MTL_'+id);
  o.className='btmleft2';
  o=document.getElementById('MTM_'+id);
  o.className='btmmain2';
  o=document.getElementById('MTR_'+id);
  o.className='btmright2';
  if (URL>'') document.location=URL;
}

function btmover(id) {
  o=document.getElementById('MTL_'+id);
  o.className='btmleft1';
  o=document.getElementById('MTM_'+id);
  o.className='btmmain1';
  o=document.getElementById('MTR_'+id);
  o.className='btmright1';
}

function btmout(id) {
  o=document.getElementById('MTL_'+id);
  o.className='btmleft0';
  o=document.getElementById('MTM_'+id);
  o.className='btmmain0';
  o=document.getElementById('MTR_'+id);
  o.className='btmright0';
}
function btrclick(id,URL) {
  o=document.getElementById('RTL_'+id);
  o.className='btrleft2';
  o=document.getElementById('RTM_'+id);
  o.className='btrmain2';
  o=document.getElementById('RTR_'+id);
  o.className='btrright2';
  if (URL>'') document.location=URL;
}

function btrover(id) {
  o=document.getElementById('RTL_'+id);
  o.className='btrleft1';
  o=document.getElementById('RTM_'+id);
  o.className='btrmain1';
  o=document.getElementById('RTR_'+id);
  o.className='btrright1';
}

function btrout(id) {
  o=document.getElementById('RTL_'+id);
  o.className='btrleft0';
  o=document.getElementById('RTM_'+id);
  o.className='btrmain0';
  o=document.getElementById('RTR_'+id);
  o.className='btrright0';
}

function mnover(id) {
  o=document.getElementById('BML_'+id);
  if (o!=null) o.className='mnbtl1';
  o=document.getElementById('BMM_'+id);
  o.className='mnbtc1';
  o=document.getElementById('BMR_'+id);
  if (o!=null) o.className='mnbtr1';
}
function mnout(id) {
  o=document.getElementById('BML_'+id);
  if (o!=null) o.className='mnbtl0';
  o=document.getElementById('BMM_'+id);
  o.className='mnbtc0';
  o=document.getElementById('BMR_'+id);
  if (o!=null) o.className='mnbtr0';
}
function mnclick(id,URL) {
  o=document.getElementById('BML_'+id);
  if (o!=null) o.className='mnbtl2';
  o=document.getElementById('BMM_'+id);
  o.className='mnbtc2';
  o=document.getElementById('BMR_'+id);
  if (o!=null) o.className='mnbtr2';
  if (URL>'') document.location=URL;
}
function hovr(id,jaka,imgdir) {
  o=document.getElementById('hv'+id);
  o.src=imgdir+'/detaily_hvezda'+jaka+'01.gif'
}
function hout(id,jaka,imgdir) {
  o=document.getElementById('hv'+id);
  o.src=imgdir+'/detaily_hvezda'+jaka+'00.gif'
}
function hlasovani(i) { 
  document.hodnoceni.av.value=i;	
  document.hodnoceni.submit();
}
function hlasuj(i,j) { 
  o=eval("document.anketa"+j);
  o.av.value=i;	
  o.submit();
}
function mklrover() {
  o=document.getElementById('klr1');
  o.className='klbtovr';
  o=document.getElementById('klr2');
  o.className='klbrovr';
  o=document.getElementById('klr3');
  o.className='klbttovr';
}
function mklrout() {
  o=document.getElementById('klr1');
  o.className='klbt';
  o=document.getElementById('klr2');
  o.className='klbr';
  o=document.getElementById('klr3');
  o.className='klbtt';
}
function mkllover() {
  o=document.getElementById('klr1');
  o.className='klbtovr';
  o=document.getElementById('klr2');
  o.className='klblovr';
  o=document.getElementById('klr3');
  o.className='klblttovr';
}
function mkllout() {
  o=document.getElementById('klr1');
  o.className='klbt';
  o=document.getElementById('klr2');
  o.className='klbl';
  o=document.getElementById('klr3');
  o.className='klbltt';
}
function seznam() {
  o=document.getElementById('klr1');
  o.className='klbtclk';
  o=document.getElementById('klr2');
  o.className='klbrclk';
  o=document.getElementById('klr3');
  o.className='klbttclk';
  document.udelator.cmd.value='seznam';
  document.udelator.submit();
}	
function katalog() {
  o=document.getElementById('klr1');
  o.className='klbtclk';
  o=document.getElementById('klr2');
  o.className='klblclk';
  o=document.getElementById('klr3');
  o.className='klblttclk';
  document.udelator.cmd.value='katalog';
  document.udelator.submit();
}	
function nahoru() {
  stch('udr','udra2');	
  document.udelator.cmd.value='nahoru';
  document.udelator.submit();
}
function dolu() {
  stch('udl','udla2');	
  document.udelator.cmd.value='dolu';
  document.udelator.submit();
}
function strankovani(x) {
  document.udelator.cmd.value='str'+x;
  document.udelator.submit();
}	
function page(x) {
  document.udelator.cmd.value='page'+x;
  document.udelator.submit();
}
function seltr(x) {
  document.udelator.cmd.value='seltr'+x;
  document.udelator.submit();
}
function seltrkat(x) {
  document.udelator.cmd.value='seltrkat'+x;
  document.udelator.submit();
}
function kosch(id,okolik,sid,sst) {
  o=eval('document.kosik.kosks'+id);
  o.value=Number(o.value)+Number(okolik);
  if (o.value<0) o.value=0;	
  setTimeout('stch("'+sid+id+'","'+sst+'")',150);
}
function adrok () {
  errtxt='';
  b=document.adresy;
  if (b.firstname.value.length<2) {errtxt+='Vyplňte prosím jméno.\n';}
  if (b.lastname.value.length<2) {errtxt+='Vyplňte prosím příjmení.\n';}
  if (b.email.value.length<2) {errtxt+='Vyplňte prosím e-mail.\n';}
  if (b.mobil.value.length<9) {errtxt+='Vyplňte prosím telefonní číslo.\n';}
  if (b.shstreet.value.length<2) {errtxt+='Vyplňte prosím ulici dodací adresy.\n';}
  if (b.shcity.value.length<2) {errtxt+='Vyplňte prosím město dodací adresy.\n';}
  if (b.shzip.value.length<5) {errtxt+='Vyplňte prosím PSČ dodací adresy.\n';}
  if (b.blstreet.value.length<2) {errtxt+='Vyplňte prosím ulici fakturační adresy.\n';}
  if (b.blcity.value.length<2) {errtxt+='Vyplňte prosím město fakturační adresy.\n';}
  if (b.blzip.value.length<5) {errtxt+='Vyplňte prosím PSČ fakturační adresy.\n';}
  if (errtxt>'') {
    window.alert(errtxt);	
  } else {	
    b.submit();	
  }	
}	

function dlsel(x) {
  if (x>0) {	
    o=document.getElementById('plx'+x);
    o.checked=true;
  }  
  for (i=0;i<py.length;i++) {
    j=0;
    o=document.getElementById('pyx'+py[i]);
    p=document.getElementById('prc'+py[i]);
    while ((j<dl.length)&&!((dl[j]==x)&&(dr[j]==py[i]))) j++;
    if (j<dl.length) {
      o.style.display='inline';
      p.style.display='none';
    } else {
      o.checked=false;
      o.style.display='none';
      p.style.display='block';
    }  
  }		
}

function dopok() {
  errtxt='';
  b=document.dopapl;
  el=b.elements;
  
  radiogroup = el['delivery'];
  itemchecked = false;
  for(j=0;j<radiogroup.length;++j) {
    if (radiogroup[j].checked) {
      itemchecked = true;
      break;
    }
  }
  if (!itemchecked) errtxt+='Zvolte prosím dopravu.\n';
  radiogroup = el['payment'];
  itemchecked = false;
  for(j=0;j<radiogroup.length;++j) {
    if(radiogroup[j].checked) {
      itemchecked = true;
      break;
    }
  }
  if (!itemchecked) errtxt+='Zvolte prosím způsob platby.\n';
  if (errtxt>'') {
    window.alert(errtxt);	
  } else {	
    b.submit();	
  }	
}		

function potvrdit() {
  document.rekap.submit();	
}	
function registr() {
  errtxt='';
  b=document.registrace;
  if (b['reg[login][0]'].value.length<2) {errtxt+='Vyplňte prosím přihlašovací jméno.\n';}
  if (b['reg[password]'].value.length<4) {errtxt+='Vyplňte prosím heslo (alespoň 4 znaky).\n';}
  if ((b['reg[password]'].value.length>3)&&(b['reg[password]'].value!=b['reg[password2]'].value)) {errtxt+='Heslo a jeho opakování se neshodují.\n';}
  if (b['reg[person][0][firstname][0]'].value.length<2) {errtxt+='Vyplňte prosím jméno.\n';}
  if (b['reg[person][0][lastname][0]'].value.length<2) {errtxt+='Vyplňte prosím příjmení.\n';}
  if (b['reg[person][0][email][0]'].value.length<2) {errtxt+='Vyplňte prosím e-mail.\n';}
  if (b['reg[person][0][mobil][0]'].value.length<9) {errtxt+='Vyplňte prosím telefonní číslo.\n';}
  if (b['reg[shipaddr][0][street][0]'].value.length<2) {errtxt+='Vyplňte prosím ulici dodací adresy.\n';}
  if (b['reg[shipaddr][0][city][0]'].value.length<2) {errtxt+='Vyplňte prosím město dodací adresy.\n';}
  if (b['reg[shipaddr][0][zip][0]'].value.length<2) {errtxt+='Vyplňte prosím PSČ dodací adresy.\n';}
  if (b['reg[billaddr][0][street][0]'].value.length<2) {errtxt+='Vyplňte prosím ulici fakturační adresy.\n';}
  if (b['reg[billaddr][0][city][0]'].value.length<2) {errtxt+='Vyplňte prosím město fakturační adresy.\n';}
  if (b['reg[billaddr][0][zip][0]'].value.length<2) {errtxt+='Vyplňte prosím PSČ fakturační adresy.\n';}


  if (errtxt>'') {
    window.alert(errtxt);	
  } else {	
    b.submit();	
  }	
}	

function nastav() {
  errtxt='';
  b=document.nastaveni;
  if (b['reg[password]'].value.length<4) {errtxt+='Pro změnu údajů musíte zadat heslo.\n';}
  if ((b['reg[password2]'].value.length>0)&&(b['reg[password2]'].value!=b['reg[password3]'].value)) {errtxt+='Nové heslo a jeho opakování se neshodují.\n';}
  if ((b['reg[password2]'].value.length>0)&&(b['reg[password2]'].value.length<4)) {errtxt+='I nové heslo musí mít alespoň 4 znaky.\n';}
  if (b['reg[person][0][firstname][0]'].value.length<2) {errtxt+='Vyplňte prosím jméno.\n';}
  if (b['reg[person][0][lastname][0]'].value.length<2) {errtxt+='Vyplňte prosím příjmení.\n';}
  if (b['reg[person][0][email][0]'].value.length<2) {errtxt+='Vyplňte prosím e-mail.\n';}
  if (b['reg[person][0][mobil][0]'].value.length<9) {errtxt+='Vyplňte prosím telefonní číslo.\n';}
  if (b['reg[shipaddr][0][street][0]'].value.length<2) {errtxt+='Vyplňte prosím ulici dodací adresy.\n';}
  if (b['reg[shipaddr][0][city][0]'].value.length<2) {errtxt+='Vyplňte prosím město dodací adresy.\n';}
  if (b['reg[shipaddr][0][zip][0]'].value.length<2) {errtxt+='Vyplňte prosím PSČ dodací adresy.\n';}
  if (b['reg[billaddr][0][street][0]'].value.length<2) {errtxt+='Vyplňte prosím ulici fakturační adresy.\n';}
  if (b['reg[billaddr][0][city][0]'].value.length<2) {errtxt+='Vyplňte prosím město fakturační adresy.\n';}
  if (b['reg[billaddr][0][zip][0]'].value.length<2) {errtxt+='Vyplňte prosím PSČ fakturační adresy.\n';}


  if (errtxt>'') {
    window.alert(errtxt);	
  } else {	
    b.submit();	
  }	
}

function tiskobj(x) {
  window.open("tiskobjednavky-"+x,"tiskobjednavky"+x,"width=700,height=700,menubar=no,resizable=no,scrollbars=yes");
}	

function tiskfakt(x) {
  window.open("faktura-"+x,"tiskfakt"+x);
}	
function tiskzall(x) {
  window.open("zalohovylist-"+x,"tiskzall"+x);
}	

function galerie(URL,pic) {
  window.open('http:'+URL+'::'+pic,"galery","width=657,height=600,menubar=no,resizable=no,scrollbars=no");
}	

selid='nicnebude';
npage=0;
galdir='galery';
galimgdir='img';

function galgetselpos() {
  j=0;
  while ((j<pics.length)&&(pics[j]!=selid)) j++;
  return j;
}	

function galredraw() {
  for (i=0;i<7;i++) {
    o=document.getElementById('gli'+(i+1));
    if ((i+npage*7)>=pics.length) {
      o.src=galimgdir+'/nogalery.gif';	
      o.className='glthimg0';    
    } else {
      if ((i+npage*7)!=galgetselpos()) {
        o.className='glthimg0';    
      } else {
        o.className='glthimg2';    
      }
      o.src=galdir+'/mini/'+pics[i+npage*7];;
    }	
    if ((npage*7+1)==pics.length) {
      txt=(npage*7+1);
    } else {
      txt=(npage*7+1)+' - ';
      if (pics.length>=(npage+1)*7) {
       txt=txt+(npage+1)*7;
      } else {
       txt=txt+pics.length;
      }	 	
    }  
    txt=txt+' / '+pics.length;
    document.kde.jsem.value=txt;
  }	
  if (npage==0) {
    o=document.getElementById('pg1');
    o.className='glnone';
    o=document.getElementById('pg2');
    o.className='glnone';
  } else {
    o=document.getElementById('pg1');
    o.className='pageb0';
    o=document.getElementById('pg2');
    o.className='pagem0';
  }
  if ((npage+1)*7<pics.length) {
    o=document.getElementById('pg3');
    o.className='pagep0';
    o=document.getElementById('pg4');
    o.className='pagee0';
  } else {
    o=document.getElementById('pg3');
    o.className='glnone';
    o=document.getElementById('pg4');
    o.className='glnone';
  }
}
function gls(x) {
  o=document.getElementById('mainpic');
  if ((x+npage*7-1)<pics.length) {
    selid=pics[x+npage*7-1];
    o.src=galdir+'/full/'+selid;
    galredraw();
  }  
}
function gmo(x) {
  if (((x+npage*7)!=(galgetselpos()+1))&&((x+npage*7)<=pics.length)) {
    o=document.getElementById('gli'+x);
    o.className='glthimg1';    
  }	
}
function gut(x) {
  if (((x+npage*7)!=(galgetselpos()+1))&&((x+npage*7)<=pics.length)) {
    o=document.getElementById('gli'+x);
    o.className='glthimg0';    
  }	
} 
function stchl(a,b) {
  if (npage>0) stch(a,b);	
}	
function stchr(a,b) {
  if ((npage+1)*7<pics.length) stch(a,b);	
}

function glpage(x) {
  if (x=='b') npage=0;
  if (x=='m') npage--;
  if (x=='p') npage++;
  if (x=='e') npage=999;
  if (npage>Math.floor(pics.length/7+0.99999)-1)  npage=Math.floor(pics.length/7+0.99999)-1;
  if (npage<0) npage=0;
  galredraw();
}


function copyadr() {
  b=document.adresy;
  b.blsalutation.value=b.shsalutation.value;
  b.blstreet.value=b.shstreet.value;
  b.blcity.value=b.shcity.value;
  b.blzip.value=b.shzip.value;
}

function copyadr2(x) {
  if (x==1) {
    b=document.registrace;
  } else {  
    b=document.nastaveni;
  }  
  b['reg[billaddr][0][salutation][0]'].value=b['reg[shipaddr][0][salutation][0]'].value;
  b['reg[billaddr][0][street][0]'].value=b['reg[shipaddr][0][street][0]'].value;
  b['reg[billaddr][0][city][0]'].value=b['reg[shipaddr][0][city][0]'].value;
  b['reg[billaddr][0][zip][0]'].value=b['reg[shipaddr][0][zip][0]'].value;
}

function vycph() {
  b=document.podrobne;
  b['srch[0][czechname][0]'].value='';
  b['srch[0][srchdirector][0]'].value='';
  b['srch[0][yearfrom][0]'].value='';
  b['srch[0][yearto][0]'].value='';
  b['srch[0][originalname][0]'].value='';
  b['srch[0][srchactor][0]'].value='';
  b['srch[0][pricefrom][0]'].value='';
  b['srch[0][priceto][0]'].value='';
  b['srch[0][fulltext][0]'].value='';
}

function vycphps() {
  b=document.podrobne;
  b['srch[0][srchname][0]'].value='';
  b['srch[0][yearfrom][0]'].value='';
  b['srch[0][yearto][0]'].value='';
  b['srch[0][pricefrom][0]'].value='';
  b['srch[0][priceto][0]'].value='';
  b['srch[0][fulltext][0]'].value='';
  b['srch[0][ps2][0]'].checked=true;
  b['srch[0][ps3][0]'].checked=true;
  b['srch[0][psp][0]'].checked=true;
}

function vycphnin() {
  b=document.podrobne;
  b['srch[0][srchname][0]'].value='';
  b['srch[0][yearfrom][0]'].value='';
  b['srch[0][yearto][0]'].value='';
  b['srch[0][pricefrom][0]'].value='';
  b['srch[0][priceto][0]'].value='';
  b['srch[0][fulltext][0]'].value='';
  b['srch[0][ntvii][0]'].checked=true;
  b['srch[0][ntds][0]'].checked=true;
  b['srch[0][ntgc][0]'].checked=true;
  b['srch[0][ntgb][0]'].checked=true;
}

function vycphpcp() {
  b=document.podrobne;
  b['srch[0][srchname][0]'].value='';
  b['srch[0][yearfrom][0]'].value='';
  b['srch[0][yearto][0]'].value='';
  b['srch[0][pricefrom][0]'].value='';
  b['srch[0][priceto][0]'].value='';
  b['srch[0][fulltext][0]'].value='';
}

function vycphel() {
  b=document.podrobne;
  b['srch[0][srchname][0]'].value='';
  b['srch[0][producer][0]'].value='';
  b['srch[0][pricefrom][0]'].value='';
  b['srch[0][priceto][0]'].value='';
  b['srch[0][fulltext][0]'].value='';
}


selelmenu=0;

function id2index(x) {
  k=0;
  while ((k<lmcnt)&&(lmx[k]!=x)) k++;
  return k;
}	

function haschildren(x) {
  k=0;
  while ((k<lmcnt)&&(lmpr[k]!=x)) k++;
  return (k<lmcnt);
}	


function isparent(u,p) {
// u je vnukem,synem p
  if (u==p) return true;
  while (u!=0) {
    n=id2index(u);
    if (lmpr[n]==p) return true;
    u=lmpr[n];
  }
  return false;  
}	

function isbrother(x,b) {
  m=id2index(x);
  n=id2index(b);
  return (lmpr[m]==lmpr[n]);
}	

function seltreemenu(x) {
  for (i=0;i<lmcnt;i++) {
    o=document.getElementById('lmnx'+lmx[i]);
    if (lmdp[i]!=0) {
      o.style.display='none';
    } else {
      o.style.display='block';
      o=document.getElementById('lmny'+lmx[i]);
      if (haschildren(lmx[i])) {
        o.className='lmp0';
      } else {
        o.className='lmz';
      }	
    }			
  }	
  if (id2index(x)==lmcnt) x=0;
  y=x;
  while (y!=0) {
    j=id2index(y);
    if (j==lmcnt) {
      x=0;
    } else {
      o=document.getElementById('lmnx'+lmx[j]);
      o.style.display='block';
      o=document.getElementById('lmny'+lmx[j]);
      if (haschildren(lmx[j])) {
        o.className='lmm0';
      } else {
        o.className='lmz';
      }	  
      // primi potomci
      for (i=0;i<lmcnt;i++) {
        if (lmpr[i]==y) {
          o=document.getElementById('lmnx'+lmx[i]);
          o.style.display='block';
          o=document.getElementById('lmny'+lmx[i]);
          if (haschildren(lmx[i])) {
            if (isparent(x,lmx[i])) {	
              o.className='lmm0';
            } else {  
              o.className='lmp0';
            }  
          } else {  
            o.className='lmz';
          }  
        }		
      }	
      y=lmpr[j];      
    }			
  }	
}	

function znovr(x) {
  o=document.getElementById('lmny'+x);
  if (o.className=='lmp0') {
    o.className='lmp1';
  };
  if (o.className=='lmm0') {
    o.className='lmm1';
  }  
}
function znout(x) {
  o=document.getElementById('lmny'+x);
  if (o.className=='lmp1') {
    o.className='lmp0';
  };
  if (o.className=='lmm1') {
    o.className='lmm0';
  }  
}
function znclk(x) {  	
  o=document.getElementById('lmny'+x);
  if (o.className!='lmz') {
    if ((o.className!='lmp0')&&(o.className!='lmp1')) {
      if (x!=0) x=lmpr[id2index(x)];	
    }	 
    seltreemenu(x);
  }    	
}

function eclk(URL) {
  document.location=URL;
}

function otelimg(x,w,h) {
  o=window.open('elektroobrazek.php?obr='+x+'&amp;w='+w+'&amp;h='+h,'elimg','width='+w+',height='+h+',menubar=no,scrollbars=no,resizable=no');	
}	
function otoutimg(x,w,h) {
  o=window.open('outdoorobrazek.php?obr='+x+'&amp;w='+w+'&amp;h='+h,'elimg','width='+w+',height='+h+',menubar=no,scrollbars=no,resizable=no');	
}	
function othobimg(x,w,h) {
  o=window.open('hobbyobrazek.php?obr='+x+'&amp;w='+w+'&amp;h='+h,'elimg','width='+w+',height='+h+',menubar=no,scrollbars=no,resizable=no');	
}	
function ottoyimg(x,w,h) {
  o=window.open('toyobrazek.php?obr='+x+'&amp;w='+w+'&amp;h='+h,'elimg','width='+w+',height='+h+',menubar=no,scrollbars=no,resizable=no');	
}	


function id22index(x) {
  k=0;
  while ((k<lm2cnt)&&(lm2x[k]!=x)) k++;
  return k;
}	

function has2children(x) {
  k=0;
  while ((k<lm2cnt)&&(lm2pr[k]!=x)) k++;
  return (k<lm2cnt);
}	


function is2parent(u,p) {
// u je vnukem,synem p
  if (u==p) return true;
  while (u!=0) {
    n=id22index(u);
    if (lm2pr[n]==p) return true;
    u=lm2pr[n];
  }
  return false;  
}	

function is2brother(x,b) {
  m=id22index(x);
  n=id22index(b);
  return (lm2pr[m]==lm2pr[n]);
}	


function sel2treemenu(x) {
  for (i=0;i<lm2cnt;i++) {
    o=document.getElementById('lm2nx'+lm2x[i]);
    if (lm2dp[i]!=0) {
      o.style.display='none';
     } else {
      o.style.display='block';
      o=document.getElementById('lm2ny'+lm2x[i]);
      if (has2children(lm2x[i])) {
        o.className='lmp0';
      } else {
        o.className='lmz';
      }	
    }			
  }	
  if (id22index(x)==lm2cnt) x=0;
  y=x;
  while (y!=0) {
    j=id22index(y);
    if (j==lm2cnt) {
      x=0;
    } else {
      o=document.getElementById('lm2nx'+lm2x[j]);
      o.style.display='block';
      o=document.getElementById('lm2ny'+lm2x[j]);
      o.className='lmm0';
      // primi potomci
      for (i=0;i<lm2cnt;i++) {
        if (lm2pr[i]==y) {
          o=document.getElementById('lm2nx'+lm2x[i]);
          o.style.display='block';
          o=document.getElementById('lm2ny'+lm2x[i]);
          if (has2children(lm2x[i])) {
            if (is2parent(x,lm2x[i])) {	
              o.className='lmm0';
            } else {  
              o.className='lmp0';
            }  
          } else {  
            o.className='lmz';
          }  
        }		
      }	
      y=lm2pr[j];      
    }			
  }	
}

function zn2ovr(x) {
  o=document.getElementById('lm2ny'+x);
  if (o.className=='lmp0') {
    o.className='lmp1';
  };
  if (o.className=='lmm0') {
    o.className='lmm1';
  }  
}
function zn2out(x) {
  o=document.getElementById('lm2ny'+x);
  if (o.className=='lmp1') {
    o.className='lmp0';
  };
  if (o.className=='lmm1') {
    o.className='lmm0';
  }  
}
function zn2clk(x) {  	
  o=document.getElementById('lm2ny'+x);
  if (o.className!='lmz') {
    if ((o.className!='lmp0')&&(o.className!='lmp1')) {
      if (x!=0) x=lm2pr[id22index(x)];	
    }	 
    sel2treemenu(x);
  }    	
}
function ostrsel(x) {
  if (x==-1) {
    x=0;
    if ((selelmenu>0)&&(id22index(selelmenu)<lm2cnt)) {
      x=1;
    }  
  }	
  lmx1=document.getElementById('menutype');
  lmx2=document.getElementById('menuproducer');
  if (x==0) {
    lmx1.style.display='block';
    lmx2.style.display='none';
  } else {
    lmx1.style.display='none';
    lmx2.style.display='block';
  }
}	
