/*
  motor-inquire.js
*/
 
 
//--- FormClick ---
function FormClick() {
  var frmEmail;
  
  frmEmail = document.getElementById('email_form');
  blnHasPE = HasPE(frmEmail);
  blnHasEmail = HasEmail(frmEmail);
  blnHasPhone = HasPhone(frmEmail);
  if (blnHasPE) {
    if (blnHasEmail || blnHasPhone) {
      frmEmail.submit();
      //alert("All good - Submit");
    }
    else {
      alert("Phone and/or Email is required.");
    } 
  }
  else {
    alert("Please select Purchase, Exchange or Both.");
  }
}


function HasEmail(frmEmail) {
  var strEmail;
  strEmail = Trim(frmEmail.email.value);
  if(strEmail.length > 0) {
    return true;
  }
  else {
    return false;
  }
}


function HasPE(frmEmail) {
  var strPE;
  strPE = Trim(frmEmail.select_pe.value);
  if(strPE.length > 0) {
    return true;
  }
  else {
    return false;
  }
}


function HasPhone(frmEmail) {
  var strPhone;
  strPhone = Trim(frmEmail.phone.value);
  if(strPhone.length > 0) {
    return true;
  }
  else {
    return false;
  }
}

