function checkEmail(strEmail) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(strEmail)) 
  return (true) 
  return (false)
}
function validate(listingUserEmail, listingUserPhone, listingException) {
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  var strEmail = document.getElementById(listingUserEmail ? listingUserEmail: "userEmail").value;
  var strPhone = document.getElementById(listingUserPhone ? listingUserPhone: "userPhone").value;
  var strPhone = strPhone.replace(/[^0-9]/g, "");
  if (!checkEmail(strEmail)
  /*strEmail.search(validRegExp) == -1*/
  ) {
    document.getElementById(listingException ? listingException: "exceptionMessage").innerHTML = strEmail ? "Invalid email format": "Email is required";
    document.getElementById(listingException ? listingException: "exceptionMessage").style.display = "";
    return false;
  } else if (strPhone.length != 10 && strPhone.length != 11) {
    document.getElementById(listingException ? listingException: "exceptionMessage").innerHTML = "You must enter a 10 or 11-digit phone number";
    document.getElementById(listingException ? listingException: "exceptionMessage").style.display = "";
    return false;
  }
  return true;
}