/*
 * A login form to work with the 
 * JavaScript implementation of the RSA Data Security, Inc. MD5 Message
 * Digest Algorithm, as defined in RFC 1321, Version 2.1 
 * 
 * credit Marakana Inc., from their example code article,
 * "Implementing Secure Login with PHP, JavaScript, and Sessions (without SSL)" 
 * at marakana.com
 */
function login() {
	var loginForm = document.getElementById("loginForm");
	if (loginForm.username.value == "") {
		alert("Please enter your user name.");
		window.location = "index.php";
		return false;
    }
    if (loginForm.password.value == "") {
        alert("Please enter your password.");
		window.location = "index.php";
        return false;
    }
    var submitForm = document.getElementById("submitForm"); 
	var md5pwd = hex_md5(loginForm.password.value);
		submitForm.username.value = loginForm.username.value;
        submitForm.response.value =
			hex_md5(loginForm.challenge.value+md5pwd);
        submitForm.submit();
}

