//
// NAME
//	index.js - Intro pages JavaScript and login.
//
// DESCRIPTION
//	This script is responsible for ensuring that values entered are
//	correct, etc.
//
// AUTHOR
//	Copyright (c) Woodward IT Pty Ltd 2005
//
// MODIFICATIONS
//	Version 1.0 : 15/09/2005
//      ------------------------
//	Initial version.
//

//----------------------------------------------------------------
// Check that a user name and password have been entered.
//----------------------------------------------------------------
function checkLogin() {

   uName = document.loginForm.Login.value;
   uPass = document.loginForm.Password.value;

   if (uName == "") {
      alert ("An induction number has not been entered!");
      document.loginForm.Login.focus();
      return;
   }

   // Check that the induction number is numeric
   regexNum = /^(\d+)$/;
   if (!regexNum.exec(uName)) {
      alert("Invalid induction number entered!\nAll induction numbers are numeric.");
      document.loginForm.Login.focus();
      return;
   }

   if (uPass == "") {
      alert ("Your password has not been entered!");
      document.loginForm.Password.focus();
      return;
   }

   // Passwords must be 6 characters long.
   if (uPass.length != 6) {
      alert ("Invalid password entered!\nOASIS Passwords must be 6 characters long");
      document.loginForm.Password.focus();
      return;
   }

   document.loginForm.submit();
}

