<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={$CONFIG[charset]}" />
<title>找回密码_{$SYSTEM[sitename]}</title>
	<link href="{IMG_URL}templates/{TEMPLATE}/css/style.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<link href="{IMG_URL}templates/{TEMPLATE}/css/content.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<!--[if IE 6]> 
		<link href="{IMG_URL}templates/{TEMPLATE}/css/ie6.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<![endif]-->
<script type="text/javascript" src="{IMG_URL}js/config.js"></script>
<script type="text/javascript" src="{IMG_URL}js/lib/jquery.js"></script>
<script type="text/javascript" src="{IMG_URL}js/lib/jquery.form.js"></script>
<script type="text/javascript" src="{IMG_URL}js/lib/cmstop.validator.js"></script>
<script type="text/javascript">
function getpassword_ok(data) {
	if(data.state) {
		$('#resetForm').hide();
	} else {
		alert(data.error);
	}
}
$(document).ready(function() {
	$.validate.setConfigs({
		xmlPath:'apps/member/validators/'
	});
	var validEmail = false;
	var validUsername = false;
	$('#member_getPassword').validate({
		submitHandler: function (form) {
			if(!validEmail || !validUsername) {
				alert('信息有误');
				return false;
			}
			$(form).ajaxSubmit({
				success: getpassword_ok,
				dataType:'json'
			});
		},
		infoHandler: function (element, info, type, event) {
			var vtype;
			var value;
			if (type == 'error'){
				element.siblings(".tipinfo").html(info).show();
			} else if (type == 'pass') {
				vtype = element.attr('name');
				value = encodeURIComponent(element.val());
				if(event.type == 'blur')
				$.getJSON(
					"?app=member&controller=index&action=validate&do="+vtype+"&"+vtype+"="+value,
					function(json){
						if(json.state){
							element.siblings(".tipinfo").html(json.info).show();
							validEmail = false;
							validUsername = false;
						} else {
							validEmail = true;
							validUsername = true;
						}
					}
				); 
			}
		}
	});
	$("input").change(function(){
		$(this).siblings('.tipinfo').hide();
	});
	
});
</script>
</head>
<body>
<!--{template 'system/header.html'}-->
<div class="hr-h10"></div>
<div class="column">
	<div class="member-wrap w-720 bor-ccc">
		<div class="member-title">
			<h2>忘记密码</h2>
			<span class="cor-666">请提供您注册时所填邮箱，系统将为您发送确认邮件。只有邮箱与用户名完全匹配才能找回密码。  </span>
		</div>
		<div>
		<form action="{url('member/index/getpassword')}" method="POST"  name="member_getPassword" id="member_getPassword">
			<ul class="formFormat member-form">
				<li><span class="info f-l"><label for="username">用户名：</label></span>
				<input name="username" id="username" type="text" class="input-text age f-l input-w160" />
				<span class="tipinfo"></span></li>
				<li><span class="info f-l"><label for="email">邮箱：</label></span>
				<input name="email" id="email" type="text" value="@" class="input-text age f-l input-w160" />
				<span class="tipinfo"></span></li>
				<li class="align-member"><input type="submit" id="resetpasswordsubmit" value="提交" class="member-btn" /></li>
			</ul>
		</form>
		</div>
	</div>
</div>

<div class="hr-h10"></div>
<!--{template 'system/footer.html'}-->