function getbyid(object) {return document.getElementById(object);}
window.onload = init;
function init()
{
 if(getbyid("schovavany"))
 {
  if(getbyid("zaslat0").checked)
   schovej();
 }
}
function schovej() {getbyid("schovavany").style.display="none";}
function ukaz() {getbyid("schovavany").style.display="block";}


function kontrola2()
{

 var chyba = 0;
 var error = "";
 if(getbyid("kname").value=="")
 {
  if(chyba==0) getbyid("kname").focus();
  getbyid("kname").style.backgroundColor="red";
  chyba=1;
  error= error + "Musíte vyplnit kontaktní jméno\n";
 }else {getbyid("kname").style.backgroundColor="white";}


 if(getbyid("kemail").value=="")
 {
  if(chyba==0) getbyid("kemail").focus();
  getbyid("kemail").style.backgroundColor="red";
  chyba=1;
  error= error + "Musíte vyplnit kontaktní email\n";
 }else {getbyid("kemail").style.backgroundColor="white";}
 
 if(getbyid("ktelefon").value=="")
 {
  if(chyba==0) getbyid("ktelefon").focus();
  getbyid("ktelefon").style.backgroundColor="red";
  chyba=1;
  error= error + "Musíte vyplnit kontaktní telefon\n";
 }else {getbyid("ktelefon").style.backgroundColor="white";}

 if(getbyid("ico").value=="")
 {
  if(chyba==0) getbyid("ico").focus();
  getbyid("ico").style.backgroundColor="red";
  chyba=1;
  error= error + "Musíte vyplnit IČO\n";
 }else {getbyid("ico").style.backgroundColor="white";}


  var delka = getbyid("heslo").value;
  if(delka.length < 5)
  {
   getbyid("heslo").style.backgroundColor="red";
   if(chyba==0) getbyid("heslo").focus();
   chyba=1;
   error= error + "Heslo musí mít minimálně 5 znaků\n";
  }else {getbyid("heslo").style.backgroundColor="white";}

  if(getbyid("heslo").value != getbyid("oheslo").value)
 {
  if(chyba==0) getbyid("heslo").focus();
  getbyid("heslo").style.backgroundColor="red";
  getbyid("oheslo").style.backgroundColor="red";
  chyba=1;
  error= error + "Hesla se musí shodovat\n";
 }else {if(!(delka.length < 5)) getbyid("heslo").style.backgroundColor="white"; getbyid("oheslo").style.backgroundColor="white";}

 if(chyba != 0)
 {
 alert(error);
 return false;
 }
 
}


