/* usspotemkin.com - Winter 2008 Codebase
 * created by Captain Warp <warp@usspotemkin.com>
 * copyright (c) 2007
 * --
 * Good day to you, wanderer of code
 * Welcome to this design's humble abode.
 * Explore a bit and stay a while
 * And compare your browser to this file.
 * Courtesy always comes off best
 * In a place of learning when a guest.
 * Look around and touch and feel
 * But please do not dare to steal.
 * --
 */


function secureLogin() {
  var usernameField = document.getElementById("login_username");
  var passwordField = document.getElementById("login_password");
  var challkeyField = document.getElementById("login_challenge_key");
  
  // If the login fields can't be found, short-circuit and die
  if(!usernameField || !passwordField || !challkeyField) {
    return true;
  }
  
  // Login fields found; process them
  var hashedPassword = hex_md5(passwordField.value);
  var challengeToSend = hex_md5(hashedPassword + "-" + challkeyField.value);
  
  // Update the password field value
  passwordField.value = challengeToSend;
  
  // Submit
  return true;
}