function echeck(str) 
     {
  		var at="@"
  		var dot="."
  		var lat=str.indexOf(at)
  		var lstr=str.length
  		var ldot=str.indexOf(dot)
  		if (str.indexOf(at)==-1){
  		   alert("Nesprávný formát emailové adresy.")
  		   return false
  		}
  
  		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
  		   alert("Nesprávný formát emailové adresy.")
  		   return false
  		}
  
  		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
  		    alert("Nesprávný formát emailové adresy.")
  		    return false
  		}
  
  		 if (str.indexOf(at,(lat+1))!=-1){
  		    alert("Nesprávný formát emailové adresy.")
  		    return false
  		 }
  
  		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
  		    alert("Nesprávný formát emailové adresy.")
  		    return false
  		 }
  
  		 if (str.indexOf(dot,(lat+2))==-1){
  		    alert("Nesprávný formát emailové adresy.")
  		    return false
  		 }
  		
  		 if (str.indexOf(" ")!=-1){
  		    alert("Nesprávný formát emailové adresy.")
  		    return false
  		 }
  
   		 return true					
  	}
     
     function validate_email(formular) 
     {
     
       form = formular;
       
       if (form.email.value == "")
       {
         alert('Zadejte e-mail.');
         return false; 
       }
       else if (echeck(form.email.value) == false)
       {
            return false;
       }
       
       form.submit();
       return true;
     }
     
     function zobrazJinyTyp(el) {
     
      if (el.value == "5") {
        document.zadost_o_opravu.jine_zarizeni.style.visibility = "visible";
      }
      else {        
        document.zadost_o_opravu.jine_zarizeni.style.visibility = "hidden";
      }
    }
    
    function zobrazJinehoVyrobce(el) {
      if (el.value == "7") {
        document.zadost_o_opravu.jiny_vyrobce.style.visibility = "visible";
      }
      else {        
        document.zadost_o_opravu.jiny_vyrobce.style.visibility = "hidden";
      }
    }
     function checkDate(date){
    	re = new RegExp("0?[1-9]|[12][0-9]|3[01]\. ?0?[1-9]|1[0-2]\. ?(19|20)[0-9]{2}"); 
    	if (!re.test(date)) { 
    		return false; 
    	} 
      return true;
    }
    
    function Verify() {
      if (document.zadost_o_opravu.zarizeni.value == "jine" && document.zadost_o_opravu.jine_zarizeni.value == "") {
        document.zadost_o_opravu.jine_zarizeni.focus();
        alert("Doplňte typ zařízení.");
        return false;
      }
      if (document.zadost_o_opravu.vyrobce.value == "jine" && document.zadost_o_opravu.jiny_vyrobce.value == "") {
        document.zadost_o_opravu.jiny_vyrobce.focus();
        alert("Doplňte výrobce.");
        return false;
      }
      if (document.zadost_o_opravu.model.value == "") {
        document.zadost_o_opravu.model.focus();
        alert("Doplňte model.");
        return false;
      }
      if (document.zadost_o_opravu.partnumber.value == "") {
        document.zadost_o_opravu.partnumber.focus();
        alert("Doplňte part number.");
        return false;
      }
      if (document.zadost_o_opravu.serial.value == "") {
        document.zadost_o_opravu.serial.focus();
        alert("Doplňte sériové číslo.");
        return false;
      }
      if (document.zadost_o_opravu.zavada.value == "") {
        document.zadost_o_opravu.zavada.focus();
        alert("Doplňte podrobný popis závady.");
        return false;
      }
      if (document.zadost_o_opravu.datum.value == "") {
        document.zadost_o_opravu.datum.focus();
        alert("Doplňte datum.");
        return false;
      }
      if (document.zadost_o_opravu.zakaznik.value == "") {
        document.zadost_o_opravu.zakaznik.focus();
        alert("Doplňte název společnosti nebo Vaše jméno a příjmení.");
        return false;
      }
      if (document.zadost_o_opravu.telefon.value == "") {
        document.zadost_o_opravu.telefon.focus();
        alert("Doplňte kontaktní telefon.");
        return false;
      }
      if (document.zadost_o_opravu.email.value == "") {
        document.zadost_o_opravu.email.focus();
        alert("Doplňte kontaktní email.");
        return false;
      }
      if (echeck(document.zadost_o_opravu.email.value) == "FAULT EMAIL") {
        document.zadost_o_opravu.email.focus();
        alert("Email nemá správný formát.");
        return false;
      }
      return kontrola_cisla();      
      return true;
    }
    function show(d)
      {
      
      document.getElementById(d).style.display = (document.getElementById(d).style.display=='none'?'':'none');
      }
function changelogoactiv(trida,tedecko){
         document.getElementById(tedecko).className = trida;
}
function kontrola_cisla(){
         if (document.getElementById('ovko').value)
         {
          return true;
         }
         else
         {
          alert('Zadejte prosím kód');
          return false
         }
}
function validate_medical() {

  if (document.medical_formular.jmeno.value == "")
  {
    document.medical_formular.jmeno.focus();
    alert("Vyplňte prosím vaše jméno");
    return(false);
  }
  
  if (document.medical_formular.prijmeni.value == "")
  {
    document.medical_formular.prijmeni.focus();
    alert("Vyplňte prosím vaše příjmení");
    return(false);
  }
  
  if (document.medical_formular.spolecnost.value == "")
  {
    document.medical_formular.spolecnost.focus();
    alert("Vyplňte prosím vaši společnost");
    return(false);
  }
  
  if (document.medical_formular.adresa.value == "")
  {
    document.medical_formular.adresa.focus();
    alert("Vyplňte prosím adresu vaší společnosti");
    return(false);
  }
  
  if (document.medical_formular.sidlo.value == "")
  {
    document.medical_formular.sidlo.focus();
    alert("Vyplňte prosím sídlo vaší společnosti");
    return(false);
  }
  
  if (document.medical_formular.psc.value == "")
  {
    document.medical_formular.psc.focus();
    alert("Vyplňte prosím PSČ");
    return(false);
  }
  
  if (document.medical_formular.tel.value == "")
  {
    document.medical_formular.tel.focus();
    alert("Vyplňte prosím váš telefon");
    return(false);
  }
  
  if (document.medical_formular.email.value == "")
  {
    document.medical_formular.email.focus();
    alert("Vyplňte prosím váš email");
    return(false);
  }
  
  if (echeck_medical(document.medical_formular.email.value) == "FAULT EMAIL") {
    document.medical_formular.email.focus();
    alert("Email nemá správný formát.");
    return(false);
  } 
  
    return kontrola_cisla();
  
}

function echeck_medical(str) 
{
    		var at = "@";
    		var dot = ".";
    		var lat = str.indexOf(at);
    		var lstr = str.length;
    		var ldot = str.indexOf(dot);
    		
    		if (str.indexOf(at) == -1) {
    		    return "FAULT EMAIL";
    		}
    		if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr){
    		    return "FAULT EMAIL";
    		}
    		if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr){
    		    return "FAULT EMAIL";
    		}
    		 if (str.indexOf(at,(lat+1)) != -1){
    		    return "FAULT EMAIL";
    		 }
    		 if (str.substring(lat-1,lat) == dot || str.substring(lat+1,lat+2) == dot){
    		    return "FAULT EMAIL";
    		 }
    		 if (str.indexOf(dot,(lat+2)) == -1){
    		    return "FAULT EMAIL";
    		 }		
    		 if (str.indexOf(" ") != -1){
    		    return "FAULT EMAIL";
    		 }		
        return true;			
}