// JavaScript Document
<!--
// validateMercedes.js
// Yoshimi Yokoyama
// 11/05/06
// standalone file to validate Mercedes fields
//------ make sure user enters a name (textbox) ---------------
function submitIt()
{
	//----make sure user enter a name(textbox)----
  if (document.form1.txtName.value == "")  // if field is empty
  {
    alert("Please, type your name.");  // display an error message
    document.form1.txtName.select();  // select the textbox
    document.form1.txtName.focus();  // and set the focus there
    return false; // return error condition
  }
  //----make sure user enter age(textbox)----
  if (document.form1.txtAge.value == "")  // if field is empty
  {
    alert("Please, type your age");  // display an error message
    document.form1.txtAge.select();  // select the textbox
    document.form1.txtAge.focus();  // and set the focus there
    return false; // return error condition
  }
	
	//------ make sure a pick up month is selected (list box) ---------
  var cboPickUpMonth= document.form1.cboPickUpMonth.selectedIndex;
  if (cboPickUpMonth == 0)  // first entry is not valid
  {
    alert ("Please, select a pick up date");
    document.form1.cboPickUpMonth.focus();
    return false;
  }
  //------ make sure a pick up date is selected (list box) ---------
  var cboPickUpDate= document.form1.cboPickUpDate.selectedIndex;
  if (cboPickUpDate == 0)  // first entry is not valid
  {
    alert ("Please, select a pick up date");
    document.form1.cboPickUpDate.focus();
    return false;
  }
  //------ make sure a drop off month is selected (list box) ---------
  var cboDropOffMonth= document.form1.cboDropOffMonth.selectedIndex;
  if (cboDropOffMonth == 0)  // first entry is not valid
  {
    alert ("Please, select a drop off date");
    document.form1.cboDropOffMonth.focus();
    return false;
  }
   //------ make sure a drop off date is selected (list box) ---------
  var cboDropOffDate= document.form1.cboDropOffDate.selectedIndex;
  if (cboDropOffDate == 0)  // first entry is not valid
  {
    alert ("Please, select a drop off date.");
    document.form1.cboDropOffDate.focus();
    return false;
  }
  
   //------ make sure a Pick up place is selected (list box) ---------
  var cboPickUpPlace= document.form1.cboPickUpPlace.selectedIndex;
  if (cboPickUpPlace == 0)  // first entry is not valid
  {
    alert ("Please, choose a pick up place");
    document.form1.cboPickUpPlace.focus();
    return false;
  }
  //------ make sure a drop off place is selected (list box) ---------
  var cboDropOffPlace= document.form1.cboDropOffPlace.selectedIndex;
  if (cboDropOffPlace == 0)  // first entry is not valid
  {
    alert ("Please, choose a drop off place");
    document.form1.cboDropOffPlace.focus();
    return false;
  }
  
   //----make sure user enter a e-mail(textbox)----
  if (document.form1.txtEmailAddress.value == "")  // if field is empty
  {
    alert("Please, type your E-mail address.");  // display an error message
    document.form1.txtEmailAddress.select();  // select the textbox
    document.form1.txtEmailAddress.focus();  // and set the focus there
    return false; // return error condition
  } 

}

//-------------------------------------------------------------
//-->