/*
  login_onLoad
  Function called when the login page is loaded
 */
function login_onLoad() {
  username = getElement("username");
  password = getElement("password");
  if ( username.value.length == 0 ) {
	 username.focus();
  }
  else {
	 // Username is populated.
	 // User must have entered the wrong password.
	 // Focus the password field instead.
	 password.focus();
  }
}

/*
  login_onSubmit
  Function called when the login form is submitted
 */
function login_onSubmit() {
  username = getElement("username");
  password = getElement("password");
  fuseaction = getElement("fuseaction");
  if ( username.value.length == 0 ) {
	 alert("Please enter a username");
	 username.focus();
	 return false;
  }
  else if ( password.value.length == 0 ) {
	 alert("Please enter a password");
	 password.focus();
	 return false;
  }
  else {
	 fuseaction.value = "login.validate";
	 return true;
  }
}

