<!--
//**********************************************************************************
// "Internal" function to remove all spaces ensures user input values correctly
//**********************************************************************************
function removeSpaces(s) {
 var tempVal=""
 for(var i=0;i<s.length;++i) {
  var c=s.charAt(i)
  if(c!=" ") tempVal += c
 }
 return tempVal
}


//**********************************************************************************
// "Internal" function to help ensure user input processed correctly
//**********************************************************************************
function checkInvalidChars(s) {
  var errFlag=0
  var firstChar=s.charAt(0);
  for(var i=0;i<s.length;++i) {
	var thisChar=s.charAt(i);
	if((thisChar=="'") || (thisChar==" ")){
	  errFlag = 1
	}
  }
  return errFlag;
}

function FrontPage_Form1_Validator(theForm)
{

  if (theForm.Student_Id.value == "")
  {
    alert("Please enter a value for the \"User ID\" field.");
    theForm.Student_Id.focus();
    return (false);
  }

  var thisID = removeSpaces(theForm.Student_Id.value);
  if (thisID == "")
  {
    alert("Please enter a value for the \"User ID\" field. It cannot be all spaces.");
    theForm.Student_Id.focus();
    return (false);
  }
  errFlag = checkInvalidChars(theForm.Student_Id.value);
  if (errFlag > 0)
  {
    alert("The \"User Id\" field contains an invalid character, spaces and apostrophes are not allowed.");
    theForm.Student_Id.focus();
    return (false);
  }

  if (theForm.Password.value == "")
  {
    alert("Please enter a value for the \"Old Password\" field.");
    theForm.Password.focus();
    return (false);
  }

  var thisPassword = removeSpaces(theForm.Password.value);
  if (thisPassword == "")
  {
    alert("Please enter a value for the \"Old Password\" field. It cannot be all spaces.");
    theForm.Password.focus();
    return (false);
  }
  errFlag = checkInvalidChars(theForm.Password.value);
  if (errFlag > 0)
  {
    alert("The \"Old Password\" field contains an invalid character, spaces and apostrophes are not allowed.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.PasswordNew1.value == "")
  {
    alert("Please enter a value for the \"New Password\" field.");
    theForm.PasswordNew1.focus();
    return (false);
  }

  if (theForm.PasswordNew1.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"New Password\" field.");
    theForm.PasswordNew1.focus();
    return (false);
  }

  if (theForm.PasswordNew1.value.length > 15)
  {
    alert("Please enter at most 15 characters in the \"New Password\" field.");
    theForm.PasswordNew1.focus();
    return (false);
  }

  thisPassword = removeSpaces(theForm.PasswordNew1.value);
  if (thisPassword == "")
  {
    alert("Please enter a value for the \"New Password\" field. It cannot be all spaces.");
    theForm.PasswordNew1.focus();
    return (false);
  }
  errFlag = checkInvalidChars(theForm.PasswordNew1.value);
  if (errFlag > 0)
  {
    alert("The \"New Password\" field contains an invalid character, spaces and apostrophes are not allowed.");
    theForm.PasswordNew1.focus();
    return (false);
  }

  if (theForm.PasswordNew2.value == "")
  {
    alert("Please enter a value for the \"Confirm Password\" field.");
    theForm.PasswordNew2.focus();
    return (false);
  }

  if (theForm.PasswordNew2.value == theForm.PasswordNew1.value)
     {   
     }
  else
  {
    alert("Please enter the same New Password value in the \"Confirm Password\" field.");
    theForm.PasswordNew2.value = "";
    theForm.PasswordNew2.focus();
    return (false);
  }

  return (true);
}

//-->