function kontrola3()
{
 var chyba = 0;
 error= "Prosím vyplňte jestě:\n";

 if(getbyid("nazev").value=="")
 {
  if(chyba==0) getbyid("nazev").focus();
  getbyid("nazev").style.backgroundColor="red";
  chyba=1;
  error= error + "- název společnosti\n";
 }else {getbyid("nazev").style.backgroundColor="white";}

  if(getbyid("obor").value=="")
 {
  if(chyba==0) getbyid("obor").focus();
  getbyid("obor").style.backgroundColor="red";
  chyba=1;
  error= error + "- obor činnosti\n";
 }else {getbyid("obor").style.backgroundColor="white";}



 if(getbyid("ulice").value=="")
 {
  if(chyba==0) getbyid("ulice").focus();
  getbyid("ulice").style.backgroundColor="red";
  chyba=1;
  error= error + "- ulici ve které sídlí společnost\n";
 }else {getbyid("ulice").style.backgroundColor="white";}

  if(getbyid("mesto").value=="")
 {
  if(chyba==0) getbyid("mesto").focus();
  getbyid("mesto").style.backgroundColor="red";
  chyba=1;
  error= error + "- město ve kterém sídlí společnost\n";
 }else {getbyid("mesto").style.backgroundColor="white";}

  if(getbyid("psc").value=="")
 {
  if(chyba==0) getbyid("psc").focus();
  getbyid("psc").style.backgroundColor="red";
  chyba=1;
  error= error + "- PSČ města ve kterém sídlí společnost\n";
 }else {getbyid("psc").style.backgroundColor="white";}

  if(getbyid("ico").value=="")
 {
  if(chyba==0) getbyid("ico").focus();
  getbyid("ico").style.backgroundColor="red";
  chyba=1;
  error= error + "- IČO společnosti\n";
 }else {getbyid("ico").style.backgroundColor="white";}

 if(getbyid("zaslat1").checked)
 {
  if(getbyid("faknazev").value=="")
  {
   if(chyba==0) getbyid("faknazev").focus();
   getbyid("faknazev").style.backgroundColor="red";
   chyba=1;
   error= error + "- Název společnosti (Faktura)\n";
  }else {getbyid("faknazev").style.backgroundColor="white";}

  if(getbyid("fakmesto").value=="")
  {
   if(chyba==0) getbyid("fakmesto").focus();
   getbyid("fakmesto").style.backgroundColor="red";
   chyba=1;
   error= error + "- město ve kterém sídlí společnost (Faktura)\n";
  }else {getbyid("fakmesto").style.backgroundColor="white";}

  if(getbyid("fakulice").value=="")
  {
   if(chyba==0) getbyid("fakulice").focus();
   getbyid("fakulice").style.backgroundColor="red";
   chyba=1;
   error= error + "- ulice ve které sídlí společnost (Faktura)\n";
  }else {getbyid("fakulice").style.backgroundColor="white";}

    if(getbyid("fakpsc").value=="")
  {
   if(chyba==0) getbyid("fakpsc").focus();
   getbyid("fakpsc").style.backgroundColor="red";
   chyba=1;
   error= error + "- PSČ města ve kterém sídlí společnost (Faktura)\n";
  }else {getbyid("fakpsc").style.backgroundColor="white";}


 }

  if(getbyid("kjmeno").value=="")
 {
  if(chyba==0) getbyid("kjmeno").focus();
  getbyid("kjmeno").style.backgroundColor="red";
  chyba=1;
  error= error + "- kontaktní jméno\n";
 }else {getbyid("kjmeno").style.backgroundColor="white";}

  if(getbyid("kprijmeni").value=="")
 {
  if(chyba==0) getbyid("kprijmeni").focus();
  getbyid("kprijmeni").style.backgroundColor="red";
  chyba=1;
  error= error + "- kontaktní příjmení\n";
 }else {getbyid("kprijmeni").style.backgroundColor="white";}

  if(getbyid("kmail").value=="")
 {
  if(chyba==0) getbyid("kmail").focus();
  getbyid("kmail").style.backgroundColor="red";
  chyba=1;
  error= error + "- kontaktní email\n";
 }else {getbyid("kmail").style.backgroundColor="white";}

 if(!getbyid("platba0").checked && !getbyid("platba1").checked)
 {
  if(chyba==0) getbyid("platba0").focus();
  getbyid("plat").style.color="red";
  chyba=1;
  error=error + "- zvolte způsob platby\n";
 }else {getbyid("plat").style.color="black";}

 if(chyba != 0)
 {
 alert(error);
 return false;
 }
}


function kontrola()
{ 
 var chyba = 0;
 error= "";

 if(getbyid("meno_firmy").value=="")
 {
  if(chyba==0) getbyid("meno_firmy").focus();
  getbyid("meno_firmy").style.backgroundColor="red";
  chyba=1;
  error="Musíte vyplnit jméno firmy\n";
 }else {getbyid("meno_firmy").style.backgroundColor="white";}
 

 if(getbyid("street").value=="")
 {
  if(chyba==0) getbyid("street").focus();
  getbyid("street").style.backgroundColor="red";
  chyba=1;
  error= error + "Musíte vyplnit ulici\n";
 }else {getbyid("street").style.backgroundColor="white";}


 if(getbyid("psc").value=="")
 {
  if(chyba==0) getbyid("psc").focus();
  getbyid("psc").style.backgroundColor="red";
  chyba=1;
  error= error + "Musíte vyplnit PSČ\n";
 }else {getbyid("psc").style.backgroundColor="white";}


 if(getbyid("town").value=="")
 {
  if(chyba==0) getbyid("town").focus();
  getbyid("town").style.backgroundColor="red";
  chyba=1;
  error= error + "Musíte vyplnit Město\n";
 }else {getbyid("town").style.backgroundColor="white";}


 box = getbyid("cate");
 if(box.options[box.selectedIndex].value == "0")
 {
  if(chyba==0) getbyid("cate").focus();
  getbyid("cate").style.backgroundColor="red";
  chyba=1;
  error= error + "Musíte vybrat categorii\n";
 }else {getbyid("cate").style.backgroundColor="white";}

 if(chyba != 0)
 {
 alert(error);  
 return false;
 }

}

