{template 'member','header1'}
<script language="javascript">
<?php
sajax_show_javascript();
?>
function checkuser(){
	var c = document.getElementById("rmsg");
	var name = document.getElementById("username").value;
	var code = document.getElementById("checkcode").value;
	c.style.display="block";
	c.innerHTML = "<span class='font06'>正在验证,请稍后...</span>";
	x_checkuser(name,code,checkuser_cb);

function checkuser_cb(z) {
  if(z=="nouser")
  {
    c.innerHTML = "<span class='font06'>请输入帐号名称</span>";
	}
	else if(z == "nocode")
	{
	c.innerHTML = "<span class='font06'>请输入验证码</span>";
	}
	else if(z == "erruser")
	{
	c.innerHTML = "<span class='font06'>该用户不存在</span>";
	document.getElementById("checkcodeimg").src="{HS_PATH}checkcode.php?id='+Math.random()*5";
	}
	else if(z == "errcode")
	{
	c.innerHTML = "<span class='font06'>验证码错误</span>";
	document.getElementById("checkcodeimg").src="{HS_PATH}checkcode.php?id='+Math.random()*5";
	}
	else
	{
	document.getElementById("contents").innerHTML = z;
	}
}
}

function checkemail(){
	var c = document.getElementById("rmsg");
	var iduser = document.getElementById("iduser").value;
	var pemail = document.getElementById("aemail").value;
	c.style.display="block";
	c.innerHTML = "<span class='font06'>正在验证邮箱,请稍后...</span>";
	x_checkemail(iduser,pemail,checkemail_cb);

function checkemail_cb(z) {
  if(z=="noemail")
  {
    c.innerHTML = "<span class='font06'>请输入邮箱地址</span>";
	}
	else if(z == "unaccess")
	{
	c.innerHTML = "<span class='font06'>错误的请求</span>";
	}
	else if(z == "erremail")
	{
	c.innerHTML = "<span class='font06'>邮箱地址错误，请重试</span>";
	}
	else
	{
	document.getElementById("contents").innerHTML = "<DIV class=mailinfo><P style='text-align:center;'><SPAN class=mailname style='font-weight:bold'>正在发送邮件</SPAN></P><p style='text-align:center'><img src='<?=HS_PATH?>img/member/ajax_loader.gif'></p></DIV>";
	window.location.href=z;
	}
}
}

function resetpass(){
	var c = document.getElementById("rmsg");
	var username = document.getElementById("username").value;
	var authstr = document.getElementById("authstr").value;
	var password = document.getElementById("password").value;
	var repassword = document.getElementById("repassword").value;
	c.style.display="block";
	c.innerHTML = "<span class='font06'>正在检测信息,请稍后...</span>";
	x_resetpass(username,authstr,password,repassword,resetpass_cb);

function resetpass_cb(z) {
  if(z=="nop")
  {
    c.innerHTML = "<span class='font06'>请输入密码</span>";
	}
	else if(z == "norp")
	{
	c.innerHTML = "<span class='font06'>请输入确认密码</span>";
	}
	else if(z == "errusr" || z == "errchk")
	{
	window.alert("非法请求！请重新进行找回密码流程。");
	window.location.href="<?=HS_PATH?>member/getpassword.php";
	}
	else if(z == "lenpass")
	{
	c.innerHTML = "<span class='font06'>密码长度应该为5-20位</span>";
	}
	else if(z == "difpass")
	{
	c.innerHTML = "<span class='font06'>两次输入密码不一致，请检查！</span>";
	}
	else if(z == "nopass")
	{
	c.innerHTML = "<span class='font06'>请输入新密码！</span>";
	}
	else if(z == "unknow")
	{
	c.innerHTML = "<span class='font06'>密码修改失败，请与管理员联系！</span>";
	}
	else if(z == "true")
	{
	window.alert("修改成功!请以新密码登陆网站，如有需要，请立即修改游戏密码！");
	window.location.href="<?=HS_PATH?>member/login.php";
	}
}
}
//-->
</script>
<DIV class=main>
<DIV class=ad_main>
<DIV class=ad_main_m id=contents>
{if $frame == "checkinfo"}
<DIV class=tipsbox>请输入下面的信息，以帮您快速找回密码。</DIV>
<div class="tipsboxC" id="rmsg" style="margin:20px 200px;display:none"><span class="font06"></span></div>
<TABLE class=regform cellSpacing=0 cellPadding=0 width="80%" align=center 
border=0>
  <TBODY>

  <TR>
    <TH>用户名： </TH>
    <TD><INPUT class=inputA id=username> </TD></TR>
  <TR>
    <TH>验证码： </TH>
    <TD><INPUT class=inputB id="checkcode"> <img src="{HS_PATH}checkcode.php" id="checkcodeimg" onclick="this.src='{HS_PATH}checkcode.php?id='+Math.random()*5;" style="cursor:pointer;" alt="看不清楚?请点击刷新" align="absmiddle"/ height=30 width=80> </TD>
</TR>
  <TR>
    <TH>&nbsp; </TH>
    <TD><input type="button" class="hsbtn" value="下一步" onclick="checkuser()"> 
</TD></TR>
</TBODY></TABLE></DIV>

{elseif $frame == "sending"}
<DIV class=tipsbox>请登陆您的邮箱，进行重设密码确认：</DIV>
<DIV class=mailinfo>
<P>一封标题为“<SPAN class=font12><STRONG>{$HS[sitename]}找回密码</STRONG></SPAN>”的邮件已发送到您的邮箱</P>
<P><SPAN class=mailname>{$email}</SPAN></P>
<p style="text-align:center"><input type="submit" class="hsbtn" value="关闭" onclick="javascript:window.close()"></p></DIV>


{elseif $frame == "reseting"}
<DIV class=tipsbox>请得新设置您的密码，请以新密码登陆网站和游戏。</DIV>
<div class="tipsboxC" id="rmsg" style="margin:20px 200px;display:none"><span class="font06"></span></div>
<TABLE class=regform cellSpacing=0 cellPadding=0 width="80%" align=center 
border=0>
  <TBODY>
  <TR>
    <TH>新密码： </TH>
    <TD><INPUT type=password class=inputA id=password> </TD></TR>
  <TR>
    <TH>确认新密码： </TH>
    <TD><INPUT type=password class=inputA id=repassword></TD>
</TR>
  <TR>
    <TH>&nbsp; </TH>
    <TD><input id="username" type="hidden" value="{$username}" /> <input id="authstr" type="hidden" value="{$authstr}" />
	<input type="button" class="hsbtn" value="确认" onclick="resetpass()"> 
</TD></TR>
</TBODY></TABLE></DIV>
{/if}
</DIV></DIV></DIV>
{template 'member','footer'}