function FormValidator(theForm) {
  var checkOKfile  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._:&/\\';
  var checkOKemail = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._@';
  var checkOKphone = '0123456789';

  if (theForm.filename.value == "")  {
    alert("Please enter a value for the \"Resume file to upload\" field.");
    theForm.filename.focus();
    return (false);
  }
  if (theForm.filename.value.length < 8) {
    alert("Please enter at least 8 characters in the \"Resume file to upload\" field.");
    theForm.filename.focus();
    return (false);
  }
  if (!checkChars(theForm.filename.value, checkOKfile)) {
    alert("Please enter only letters, digits and \"._:&/\\\" characters in the \"Resume file to upload\" field.");
    theForm.filename.focus();
    return (false);
  }
  if (theForm.filename.value.length > 64) {
    alert("Please enter at most 64 characters in the \"Resume file to upload\" field.");
    theForm.filename.focus();
    return (false);
  }

  if (theForm.emailaddress.value == "")  {
    alert("Please enter a value for the \"Contact Email Address\" field.");
    theForm.emailaddress.focus();
    return (false);
  }
  if (!checkChars(theForm.emailaddress.value, checkOKemail)) {
    alert("Please enter only letters, digits and \"._@\" characters in the \"Contact Email Address\" field.");
    theForm.emailaddress.focus();
    return (false);
  }
  if (theForm.emailaddress.value.length < 6) {
    alert("Please enter at least 6 characters in the \"Contact Email Address\" field.");
    theForm.emailaddress.focus();
    return (false);
  }

  if (theForm.telephone.value == "")  {
    alert("Please enter a value for the \"Contact Telephone\" field.");
    theForm.telephone.focus();
    return (false);
  }
  if (!checkChars(theForm.telephone.value, checkOKphone)) {
    alert("Please enter only digits in the \"Contact Telephone\" field.");
    theForm.telephone.focus();
    return (false);
  }
  if (theForm.telephone.value.length < 7) {
    alert("Please enter at least 7 characters in the \"Contact Telephone\" field.");
    theForm.telephone.focus();
    return (false);
  }

  return (true);
}
function checkChars(checkStr, checkOK) {
  //var posSlash = checkStr.lastIndexOf('\\');
  //var posBackSlash = checkStr.lastIndexOf('/');
  //if (posSlash >= 0 || posBackSlash >=0) {
  //}
  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) {
      //alert("i="+i+",j="+j+", ch="+ch);
      allValid = false;
      break;
    }
  }
  return (allValid);
}
