function ValidateEmail(email) {
  var regEx = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([a-zA-Z]{2,3})|(aero|arpa|coop|info|museum|name))$/;
  var isValid = regEx.test(email);
  if (!isValid) {
    window.status = email + " -- Invalid Address !!!"; return false;
  } else
    window.status = ""; return true;
}

function ValidateEmailObj(obj) {
  if(ValidateEmail(obj.value)) {
    return true;
  } else {
    event.returnValue = false; event.cancelBubble = true; obj.select(); obj.focus();
    alert('Please enter a valid email address.\n\nA valid email address consists of a user name, the ampersand\n(the "@" or "at" symbol), and the machine or domain name.\n\nPermissible characters are "a" to "z", "0" to "9", "." (period),\n"-" (dash), "_" (underscore), and a single "@" sign (required).\n\nNo spaces are permitted.\n\nExamples of valid addresses:\n    john.doe@hotmail.com\n    Jill_Doe@Ex-Pressnet.com\n    terminator3@hollywood.ca\n\nInvalid Email Address:\n"' + obj.value + '"');
    return false;
  }
}

