/**
*  Description:
*   MD5 encrypt the password field and submit the form to handle login process, 
*   use this function with a button , instead of the standard submit button
*
*  Prerequisite:
*   Include the md5.js (the calcMD5 function)
*
*  Attention:
*   The maxlength of the password field must be longer than 32
*
* @param    formName                  string         The form name, 
*                                   default is 'login'
* @param    fieldName                 string         The hidden password field name, 
*                                   default is 'password'
* @param    fieldNameTemp             string         The temp password field name, 
*                                   default is 'tempPass'
*
* @return   boolean                 return true if success
* @author           Kevin   8/25/2004 5:49PM
*
* Example
*   <script LANGUAGE="JavaScript" src="js/md5.js"></script>
*   <script LANGUAGE="JavaScript" src="js/login.js"></script>
*   <form method="post" action="login.php" name="modifyForm" enctype="multipart/form-data" onSubmit="return login('modifyForm');">
*
*
*/
function login(formName,fieldName,fieldNameTemp) {
/* for IE backward compatible at IE ver 5
	if (formName==undefined){
        formName='login';
    }
    if (fieldName==undefined){
        fieldName='password';
    }
    if (fieldNameTemp==undefined){
        fieldNameTemp='tempPass';
    }
*/    
    document.forms[formName].elements[fieldName].value = calcMD5(document.forms[formName].elements[fieldNameTemp].value);
    document.forms[formName].elements[fieldNameTemp].disabled = true;    

    //document.forms[formName].submit(); Commented by Alvin, August 26, 2004
    //Following added by Alvin, August 26, 2004
    return true;
}

