

function Form1_Validator(theForm)
{
  if (theForm.userid.value == "")
  {
    alert("Please enter a value for the \"username\" field.");
    theForm.userid.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-_@.";
  var checkStr = theForm.userid.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 and digit characters in the \"userid\" field.");
    theForm.userid.focus();
    return (false);
  }

  if (theForm.password.value == "")
  {
    alert("Please enter a value for the \"password\" field.");
    theForm.password.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-.";
  var checkStr = theForm.password.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 and digit characters in the \"password\" field.");
    theForm.password.focus();
    return (false);
  }
  return (true);
}


function changepwd_Form_Validator(theForm)
{

  if (theForm.email.value == "")
  {
    alert("Please enter a valid email for the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }
  
  if (theForm.oldpassword.value == "")
  {
    alert("Please enter a value for the \"Old Password\" field.");
    theForm.oldpassword.focus();
    return (false);
  }
  
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-.";
  var checkStr = theForm.oldpassword.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 and digit characters in the \"Old Password\" field.");
    theForm.oldpassword.focus();
    return (false);
  }

  if (theForm.newpassword.value == "")
  {
    alert("Please enter a value for the \"validate_newpwd\" field.");
    theForm.newpassword.focus();
    return (false);
  }

  if (theForm.newpassword.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"New Password\" field.");
    theForm.newpassword.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-.";
  var checkStr = theForm.newpassword.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 and digit characters in the \"New Password\" field.");
    theForm.newpassword.focus();
    return (false);
  }

  if (theForm.validate_newpwdagain.value == "")
  {
    alert("Please enter a value for the \"Re-Enter New Password\" field.");
    theForm.validate_newpwdagain.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-.";
  var checkStr = theForm.validate_newpwdagain.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 and digit characters in the \"Re-Enter New Password\" field.");
    theForm.validate_newpwdagain.focus();
    return (false);
  }
  var checkStr1 = theForm.validate_newpwdagain.value;
  var checkStr2 = theForm.newpassword.value;
  var allValid = true;
    
  if (checkStr1 != checkStr2)
    {
      allValid = false;
    }
  if (!allValid)
  {
    alert("New Password entries do not match.  Please enter again.");
    theForm.newpassword.focus();
    return (false);
  }
  var checkStr1 = theForm.oldpassword.value;
  var checkStr2 = theForm.newpassword.value;
  var allValid = true;
    
  if (checkStr1 == checkStr2)
    {
      allValid = false;
    }
  if (!allValid)
  {
    alert("Your old password and new password cannot be the same.  Please enter a different new password.");
    theForm.newpassword.focus();
    return (false);
  }
  
  return (true);
}


function loannumber_form_validator(theForm)
{

  if (theForm.loanid.value == "")
  {
    alert("Please enter a value for the \"Loan Number\" field.");
    theForm.loanid.focus();
    return (false);
  }

  var checkOK = "0123456789-,";
  var checkStr = theForm.loanid.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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 (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"Loan Number\" field.");
    theForm.loanid.focus();
    return (false);
  }
  return (true);
}
