<!--

function CheckEmail(Email) {
 filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 return filter.test(Email); 
}


/* Form validating function.
It is bound to the given form object.
It MUST NOT accept any parameters.
In case form data is invalid, function SHOULD inform user about this fact, and MUST RETURN FALSE.
Otherwise function MUST RETURN TRUE. */
function NewsletterRegistration() {
 if (this.Email.value == '') {
  alert('Email field is empty. Until it is filled with the proper data, form submitting is unavailable.');
  return false;
 }
 else if (!CheckEmail(this.Email.value)) {
  alert('Email address format is incorrect.');
  return false;
 } 
 
 isChecked = false;
 for (i = 1; i < this.elements.length; i++) {
  if (this.elements[i].checked) { isChecked = true; }
 }
 if (!(isChecked)) {
  alert('In order to confirm your registration, there must be at least one newsletter chosen. Until it is, form submitting is unavailable.');
  return false;
 }
 return true;
}


//-->

