/*
 *
 * checkForm(): returns true or false depending on the validation efforts on the form passed
 **
 * currently only attempts to validate emails
 * to mark a form to be validated, use onsubmit="return checkForm(this)" in the <form> tag
 * to mark a field for validation, give it the class "validate_email"
 */
function checkForm(form) {
  validemailRE = /^[0-9A-Za-z_. -]+@[0-9A-Za-z_.-]+$/;
  classRE =  /(\s|^)validate_email(\s|$)/;
  inputs = form.getElementsByTagName('input');
  valid = true;
  for(i in inputs) {
    if(classRE.exec(inputs[i].className)) {
      if(!validemailRE.exec(inputs[i].value)) {
        valid = false;
        alert('invalid email address!');
      }
    }  
  }
  return valid;
}
