// JavaScript Document

function emailListValidator(theForm) {



  msg = "";
  theForm.error_occurred.value = 0;
  var empty_type = 0;
  var wrong_type = 0; 

 if (theForm.email.value == "") {
    theForm.error_occurred.value = 1;
	empty_type = 1;
    msg = msg + "        Email\n";
   } 
  else {
    var foo;
	foo = theForm.email.value;
	var emailFilter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
    if (!(emailFilter.test(foo))) { 
       theForm.error_occurred.value = 1;
	   wrong_type = 1;
       }
   }
   
  if (theForm.error_occurred.value == 0) {
	return true;
    }
  else {
    if (empty_type) {
      msg = "Email is required \n";
	  };
	if (wrong_type) {
	  msg ="\n Illegal email address: " + theForm.email.value + "\n";
	  };
	alert (msg);
	return false;
    }; 
}