/****************************************************
  This script was created originally
  by Josh Bauer. December, 1999 (joshdb@pacbell.net)
  Modified by Judith Taylor (judi@frognet.net)
  June, 2000
****************************************************/

/***************************************************
  Validate Existing Mortgage Forms 
  This includes Refinancing Loan Quotes, Home 
  Improvement Loan Quotes, 2nd Mortgage Loan Quotes, 
  and Debt Consolidation Loan Quotes
****************************************************/

var OkToSubmit = true;

function checkMortgages(theForm)
{
// Verify applicant's current mortgage information
  if (theForm.monthly_payment.value == "")
  {
    alert("Please enter in your current monthly mortgage payment.");
    theForm.monthly_payment.focus();
    return (false);
  }
  if (theForm.current_rate.value == "")
  {
    alert("Please enter your current mortgage interest rate.");
    theForm.current_rate.focus();
    return (false);
  }
  if (theForm.cash_needed.value == "")
  {
    alert("What is the total loan amount desired?");
    theForm.cash_needed.focus();
    return (false);
  }
  if (theForm.current_worth.value == "")
  {
    alert("Please enter the current worth of your home.");
    theForm.current_worth.focus();
    return (false);
  }
  if (theForm.home_sale_price.value == "")
  {
    alert("Please enter the original sale price of your home.");
    theForm.home_sale_price.focus();
    return (false);
  }
  if (theForm.how_long_owned.value == "")
  {
    alert("Please enter how long you have owned your home.");
    theForm.how_long_owned.focus();
    return (false);
  }
  if (theForm.mortgage_balance.value == "")
  {
    alert("Please enter the balance of your current mortgage.");
    theForm.mortgage_balance.focus();
    return (false);
  }
  if (theForm.second_mortgage.options[1].selected && theForm.second_balance.value == "")
  {
    alert("Please enter the balance of your second mortgage.");
    theForm.second_balance.focus();
    return (false);
  }
  if (theForm.second_mortgage.options[1].selected && theForm.second_payment.value == "")
  {
    alert("Please enter the monthly payment of your second mortgage.");
    theForm.second_payment.focus();
    return (false);
  }
  if (theForm.second_mortgage.options[1].selected && theForm.second_rate.value == "")
  {
    alert("Please enter the interest rate of your second mortgage.");
    theForm.second_rate.focus();
    return (false);
  }
// Verify applicant's employment status
  if (theForm.self_employed.options[0].selected && theForm.years_employed.value == "")
  {
    alert("Please enter how long you've been with your current employer.");
    theForm.years_employed.focus();
    return (false);
  }
  if (theForm.monthly_gross.value == "")
  {
    alert("Please enter your monthly gross income.");
    theForm.monthly_gross.focus();
    return (false);
  }
  if (theForm.monthly_debt.value == "")
  {
    alert("Please enter the amount of your monthly debt.");
    theForm.monthly_debt.focus();
    return (false);
  }
// Verify applicant's personal information
  if (theForm.first_name.value == "")
  {
    alert("Please enter your first name.");
    theForm.first_name.focus();
    return (false);
  }
  if (theForm.last_name.value == "")
  {
    alert("Please enter your last name.");
    theForm.last_name.focus();
    return (false);
  }
  if (theForm.real_addr.value == "")
  {
    alert("Please enter your street address.");
    theForm.real_addr.focus();
    return (false);
  }
  if (theForm.city.value == "")
  {
    alert("Please enter your city.");
    theForm.city.focus();
    return (false);
  }
  if (theForm.zip_code.value == "")
  {
    alert("Please enter your zip code.");
    theForm.zip_code.focus();
    return (false);
  }
  if (theForm.day_phone_ac.value == "")
  {
    alert("Please enter your day time area code. Type 'n/a' if none.");
    theForm.day_phone_ac.focus();
    return (false);
  }
if (theForm.day_phone_pre.value == "")
  {
    alert("Please enter your day time phone number. Type 'n/a' if none.");
    theForm.day_phone_pre.focus();
    return (false);
  }
if (theForm.day_phone_num.value == "")
  {
    alert("Please enter your day time phone number. Type 'n/a' if none.");
    theForm.day_phone_num.focus();
    return (false);
  }
  if (theForm.eve_phone_ac.value == "")
  {
    alert("Please enter your evening area code. Type 'n/a' if none.");
    theForm.eve_phone_ac.focus();
    return (false);
  }
if (theForm.eve_phone_pre.value == "")
  {
    alert("Please enter your evening time phone number. Type 'n/a' if none.");
    theForm.eve_phone_pre.focus();
    return (false);
  }
if (theForm.eve_phone_num.value == "")
  {
    alert("Please enter your evening time phone number. Type 'n/a' if none.");
    theForm.eve_phone_num.focus();
    return (false);
  }
  if (theForm.email_addr.value == "")
  {
    alert("Please enter your e-mail address.");
    theForm.email_addr.focus();
    return (false);
  }
  if(OkToSubmit) {
    OkToSubmit = false;
    return (true);
  }
  else {
    return(false);
  }
}

