function checkreqname() {
  path = document.mailform;
  tmp = (path.name.value == "");
  if (!tmp && (path.name.value.length < 3)) tmp = true;
  if (tmp) return;
}

function checkreqemail() {
  path = document.mailform;
  tmp = (path.email.value == "");
  if (!tmp && (path.email.value.length < 6)) tmp = true;
  if (tmp) return;
}

function checkreqsubject() {
  path = document.mailform;
  tmp = (path.subject.value == "");
  if (!tmp && (path.subject.value.length < 3)) tmp = true;
  if (tmp) return;
}

function checkreqcode() {
  path = document.mailform;
  tmp = (path.code.value == "");
  if (!tmp && (path.code.value.length != 6)) tmp = true;
  if (tmp) return;
}

function checkreqmessage() {
  path = document.mailform; 
  tmp = (path.message.value == "");
  if (!tmp && (path.message.value.length < 10)) tmp = true;
  if (tmp) return;
}

function check() {
  p_name = document.mailform.name.value.toString();
  if(p_name != "") { 
      if(p_name.length<3 || p_name.length>35) {
      alert ("Please type your name (3-35 letters)!");
      document.mailform.name.focus();
      return false;
      }
  }
  else { 
      alert("Please type your name!");
      document.mailform.name.focus();
      return false;
  }
  
  p_phone = document.mailform.phone.value.toString(); 
  if(p_phone == "") { 
    alert("Please type your phone!");
    document.mailform.phone.focus();
    return false;
  }
  
  p_email = document.mailform.email.value.toString();
  if (p_email != "") {
      t = p_email.indexOf("@");
      if((p_email.indexOf(".") == -1) || (t == -1) || (t < 1) || (t > p_email.length - 5) || (p_email.charAt(t - 1) == '.') || (p_email.charAt(t + 1) == '.')) {
      alert("Please type your e-mail address correctly!");
      document.mailform.email.focus();
      return false;
      }
  }
  else {
      alert("Please type your email!");
      document.mailform.email.focus();
      return false;
  }
  p_subject = document.mailform.subject.value.toString();
  if(p_subject != "") { 
      if(p_subject<3 || p_name.length>35) {
      alert ("Please type subject of your message (3-35 letters)!");
      document.mailform.subject.focus();
      return false;
      }
  }
  else { 
      alert("Please type subject of your message!");
      document.mailform.subject.focus();
      return false;
  }
  p_code = document.mailform.code.value.toString();
  if(p_code != "") { 
      if(p_code.length != 6) {
      alert ("Please enter code (6 symbols)!");
      document.mailform.code.focus();
      return false;
      }
  }
  else { 
      alert("Please enter code!");
      document.mailform.code.focus();
      return false;
  }
  p_message = document.mailform.message.value.toString();
  if (p_message.length < 10) {
      alert ("Please type your message (at least 10 letters) !");
      document.mailform.message.focus();
      return false;
  }
}
