<!--<?php print <<<EOT
-->
<div id="breadCrumb">
<img src="$imgpath/$stylepath/thread/home.gif" class="cp breadHome" /><em class="breadEm"></em><a href="$db_bfn" title="$db_bbsname">$db_bbsname</a><em></em>&raquo; 取回密碼
</div>

<form action="$basename" method="post" name="formct" onsubmit="return checkAll();">
<div class="t" style="margin-top:15px">
	<table width="100%" cellspacing="0" cellpadding="0">
		<tr class="h" >
			<th class="h" colspan="2">驗證完成.可以通過此程序設置新密碼</th>
			<th></th>
			<th></th>
		</tr>
		<tr class="tr3 f_one">
			<th width="25%">新密碼</th>
			<th width="30%"><input type="password" name="new_pwd" id="pwd" class="input" size="40" onblur="showTips(this,'pwd')" /></th>
			<th id="pwd_info"></th>
		</tr>
		<tr class="tr3 f_two">
			<th>重復新密碼</th>
			<th width="30%"><input type="password" name="pwdreapt" id="pwdrepeat" class="input" size="40" onblur="showTips(this,'pwdrepeat')" /></th>
			<th id="pwdrepeat_info"></th>
		</tr>
		<tr>
			<td>&nbsp;</td><td><div class="p10 tac"><input type="hidden" value="2" name="jop" /><input class="btn" type="submit" value="提 交" /></div>
			</td>
		</tr>
	</table>
</div>
</form>
<script>
var regminpwd 	= parseInt('$rg_regminpwd');
var regmaxpwd 	= parseInt('$rg_regmaxpwd');
var pwdcomplex	= '$rg_config[rg_pwdcomplex]';
var pwdInfo 	= new Array(
		" ",
		"密碼設置錯誤。密碼中必須包含小寫字母",
		"密碼設置錯誤。密碼中必須包含大寫字母",
		"密碼設置錯誤。密碼中必須包含數字",
		"密碼設置錯誤。密碼中必須包含符號",
		"密碼設置錯誤。密碼長度過小",
		"密碼設置錯誤。密碼過長",
		"密碼設置錯誤。密碼不允許和用戶名相同",
		"密碼設置錯誤。密碼不允以下字符:\\ & ' \" ! / * , < > % # ?。",
		"不允許注冊帳號與密碼相同",
        getPwdRule());
var pwdrepeatInfo = new Array(
		" ",
		"兩次輸入的密碼不一致。請再輸入一次您上面輸入的密碼",
		"請再輸入一遍您上面填寫的密碼");

function showTips(obj,type) {
	var key;
	key = type == 'pwd' ? checkPwd(obj) : checkPwdRepeat(obj);
	getObj(obj.id + '_info').innerHTML = eval(obj.id + 'Info')[key];
	return key;		
}

function checkAll() {
	ispwd = showTips(getObj('pwd'), 'pwd');
	ispwdrepeat = showTips(getObj('pwdrepeat'), 'pwdrepeat');
	if (ispwd == 0 && ispwdrepeat == 0) return true;
	return false; 
}

function checkPwd(obj) {
	var pwd = obj.value;
	if(pwd.length<regminpwd){
		return 5;
	}else if(regmaxpwd>0 && pwd.length>regmaxpwd) {
		return 6;
	}
	if(/[\\\/\&\'\"\*\,<>#\?% ]/.test(pwd)){
		return 8;
	}
	var rule = pwdcomplex.split(',');
	var pwdReg;
	for(var i=0;i<rule.length;i++){
		switch(Number(rule[i])){
			case 1:
				pwdReg = /[a-z]/;
				if(!pwdReg.test(pwd)) return 1;
				break;
			case 2:
				pwdReg = /[A-Z]/;
				if(!pwdReg.test(pwd)) return 2;
				break;
			case 3:
				pwdReg = /[0-9]/;
				if(!pwdReg.test(pwd)) return 3;
				break;
			case 4:
				pwdReg = /[^a-zA-Z0-9]/;
				if(!pwdReg.test(pwd)) return 4;
				break;
			default:
				continue;
				break;
		}
	}
	var pwdRepeat = getObj('pwdrepeat');
	if(pwdRepeat.value && checkPwdRepeat(pwdRepeat)){
	    getObj('pwdrepeat_info').innerHTML = pwdrepeatInfo[1];
	}
	return 0;
}

function checkPwdRepeat(obj){
	if (obj.value==getObj('pwd').value && obj.value.length > 0) {
		return 0;
	} else {
		return 1;
	}
}

function getPwdRule(){
	var intiString 	= "";
	if(regminpwd){
		intiString 	+= "最小長度:"+regminpwd+" ";
	}
	if(regmaxpwd){
		intiString 	+= "最大長度:"+regmaxpwd+" ";
	}
	if(!pwdcomplex){
		return intiString;
	}
	var addString 	= "密碼里必須包含以下字符類型:";
	var rule = pwdcomplex.split(',');
	for(var i=0;i<rule.length;i++){
		switch(Number(rule[i])){
			case 1:
				addString += "小寫字母 ";
				break;
			case 2:
				addString += "大寫字母 ";
				break;
			case 3:
				addString += "數字 ";
				break;
			case 4:
				addString += "符號 ";
				break;
			default:
				break;
		}
	}
	return intiString + addString;
}
</script>
<!--
EOT;
?>-->