// JavaScript Document
ns4 = document.layers
ie = document.all 
ie4 = document.all 
nn6 = document.getElementById && !document.all 

 function zmena()
		  {
		    if(document.form.rada.checked)
		    {
		    var idZ=document.form.id_zakaznik.value;
		    stahniData(idZ);
		     }
		    else
		    {
		    stahniData();
		    }
		    setTimeout('brzda()',50);
        }
      
      function stahniData(idZ)
      {
        script = document.createElement('script');
        if(idZ)
        { script.src = 'file/urceniCisla.php?rada=V&idZ='+idZ+'&r='+Math.random(); }
        else  
        {
        script.src = 'file/urceniCisla.php?rada=N&r='+Math.random();
         }
        x = document.getElementsByTagName('head')[0];
       	x.appendChild(script);
       	return false;
      }
      
      function brzda()
      { ks=document.form.pocet_ks.value;
		    cislo1=document.form.ciselna_rada1.value;
		    document.form.ciselna_rada2.value=parseInt(ks) + parseInt(cislo1)-1; }
      
      function kontrolaZ(kon, name)
      { 
        if(kon.length==15)
        {
        c=name.substring(2);
        idN='rf'+(parseInt(c)+1);
        
          //if(document.form.ks.value>=(parseInt(c)+1))
          //{
            document.getElementById(idN).focus();
          //document.form.item(idN).focus();
          //}
        }
      }    
     function kontrolaVystupu (kon, name)
     {
     if(kon.length==15)
        {
        c=name.substring(3);
        idN='rf'+parseInt(c);
        idNew='Krf'+(parseInt(c)+1);
        idOK='OK'+parseInt(c);
        
        
          if(document.getElementById(name).value==document.getElementById(idN).value)
          {
            document.getElementById(idOK).innerHTML='OK';
            if(document.form.pocet_ks.value>=(parseInt(c)+1))
            {
            document.getElementById(idNew).focus();
            }
          }
          else
          {
            document.getElementById(idOK).innerHTML='<span>NE</span>';
            if(document.form.pocet_ks.value>=(parseInt(c)+1))
            {
            document.getElementById(idNew).focus();
            }
          }
          
        } 
     }
     
     
 function hideObject(id) {
   if (ns4) {
      document.id.visibility = "hide";
   }
   else if (ie4) {
      document.getElementById(id).style.visibility = "hidden";
   }
   else if (nn6) {
      document.getElementById(id).style.visibility = "hidden";
   }
}

// Show/Hide functions for pointer objects

function showObject(id) {
   if (ns4) {
      document.id.visibility = "show";
   }
   else if (ie4) {
      document.getElementById(id).style.visibility = "visible";
   }
   else if (nn6) {
      document.getElementById(id).style.visibility = "visible";
   }
}
