//function to check empty fields

function isEmpty(strfield1, strfield2, strfield3, strfield4) {


strfield1 = document.forms[0].autor.value 
strfield2 = document.forms[0].email.value
strfield3 = document.forms[0].message.value
strfield4 = document.forms[0].securitycode.value

  //name field
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("Bitte Name eingeben!")
    return false;
    }

  //url field 
    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("Bitte Email eingeben!")
    return false;
    }

  //title field 
    if (strfield3 == "" || strfield3 == null || strfield3.charAt(0) == ' ')
    {
    alert("Bitte geben Sie ihre Mitteilung an!")
    return false;
    }
  //title field 
    if (strfield4 == "" || strfield4 == null || strfield4.charAt(0) == ' ')
    {
    alert("Bitte geben Sie de Sicherheitskode an!")
    return false;
    }
    return true;
}


//function to check valid email address
function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail = document.forms[0].email.value;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      alert('Bitte geben sie eine valide Email an!');
      return false;
    } 
    return true; 
}


//function that performs all functions, defined in the onsubmit event handler
function check(form){
if (isEmpty(form.field1)){
  if (isEmpty(form.field2) && isValidEmail(form.email)){
    if (isEmpty(form.field3)){
		return true;		
	  }
  }
}
return false;
}