function stOP(ev)
{

if(!document.all)
 {
 ev.stopPropagation();
 el=ev.target;
 }
 else
 {
 event.cancelBubble=true;
 el=event.srcElement;
 }
if(el.className=="open")
   {
   el.className="closed"
   return;
   }
if(el.className=="closed")
   {
   el.className="open"
   
   return;
   }

}
function setSbal()
{
myLis=document.getElementsByTagName('li');
var c=0;
for(i=0;i<myLis.length;i++)
 {
  if(myLis[i].className=='open' || myLis[i].className=='closed' )
    {
 if (window.addEventListener)
    {
    myLis[i].addEventListener("click", stOP, false); 
    
    }
  else
    {
    myLis[i].attachEvent("onclick",stOP); 
    c =c +1
    }
    
    }
 
 }

}
function revriteMail(el)
{
 mystr=el.href
 mystrA=mystr.split('(a)');
 el.href=mystrA[0]+'@'+mystrA[1];
 return true
 
}
function setBorder(el,nr)
{
 if(nr==1)
   {
   el.style.borderColor="white";
   el.style.cursor="pointer";
   }
   else
   {
    el.style.borderColor="black";
    
   }
}
function clickTD(el)
{
 if(el.tagName!='TD')return false;
 myA= el.getElementsByTagName('A') 
 if(myA.length<1)return false;
 myPth=myA[0].href;
 location.href=myPth;
}
function clickDiv(el)
{
 if(el.tagName!='DIV')return false;
 myA= el.getElementsByTagName('A') 
 if(myA.length<1)return false;
 myPth=myA[0].href;
 location.href=myPth;
}
function GoOBR2(el)
{
myPATH= el.href
//alert(myPATH)
//return false
self.name="togot";
feath="resizable=1,width=200,height=200,location=0,directories=0,toolbar=0,menubar=0,status=1,dependent=1,scrollbars=1"
myM=window.open(myPATH,"OBRGAL",feath)
if(myM)myM.focus();
myM=!myM
return myM
}
function OpenWin(el)
{
myPATH= el.href
//alert(myPATH)
//return false
self.name="togot";
feath="resizable=1,width=500,height=400,location=0,directories=0,toolbar=0,menubar=0,status=0,dependent=1,scrollbars=1"
myM=window.open(myPATH,"DETWIN",feath)
if(myM)myM.focus();
myM=!myM
return myM
}
function svTM(el,nr)
{
 if(nr==1)
  {
   el.className='tablemenuA';
   
  }
else
  {
   el.className='tablemenu';
   
  }
 
}
function ReCountFl(pol,el,toid)
{
 pocet=parseInt(el.value)
 cena=parseFloat(pol)*pocet
 //alert(cena);
 document.getElementById('toid').value=cena;
 
}
function confirmSendOrd(el)
{
  //PR,KS
  ks=parseInt(document.getElementById('KS').value);
  //alert(ks);
  cn=parseFloat(document.getElementById('PR').value);
  vysl=ks*cn
  document.getElementById('toid').value=vysl;
  myF=confirm('Chci objednat - '+ ks +' ks zboží o celkové ceně ' +  vysl + '!')
  if(!myF)return false;
  el.form.submit();
  
}

