function eventLogin(ret){
	
	var challengeA=document.form.textChallenge.value;
	var loginidB=document.form.textLoginId.value;
	var passwordC=document.form.textPassword.value;
	var passwordHashD=passowrdHash(passwordC, loginidB);
	document.form.textPasswordHash.value=passwordHashD;
	document.form.textChallengeResponse.value=challengeResponse(passwordHashD, challengeA);
	
	if(ret == true) {
		/* パスワード、パスワードハッシュは送信しないので消去 */
		document.form.textPassword.value="";
		document.form.textPasswordHash.value="";
	}

	
	return ret;
}
var STRETCH_COUNT=500;
function passowrdHash(password, loginId){
	var salt = CryptoJS.SHA256(loginId);
	var hash = "";
	for (var i = 0; i < STRETCH_COUNT; i = i +1){
		hash = CryptoJS.SHA256(hash + salt + password);
	}
	return hash;
}
function challengeResponse(passwordHash, challenge) {
	return CryptoJS.SHA256(passwordHash + challenge);
}