<div class="wrapper clearfix">
	<div class="wrap_box">
		<h3 class="notice">忘记密码</h3>
		<p class="tips">欢迎来到我们的网站，如果忘记密码，请填写下面表单来重新获取密码</p>
		<div class="box">
		<form action="{url:/simple/find_password_email}" method="post" id="mailWay">
			<table class="form_table">
				<colgroup>
					<col width="300px" />
					<col />
				</colgroup>

				<tr><th>用户名：</th><td><input name="username" class="gray" type="text" pattern="required" alt="请输入正确的用户名" /></td></tr>
				<tr><th>邮箱：</th><td><input name="email" class="gray" type="text" pattern="email" alt="请输入正确的邮件地址" /></td></tr>
				<tr>
					<td></td>
					<td><input class="submit" type="submit" value="找回密码" /></td>
				</tr>
				<tr><td></td><td><a href="javascript:changeTab()" class="link">手机短信重置密码</a></td></tr>
			</table>
		</form>

		<form action="{url:/simple/find_password_mobile}" method="post" id="mobileWay" style="display:none">
			<table class="form_table">
				<colgroup>
					<col width="300px" />
					<col />
				</colgroup>

				<tr><th>用户名：</th><td><input name="username" class="gray" type="text" pattern="required" alt="请输入正确的用户名" /></td></tr>
				<tr><th>手机号：</th><td><input name="mobile" class="gray" type="text" pattern="mobi" alt="请输入正确的手机号码" /><a href="javascript:sendMessage();" class="link">发送手机验证码</a></td></tr>
				<tr><th>手机验证码：</th><td><input name="mobile_code" class="gray" type="text" pattern="required" alt="请输入短信息中验证码" /></td></tr>
				<tr>
					<td></td>
					<td><input class="submit" type="submit" value="找回密码" /></td>
				</tr>
				<tr><td></td><td><a href="javascript:changeTab()" class="link">电子邮件重置密码</a></td></tr>
			</table>
		</form>
		</div>
	</div>
</div>

<script language="javascript">
//短信和邮箱切换
function changeTab()
{
	$('#mailWay').toggle();
	$('#mobileWay').toggle();
}

//发送短信码
function sendMessage()
{
	var username = $('#mobileWay [name="username"]').val();
	var mobile   = $('#mobileWay [name="mobile"]').val();
	$.get("{url:/simple/send_message_mobile}",{"username":username,"mobile":mobile},function(content){
		if(content == 'success')
		{
			alert('发送成功，请查看您的手机');
		}
		else
		{
			alert(content);
			return;
		}
	});
}
</script>
