// login.js    A library of needed JavaScript functions for login.htm

// -------------------------------------------------------------------
// Checks the User's login inputs to see if we have all we need
// inputs: all the form inputs
// output: nothing
// Action: none
// return: (true/false) = (AOK/Bad)
// -------------------------------------------------------------------
function LoginVal() {

   var Rtn = true;
   var me = -1;

   if (document.LoginReg.LoginName.value.length < 2) {
       alert("Please re-enter your name.");
       Rtn = false;
       me = 0;
   }
   else if (document.LoginReg.LoginPassWrd.value.length < 5) {
       alert("Please re-enter your password.");
       Rtn = false;
       me = 1;
   }
   else if (!document.LoginReg.DoThis[0].checked &&
            !document.LoginReg.DoThis[1].checked ) {
       alert("Please enter the action to be performed.");
       Rtn = false;
       me = 2;
   }
   else {
     if(document.LoginReg.DoThis[0].checked) {
       document.LoginReg.Action.value = "ML"; // Maintain Lists
     }
     else if(document.LoginReg.DoThis[1].checked) {
       document.LoginReg.Action.value = "SE"; // Send Email
     }
     else {
       document.LoginReg.Action.value = "XX"; // Huh?
     }
   }

   if (me >= 0) {
      document.LoginReg.elements[me].focus();
   }

   return Rtn;
}
