//The validate.js file validates the input fields

function ValidateInfo()
{
if (Trim(document.login.txtUserName.value)=="")
{
alert("Please enter the login name!");
document.login.txtUserName.value="";
document.login.txtUserName.focus();
return false;
}
else if (Trim(document.login.txtPassword.value)=="")
{
alert("Please enter the password!");
document.login.txtPassword.focus();
document.login.txtPassword.value="";
return false;
}
else
{
return true;
}
}

function Trim(s) 
{
  // Remove leading spaces and carriage returns
  
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
  {
    s = s.substring(1,s.length);
  }

  // Remove trailing spaces and carriage returns

  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
  {
    s = s.substring(0,s.length-1);
  }
  return s;
}

