//=================
// Process sign in.
//=================
function processSignIn() {
   var signInForm = document.getElementById("signIn_form")
   
   if (!top.IeFilters) {
      document.getElementById("title_div").className = "titleDivNN";
   }
   // Save cookies if valid sign-in.
   if (signInForm.validUser_hid.value == "True") {
      top.ValidUser = true;
      signInForm.password_Textbox.value = "ZZZZZZ";
   
      if (signInForm.remember_Checkbox.checked) {
         top.setCookie("userID", signInForm.userID_Textbox.value, 1);
         top.setCookie("password", signInForm.password_hid.value, 1);
      }

      //Restore previous command
      var command = signInForm.command_hid.value;

      if (command.toUpperCase() == "COMPS") { 
         top.comps();
      } else if (command.toUpperCase() == "DOWNLOAD") { 
         top.download();
      } else if (command.toUpperCase() == "MAILLABEL") { 
         top.selectByGraphics();
      } else {
         top.data_frame.location.href = "signInSuccess.aspx";
      }

   // Init webform and process invalid sign-in
   } else {
      signInForm.userID_Textbox.focus();

      // Get cookies.
      var userID = top.getCookie("userID");
      var password = top.getCookie("password");

      // Init userID.
      if (signInForm.userID_Textbox.value == "") {
         signInForm.userID_Textbox.value = userID;
      }
      // Init password.
      if (userID != "") {
         signInForm.password_Textbox.value = "ZZZZZZ";
         signInForm.password_hid.value = password;
      }
   }
}
