// Verifikace formuare pro odeslani dotazu
function VerifyQuestionForm(QuestionForm) {
  var why = "";

  if(QuestionForm.jmeno.value == ""){
    why += "Prosím zadejte Vaše jméno.\n";
  }
  if((QuestionForm.telefon.value == "") && (QuestionForm.email.value == "")){
    why += "Prosím zadejte Váš telefon nebo e-mailovou adresu, abychom Vás mohli kontaktovat.\n";
  }
  if(QuestionForm.text.value == ""){
    why += "Prosím zadejte text Vašeho dotazu.\n";
  }
  if (QuestionForm.email.value != ""){
	  why += checkEmail(QuestionForm.email.value);
  }

  if (why != ""){
    alert(why);
    return false;
  }

  return true;
}

// Kontrola formatu emailu
function checkEmail (strng) {
  var error = "";

  var emailFilter=/^.+@.+\..{2,4}$/;
  if (!(emailFilter.test(strng))) {
    error += "Zadaná e-mailová adresa nemá platný formát.\n";
  }

  var illegalChars= /[\(\)\<\>\,\;\:\\\\[\]]/
  if (strng.match(illegalChars)) {
    error += "Zadaná e-mailová adresa obsahuje nepovolené znaky.\n";
  }
  return error;
}
