function FormValidator(theForm)
{

    
  // check to see if the FirstName is blank
  if (theForm.GName.value == "")
  {
    alert("You must enter your given name.");
    theForm.GName.focus();
    return (false);
  }

  // allow ONLY Letter keys, no symbols or punctuation
  // this can be altered for any "checkOK" string you desire
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz";
  var checkStr = theForm.FName.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only LETTER characters in the \"Given Name\" field.");
    theForm.GName.focus();
    return (false);
  }

  // check to see if the LastName is blank
  if (theForm.FName.value == "")
  {
    alert("You must enter your family name.");
    theForm.FName.focus();
    return (false);
  }

  // allow ONLY Letter keys, no symbols or punctuation
  // this can be altered for any "checkOK" string you desire
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz";
  var checkStr = theForm.FName.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only LETTER characters in the \"Family Name\" field.");
    theForm.FName.focus();
    return (false);
  }

 // check to see if the JobTitle is blank
  if (theForm.JobTitle.value == "")
  {
    alert("You must enter your job title.");
    theForm.JobTitle.focus();
    return (false);
  }

  // allow ONLY Letter keys, no symbols or punctuation
  // this can be altered for any "checkOK" string you desire
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz";
  var checkStr = theForm.JobTitle.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only LETTER characters in the \"Job Title\" field.");
    theForm.JobTitle.focus();
    return (false);
  }

// check to see if the Company is blank
  if (theForm.Company.value == "")
  {
    alert("You must enter your company's name.");
    theForm.Company.focus();
    return (false);
  }

// check to see if the Street Address is blank
  if (theForm.StAdd.value == "")
  {
    alert("You must enter your street address.");
    theForm.StAdd.focus();
    return (false);
  }
  
// check to see if the City is blank
  if (theForm.City.value == "")
  {
    alert("You must enter your city.");
    theForm.City.focus();
    return (false);
  }

// check to see if the Country is blank
  if (theForm.Country.value == "")
  {
    alert("You must enter your country.");
    theForm.Country.focus();
    return (false);
  }

// check to see if the state/province is blank
//  if (theForm.State.value == "")
//  {
//    alert("You must enter your state/province.");
//    theForm.State.focus();
//    return (false);
//  }  

// check to see if the country code is blank
//  if (theForm.Code.value == "")
//  {
//    alert("You must enter your zip code.");
//    theForm.CountryCode.focus();
//    return (false);
//  }  

// var checkOK = "0123456789";
//  var checkStr = theForm.Code.value;
//  var allValid = true;
//  for (i = 0;  i < checkStr.length;  i++)
//  {
//    ch = checkStr.charAt(i);
//    for (j = 0;  j < checkOK.length;  j++)
//      if (ch == checkOK.charAt(j))
//        break;
//    if (j == checkOK.length)
//    {
//      allValid = false;
//      break;
//    }
//  }
//  if (!allValid)
//  {
//    alert("Please enter only numbers in the \"Zip Code\" field.");
//    theForm.CountryCode.focus();
//    return (false);
//  }  

// check to see if the telephone number is blank
  if (theForm.Tel.value == "")
  {
    alert("You must enter your telephone number.");
    theForm.Tel.focus();
    return (false);
  }  

var checkOK = "0123456789";
  var checkStr = theForm.Tel.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only numbers in the \"Telephone No\" field.");
    theForm.Tel.focus();
    return (false);
  }  

// check to see if the fax number is blank
  if (theForm.Fax.value == "")
  {
    alert("You must enter your fax number.");
    theForm.Fax.focus();
    return (false);
  }  

var checkOK = "0123456789";
  var checkStr = theForm.Fax.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only numbers in the \"Fax No\" field.");
    theForm.Fax.focus();
    return (false);
  }  

// Insert for Verification - START
   if (theForm.Verify.value == "")
  {
    alert("You must solve the equation!");
    theForm.Verify.focus();
    return (false);
  }  

var checkOK = "5";
  var checkStr = theForm.Verify.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please try again!");
    theForm.Verify.focus();
    return (false);
  }  
//Insert for Verification - END
  
// check if email field is blank
if (theForm.Email.value == "")
{
alert("Please enter a value for the \"Email\" field.");
theForm.Email.focus();
return (false);
}

  // test if valid email address, must have @ and .
  var checkEmail = "@.";
  var checkStr = theForm.Email.value;
  var EmailValid = false;
  var EmailAt = false;
  var EmailPeriod = false;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkEmail.length;  j++)
    {
      if (ch == checkEmail.charAt(j) && ch == "@")
        EmailAt = true;
      if (ch == checkEmail.charAt(j) && ch == ".")
        EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
    if (EmailAt && EmailPeriod)
    {
		EmailValid = true
		break;
	}
  }
  if (!EmailValid)
  {
    alert("Invalid email address");
    theForm.Email.focus();
    return (false);
  }
}