function setTR(el,nr)
{
if(nr==1)
  {
    if(!document.all)
      {
      el.setAttribute("oldClass",el.className);
      el.setAttribute("class","trActiv");
      
      }
      else
      {
      el.oldClass=el.className;
      el.className="trActiv";
      
      }
   }   
else
  {
    if(!document.all)
      {
      myClass=el.getAttribute("oldClass");
      el.setAttribute("class",myClass);
      }
    else
      {
      myClass=el.oldClass;
      el.className=myClass;
      }
  
  }
}
function confirmDel(el)
{
  //PR,KS
  ks=parseInt(document.getElementById('KS').value);
  //alert(ks);
  cn=parseFloat(document.getElementById('PR').value);
  vysl=ks*cn
  document.getElementById('toid').value=vysl;
  myF=confirm('Skutečně chcete smazat vybraný záznam?')
  return myF;
  
  
}
function checkImageInA(imgName,nr,el)
{
 switchPath='http://'+ location.hostname +'/alff/';
 if(el.tagName!='A')return false
 myEl=el.getElementsByTagName('img');
 //alert(myEl.length)
 myEl[0].src= switchPath + 'new_ico/' + imgName + nr + '.gif';
}
function swpCTYP(el)
{
 if(el.value==0)
  {
   document.getElementById('fyob').style.display="";
   document.getElementById('prob').style.display="none";
  }
 else
  {
   document.getElementById('fyob').style.display="none";
   document.getElementById('prob').style.display="";
  }
 
}
function kontrola(frm)
{
//if (EregI("^[a-z0-9]+[a-z0-9\._-]*[a-z0-9]+@[a-z0-9]+[a-z0-9\._-]*[a-z0-9]+\.[a-z]{2,3}$", $adresa) && !EregI("\.{2,}", $adresa) && !EregI("_{2,}", $adresa) && !EregI("-{2,}", $adresa) ):
var r=new RegExp("^[a-z0-9]+[a-z0-9\._-]*[a-z0-9]+@[a-z0-9]+[a-z0-9\._-]*[a-z0-9]+\.[a-z]{2,3}$","i");
mymail=document.getElementById('mail').value
if(mymail=='')
  {
  alert('pole adresa je nutno vyplnit')
  return false;
  }
ino=r.test(mymail)
if(!ino)
 {
 alert('pole adresa musí obsahovat platnou adresu elektronické pošty')
 return false;
 }
mynick=document.getElementById('nick').value
  if(mynick=='')
  {
  alert('Takhle by to nešlo, alespoň přezdívku prosím!')
  return false;
  }
mytelo=document.getElementById('telo').value
  if(mytelo=='')
  {
  alert('Něco napiš než to pošleš')
  return false;
  }
frm.submit();
}
function swD(nr)
{
if(nr==1)
  {
  document.getElementById('proo').style.display='none';
  document.getElementById('pridat').style.display='';
  
  }
  else
  {
  document.getElementById('pridat').style.display='none';
  document.getElementById('proo').style.display='';
  }
}
function myConfirm(zprava)
{
var myStr="Vybral jste příkaz "+zprava+"!";
    myStr+="\n Mám pokračovat?"
    myVal= window.confirm(myStr)
    return myVal;
}
function goNasept(ev,myid)
{
var oScript = document.createElement('script');
oScript.setAttribute('type','text/javascript');
oScript.setAttribute('src','my_lbr/desc_add.php?DID='+myid);
document.getElementById('nasept').appendChild(oScript);
ShowY(ev);
}

  function ShowY(ev)
  {
    
    if(!window.addEventListener)
       {
       el=event.srcElement
       if(el.tagName!='SPAN')return false
       myy=event.clientY
       myx=event.clientX
       }
       else
       {
       el=ev.target
       if(el.tagName!='SPAN')return false
       myy=ev.pageY
       myx=ev.pageX
       }
       
       
       myx=myx+30;
       myy=myy-100;
       if(myx<0)myx=10
       mydiv=document.getElementById('nasept')
       mydiv.style.left=myx+'px';
       mydiv.style.top=myy+'px';
       mydiv.style.display='block';
  }
function hideNasept()
{
 mydiv=document.getElementById('nasept')
 mydiv.style.display='none';
}
function setNasept(result)
{
document.getElementById('nst').innerHTML=result;
}
function setHlist()
{
if(!document.getElementById('hlist'))
  {
  return false
  
  }
  else
  {
  myH2=document.getElementsByTagName('H2')
  myOut='';
  for (i=0;i<myH2.length;i++)
    {
    myH2[i].id='mhl'+i;
    myOut=myOut+'<li><a href="#'+myH2[i].id+'" class="mhlist">'+myH2[i].firstChild.data+'</a></li>';
    dt=myH2[i].firstChild.data;
    dt=document.createElement('A');
    dt.href='#hlist';
    dt.title='zpět na obsah';
    dt.innerHTML='<span style="background:transparent;padding:1px 3px 1px 3px;color:white;font-weight:bold">&uarr;</span>';
    dt.style.fontSize='10px';
    dt.className='mhplist'
    myH2[i].appendChild(dt);
    }
    if(myOut!='')
    {
    //myOut='<ul>'+myOut+'</ul>';
    myUL=document.createElement("UL");
    myUL.innerHTML=myOut;
    document.getElementById('hlist').appendChild(myUL);
    }
  }
  return false;
}
function setC(el) {
val=el.options[el.selectedIndex].value;
var name="l4";
   document.cookie = name + "=" + escape(val)
   + (";expires=01 Jan 2050 00:00:00 GMT")
   + ";site="+ location.hostname+";path=/;";
  /*  var ckname= name + "=" +value 
   + ((expire == null) ? ";expires=01 Jan 2050 00:00:00 GMT;" : ("; expires=" + expire.toGMTString()))
   + "path=/;";
   document.cookie = escape(ckname);*/
document.location.reload();   
}
function morepolShow(myid)
{
myDiv=document.getElementById(myid);
displayed=myDiv.style.display;
if(displayed=='none')
   {   
	 myDiv.style.display="block";
	 } 
else
   {
	 myDiv.style.display="none";
	 }
}