{echo:JS::import('form')}
<div class="mt20 login box clearfix">
	<div class="head">取回账号密码</div>
<div class="login-form mt20" style="border:none; margin:20px auto;">
	<form action="{url:/simple/forget_act}" method="post" >
		<dl class="clearfix">
			<dt>电子邮箱：</dt><dd><input class="input"  name="email" id="email"  pattern="email"><label>注册时电子邮箱地址</label></dd>
		</dl>
		<dl class="clearfix">
			<dt>验证码：</dt><dd style="height:40px;"><input type="text" class="input" name="verifyCode" id="verifyCode"  pattern="\w{4}" maxlength="4" style="width: 80px;" ><img id="captcha_img"  src="{url:/simple/captcha/h/40/w/120}"><label><a href="javascript:void(0)" class="red" onclick="document.getElementById('captcha_img').src='{url:/simple/captcha/h/40/w/120/random/}'+Math.random()">换一张</a></label></dd>
		</dl>
		<dl class="clearfix">
			<dt></dt><dd style="padding-left:200px;"><input type="submit" class="btn" value="找回密码"></dd>
		</dl>

	</form>
</div>
</div>
<script type="text/javascript">
	$("input[name='email']").on("change",function(event){
		if(autoValidate.validate(event)){
			$.post("{url:/ajax/email/email/}"+$(this).val(),function(data){
				var msg = '邮箱不存在!';
				if(!data['status']) msg = '邮箱正确!';
			autoValidate.showMsg({id:document.getElementById('email'),error:data['status'],msg:msg});
		},'json');
		}
	});
	$("input[name='verifyCode']").on("change",function(){
		$.post("{url:/ajax/verifyCode/verifyCode/}"+$(this).val(),function(data){
			autoValidate.showMsg({id:document.getElementById('verifyCode'),error:!data['status'],msg:data['msg']});
		},'json');
	})
	{if:isset($invalid)}
		var form = new Form();
		form.setValue('email', '{$email}');
		autoValidate.showMsg({id:$("input[name='{$invalid['field']}']").get(0),error:true,msg:"{$invalid['msg']}"});
	{/if}
</script>