<!--
//**********************************************************************************
// "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=""
  var firstChar=s.charAt(0);
  for(var i=0;i<s.length;++i) {
	var thisChar=s.charAt(i);
	// check if it contains an invalid character
	if (thisChar=="'") errFlag += thisChar;
	if (thisChar==" ") errFlag += thisChar;
	if((thisChar=="'") || (thisChar==" ")){
	  errFlag += thisChar
	}
  }
  return errFlag;
}

function FrontPage_Form1_Validator(theForm)
{
  var StudId = removeSpaces(theForm.Student_Id.value);
  theForm.Student_Id.value = StudId;
  if (StudId == "")
  {
    alert("Please enter a value for the \"User Id\" field.");
    theForm.Student_Id.focus();
    return (false);
  }
 var errFlag = checkInvalidChars(StudId);
  if (errFlag.length > 0)
  {
    alert("The \"User Id\" field contains an invalid character, spaces and apostrophes are not allowed.");
    theForm.Student_Id.focus();
    return (false);
  }

  var thisPassword = removeSpaces(theForm.Password.value);
  theForm.Password.value = thisPassword;
  if (thisPassword == "")
  {
    alert("Please enter a value for the \"Password\" field.");
    theForm.Password.focus();
    return (false);
  }

  errFlag = checkInvalidChars(thisPassword);
  if (errFlag.length > 0)
  {
    alert("The \"Password\" field contains an invalid character, spaces and apostrophes are not allowed.");
    theForm.Student_Id.focus();
    return (false);
  }

  return (true);
}


//-->