function displayEmail(jmeno,domena,pripona) {

  adresa = jmeno + '@' + domena + '.' + pripona;

  document.write("<a href=\"mailto:" + adresa + "\">" + adresa + "</a>");

} // end function

function toggle(targetId) {
     	
     	if(document.getElementById) {
         target = document.getElementById(targetId);
           if(target.style.display == "none")  {
             target.style.display = "";
           }
             else {
                  target.style.display = "none";
             }
       }
     	
     } // end function


function validEmail(email) {
			invalidChars = " /:,;"
	
			if (email == "") {
				return false
			}
			for (i=0; i < invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1)
			if (atPos == -1) {
				return false
			}
			if (email.indexOf("@",atPos+1) > -1) {
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {
				return false
			}
			if (periodPos+3 > email.length)	{
				return false
			}
			return true
} // end function

function checkPoptavka() {

  var chyba = "";
  var formular = document.formular;
  
  if(formular.jmeno.value=="") chyba = "Napište Vaše jméno nebo firmu.\n\n";
  if(formular.telefon.value=="") chyba = chyba + "Napište Vaše telefonní číslo.\n\n";  
 
  
  if( (formular.email.value !== "") && (!validEmail(formular.email.value))) chyba = chyba + "Uvedená e-mailová adresa není platná.\n\n";
  
  if( (formular.ikod.value == "") || (formular.ikod.value.length !== 3) ) chyba = chyba + "Přepište kontrolní kód.";

  if(chyba == "") return true;
  
    else {
       alert(chyba);
       return false;
    }

} // end function


