function validate() {
  var f = document.f;
  var alerts = new Array(), i=0;

  if(frozen) return; // because mozilla doesn't recognize disabled A elements

  // validate form fields
  // also attempt to consolidate number of alerts and page refreshes necessary

  /* Your Contact Information */
  if(bad(f.first_name) & bad(f.last_name)) alerts[i++] = "Please tell us your <u>first</u> and <u>last</u> name.";
  else if(bad(f.first_name)) alerts[i++] = "Please tell us your <u>first</u> name.";
  else if(bad(f.last_name)) alerts[i++] = "Please tell us your <u>last</u> name.";
  if(bad(f.day_phone) && bad(f.eve_phone)) alerts[i++] = "Please give us a <u>phone number</u> we can reach you at.";
	else { mark_red(f.day_phone, 'off'); mark_red(f.eve_phone, 'off');	}
//  if(bad(f.email)) alerts[i++] = "Please enter your <u>email address</u>.";

  /* Your Situation */
  if(bad(f.situation)) alerts[i++] = "Please tell us <u>why you are selling</u>.";
  if(bad(f.sell_fast)) alerts[i++] = "Please tell us if you need to <u>sell fast</u>.";
  if(bad(f.how_soon)) alerts[i++] = "Please tell us <u>how soon</u> you'd like us to buy your home.";

  /* Your Property Information */
  if(bad(f.addr1) & bad(f.city) & bad(f.state) & bad(f.zip) & bad(f.county)) alerts[i++] = "Please tell us the <u>address</u> of the house.";
  else {
    if(bad(f.addr1)) alerts[i++] = "Please tell us the <u>address</u> of the house.";
    if(bad(f.city)) alerts[i++] = "Please tell us which <u>city</u> the house is located in.";
    if(bad(f.state)) alerts[i++] = "Please tell us which <u>state</u> the house is located in.";
    if(bad(f.zip)) alerts[i++] = "Please tell us which <u>zip code</u> the house is located in.";
    if(bad(f.county)) alerts[i++] = "Please tell us which <u>county</u> the house is located in.";
  }

  if(bad(f.bed_rooms)) alerts[i++] = "Please tell us how many <u>bedrooms</u> the house has.";
  if(bad(f.bath_rooms)) alerts[i++] = "Please tell us how many <u>bathrooms</u> the house has.";
  if(bad(f.year_built)) alerts[i++] = "Please tell us what <u>year</u> the house was built.";
  if(bad(f.floors)) alerts[i++] = "Please tell us how many <u>floors or stories</u> the house has.";
  if(bad(f.sqft)) alerts[i++] = "Please tell us the approximate <u>square footage</u> of the house.";
  if(bad(f.lot_size)) alerts[i++] = "Please tell us the approximate <u>lot size</u> of the property in acres.";

  if(bad(f.owned_for)) alerts[i++] = "Please tell us <u>how long you have owned</u> the house.";
  if(bad(f.repairs)) alerts[i++] = "Please tell us if the house needs any <u>repairs</u>.";
//  if(!blank(f.repairs) && bad(f.repair_estimate)) alerts[i++] = "Please guess how much the <u>repairs</u> will cost.";
  if(bad(f.on_market_for)) alerts[i++] = "Please tell us <u>how long you've been selling</u>.";
  if(bad(f.currently_listed)) alerts[i++] = "Please tell us <u>if your home is listed</u> with a real estate agent.";
  if(yes(f.currently_listed) && bad(f.listing_expires)) alerts[i++] = "Please tell us <u>how long you've been selling</u>.";
  else mark_red(f.listing_expires, 'off');
  if(no(f.currently_listed) && bad(f.previously_listed)) alerts[i++] = "Please tell us <u>if you've ever listed your home before</u> with a real estate agent.";
  else mark_red(f.previously_listed[0], 'off');

  /* Price & Terms */
  if(bad(f.asking_price)) alerts[i++] = "Please tell us <u>how much you are asking us to pay</u> for the house.";
  if(bad(f.appraisal_guess)) alerts[i++] = "Please guess <u>how much the house would appraise for</u>.";
  if(bad(f['1st_balance'])) alerts[i++] = "Please tell us the <u>balance</u> of your 1st Mortgage.";
  if(bad(f['1st_payment'])) alerts[i++] = "Please tell us the <u>monthly payment</u> of your 1st Mortgage.";
  if(bad(f['1st_rate'])) alerts[i++] = "Please tell us the <u>interest rate</u> of your 1st Mortgage.";
  if(bad(f['1st_current'])) alerts[i++] = "Please tell us if you need us to bring your 1st Mortgage <u>current</u>.";
  if(no(f['1st_current']) && bad(f['1st_arrearages'])) alerts[i++] = "Please tell us <u>how much</u> you need to bring your 1st Mortgage current.";
  if(!blank(f['2nd_balance'])) {
    if(bad(f['2nd_balance'])) alerts[i++] = "Please tell us the <u>balance</u> of your 2nd Mortgage.";
    if(bad(f['2nd_payment'])) alerts[i++] = "Please tell us the <u>monthly payment</u> of your 2nd Mortgage.";
    if(bad(f['2nd_rate'])) alerts[i++] = "Please tell us the <u>interest rate</u> of your 2nd Mortgage.";
    if(bad(f['2nd_current'])) alerts[i++] = "Please tell us if you need us to bring your 2nd Mortgage <u>current</u>.";
    if(no(f['2nd_current']) && bad(f['2nd_arrearages'])) alerts[i++] = "Please tell us <u>how much</u> you need to bring your 2nd Mortgage current.";
  }
  if(!blank(f['3rd_balance'])) {
    if(bad(f['3rdd_balance'])) alerts[i++] = "Please tell us the <u>balance</u> of your 3rd Mortgage.";
    if(bad(f['3rd_payment'])) alerts[i++] = "Please tell us the <u>monthly payment</u> of your 3rd Mortgage.";
    if(bad(f['3rd_rate'])) alerts[i++] = "Please tell us the <u>interest rate</u> of your 3rd Mortgage.";
    if(bad(f['3rd_current'])) alerts[i++] = "Please tell us if you need us to bring your 3rd Mortgage <u>current</u>.";
    if(no(f['3rd_current']) && bad(f['3rd_arrearages'])) alerts[i++] = "Please tell us <u>how much</u> you need to bring your 3rd Mortgage current.";
  }
  if(bad(f.annual_taxes)) alerts[i++] = "Please tell us how much is due for <u>taxes</u> on the house yearly.";
  if(bad(f.PITI)) alerts[i++] = "Please tell us if the mortgage payment includes <u>taxes and insurance</u> on the house.";
  if(bad(f.sell4owe)) alerts[i++] = "Please tell us if you would consider <u>selling for what you owe</u> on the house.";
  if(bad(f.equity_note)) alerts[i++] = "Please tell us if you would consider <u>taking your equity in payments</u>.";
  if(bad(f.takeover_pmts)) alerts[i++] = "Please tell us if you would consider <u>allowing us to make your monthly payments</u>.";
  if(bad(f.least_price)) alerts[i++] = "Please tell us what is the <u>very least amount you could take</u> in return for a quick sale.";
  if(bad(f.source)) alerts[i++] = "Please tell us <u>where you heard about us</u>.";

  // display problem box if necessary
  var oProblem = document.getElementById("problem");
  var oUL = oProblem.childNodes[2];
  oUL.innerHTML = ""; // clear alerts
  if(alerts.length) { // if necessary, show alerts in problem box
    if(alerts.length > 10) alerts = new Array("Please fill in the required items below marked in <u>red</u>.")
    for(i=0; i<alerts.length; i++)
      oUL.innerHTML += "<li>"+alerts[i]+"</li>\n"; // add alerts
    oProblem.style.display = "block"; // show problem box
    oProblem.scrollIntoView();
    return;
  } else oProblem.style.display = "none"; // hide problem box

  // the data is OK
  goTo(document.f, 'sell_submit.php'); // submit the form
  freeze(document.f); // prevent user from changing form data
  return;
}