﻿
function isEmpty(strfield1, strfield2) {

strfield1 = document.forms[0].vardas.value
strfield2 = document.forms[0].komentarai.value 

 
	 if (strfield1 == "" || strfield1 == null || strfield1.charAt(0) == ' ')
    {
    alert("Jūsų vardas?")
    return false;
    }


    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("Jūsų komentarai ir klausimai?")
    return false;
    }
		
    return true;
}



function isValidEmail(strEmail){
  validRegExp = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
  strEmail = document.forms[0].email.value;

    if (strEmail.search(validRegExp) == -1) 
   {
      alert('Jūsų el.pašto adresas?');
      return false;
    } 
    return true; 
}



function check(form){
if (isEmpty(form.vardas)){
 if (isEmpty(form.komentarai)){
  if (isValidEmail(form.email)){
 	   return true;
	    }
	  } 
   }

return false;
}
