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;
}
