// Function to validate the form.
function ProcessForm()
{
   var Proceed = 1;
   var Message;
   var FocusField;

   while (Proceed == 1)
   {
   	  if (document.Validation.Salutation.selectedIndex==0)
      {
         Message = "Please select your salutation.";
         FocusField = "Salutation";
         Proceed = 0;
         break;
      }
      if (!document.Validation.FirstName.value)
      {
         Message = "Please enter your first name.";
         FocusField = "FirstName";
         Proceed = 0;
         break;
      }
	  if (!document.Validation.LastName.value)
      {
         Message = "Please enter your last name.";
         FocusField = "LastName";
         Proceed = 0;
         break;
      }
	  if (!document.Validation.Title.value)
      {
         Message = "Please enter your title.";
         FocusField = "Title";
         Proceed = 0;
         break;
      }
	  if (!document.Validation.Email.value.match(/^\w+([\.\-]\w+)*@\w+([\.\-]\w+)*\.[a-z]{2,4}$/i))
	  {
         Message = "Please enter a valid email address.";
         FocusField = "Email";
         Proceed = 0;
         break;
      }
	  if (!document.Validation.Company.value)
      {
         Message = "Please enter your company.";
         FocusField = "Company";
         Proceed = 0;
         break;
      }
	 if (!document.Validation.Zip.value)
      {
         Message = "Please enter your zip code.";
         FocusField = "Zip";
         Proceed = 0;
         break;
      }
	  if (document.Validation.country.selectedIndex==0)
      {
         Message = "Please select your country.";
         FocusField = "country";
         Proceed = 0;
         break;
      }
  	 if (!document.Validation.phone.value)
      {
         Message = "Please enter your phone number.";
         FocusField = "phone";
         Proceed = 0;
         break;
      }
      
	  
      break;
   }
   // After all the fields are validate, the Proceed variable can either have a value of
   // 1 or 0.  If the value is 1, a success message displayed.  Normally, the form would be 
   // submitted at this point.  If the value is 0, an alert message is displayed informing the
   // user which field failed validation and how they can correct it.  if the FocusField has value,
   // focus is set to that field.
   if (Proceed != 1)
   {
      alert( Message );
      if (FocusField != "")
      {
         eval("document.Validation." + FocusField + ".focus()");
      }
	  return false
	} else { 
	return true;}		 
}