// JavaScript Document
function validateForm(theForm)
{

  if (theForm.FirstName.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.FirstName.focus();
    return (false);
  }

  if (theForm.FirstName.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"First Name\" field.");
    theForm.FirstName.focus();
    return (false);
  }

  if (theForm.FirstName.value.length > 60)
  {
    alert("Please enter at most 60 characters in the \"First Name\" field.");
    theForm.FirstName.focus();
    return (false);
  }

  if (theForm.LastName.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.LastName.focus();
    return (false);
  }

  if (theForm.LastName.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Last Name\" field.");
    theForm.LastName.focus();
    return (false);
  }

  if (theForm.LastName.value.length > 60)
  {
    alert("Please enter at most 60 characters in the \"Last Name\" field.");
    theForm.LastName.focus();
    return (false);
  }

  if (theForm.CompanyName.value == "")
  {
    alert("Please enter a value for the \"Company Name\" field.");
    theForm.CompanyName.focus();
    return (false);
  }

  if (theForm.CompanyName.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Company Name\" field.");
    theForm.CompanyName.focus();
    return (false);
  }

  if (theForm.CompanyName.value.length > 70)
  {
    alert("Please enter at most 70 characters in the \"Company Name\" field.");
    theForm.CompanyName.focus();
    return (false);
  }

  if (theForm.Address1.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theForm.Address1.focus();
    return (false);
  }

  if (theForm.Address1.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Address\" field.");
    theForm.Address1.focus();
    return (false);
  }

  if (theForm.Address1.value.length > 70)
  {
    alert("Please enter at most 70 characters in the \"Address\" field.");
    theForm.Address1.focus();
    return (false);
  }

  if (theForm.City.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.City.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.City.value.length > 40)
  {
    alert("Please enter at most 40 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.State.value == "")
  {
    alert("Please enter a value for the \"State\" field.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.State.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"State\" field.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.State.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"State\" field.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.Country.value == "")
  {
    alert("Please enter a value for the \"Country\" field.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Country\" field.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.value.length > 15)
  {
    alert("Please enter at most 15 characters in the \"Country\" field.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.PhoneNumber.value == "")
  {
    alert("Please enter a value for the \"Phone Number\" field.");
    theForm.PhoneNumber.focus();
    return (false);
  }

  if (theForm.PhoneNumber.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"Phone Number\" field.");
    theForm.PhoneNumber.focus();
    return (false);
  }

  if (theForm.PhoneNumber.value.length > 14)
  {
    alert("Please enter at most 14 characters in the \"Phone Number\" field.");
    theForm.PhoneNumber.focus();
    return (false);
  }

  if (theForm.FaxNumber.value == "")
  {
    alert("Please enter a value for the \"Fax Number\" field.");
    theForm.FaxNumber.focus();
    return (false);
  }

  if (theForm.FaxNumber.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"Fax Number\" field.");
    theForm.FaxNumber.focus();
    return (false);
  }

  if (theForm.FaxNumber.value.length > 14)
  {
    alert("Please enter at most 14 characters in the \"Fax Number\" field.");
    theForm.FaxNumber.focus();
    return (false);
  }

  if (theForm.EmailAddress.value == "")
  {
    alert("Please enter a value for the \"Email Address\" field.");
    theForm.EmailAddress.focus();
    return (false);
  }

  if (theForm.EmailAddress.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Email Address\" field.");
    theForm.EmailAddress.focus();
    return (false);
  }

  if (theForm.EmailAddress.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Email Address\" field.");
    theForm.EmailAddress.focus();
    return (false);
  }

  if (theForm.CardType.selectedIndex < 0)
  {
    alert("Please select one of the \"Credit Card Type\" options.");
    theForm.CardType.focus();
    return (false);
  }

  if (theForm.CardType.selectedIndex == 0)
  {
    alert("The first \"Credit Card Type\" option is not a valid selection.  Please choose one of the other options.");
    theForm.CardType.focus();
    return (false);
  }

  if (theForm.CardNumber.value == "")
  {
    alert("Please enter a value for the \"Credit Card Number\" field.");
    theForm.CardNumber.focus();
    return (false);
  }

  if (theForm.CardNumber.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"Credit Card Number\" field.");
    theForm.CardNumber.focus();
    return (false);
  }

  if (theForm.CardNumber.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Credit Card Number\" field.");
    theForm.CardNumber.focus();
    return (false);
  }

  if (theForm.ExpMM.selectedIndex < 0)
  {
    alert("Please select one of the \"Expire Month\" options.");
    theForm.ExpMM.focus();
    return (false);
  }

  if (theForm.ExpMM.selectedIndex == 0)
  {
    alert("The first \"Expire Month\" option is not a valid selection.  Please choose one of the other options.");
    theForm.ExpMM.focus();
    return (false);
  }

  if (theForm.ExpYY.selectedIndex < 0)
  {
    alert("Please select one of the \"Expire Year\" options.");
    theForm.ExpYY.focus();
    return (false);
  }

  if (theForm.ExpYY.selectedIndex == 0)
  {
    alert("The first \"Expire Year\" option is not a valid selection.  Please choose one of the other options.");
    theForm.ExpYY.focus();
    return (false);
  }

  if (theForm.CardName.value == "")
  {
    alert("Please enter a value for the \"Name on Credit Card\" field.");
    theForm.CardName.focus();
    return (false);
  }

  if (theForm.CardName.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"Name on Credit Card\" field.");
    theForm.CardName.focus();
    return (false);
  }

  if (theForm.CardName.value.length > 60)
  {
    alert("Please enter at most 60 characters in the \"Name on Credit Card\" field.");
    theForm.CardName.focus();
    return (false);
  }
  return (true);
}