{template 'member','header'}
<script language="javascript">
<?php
sajax_show_javascript();
?>
function selectq(){

 var tabtmp = document.getElementById('tabq').className;   
 document.getElementById('tabq').className = document.getElementById('tabi').className;   
 document.getElementById('tabi').className = tabtmp;
  
 document.getElementById("qconent").style.display="block";
 document.getElementById("iconent").style.display="none";
 document.getElementById("settype").value="setques";
}
function selecti(){

 var tabtmp = document.getElementById('tabq').className;   
 document.getElementById('tabq').className = document.getElementById('tabi').className;   
 document.getElementById('tabi').className = tabtmp;
 
 document.getElementById("qconent").style.display="none";
 document.getElementById("iconent").style.display="block";
 document.getElementById("settype").value="setcard";
}
function checkserv(thisid) {
  x_checkserv(thisid,checkserv_cb);
  function checkserv_cb(z) {
  if (z=="true"){
  document.getElementById("message").style.display="block"
  document.getElementById("message").innerHTML = "<span class=font06 style='color:green'>分区连接成功</span>";
  document.getElementById("idserver").disabled=true;
  document.getElementById("change").innerHTML = "<a href='javascript:void(0);' onclick='changeone()'>重新选择</a>";
  }else{
  document.getElementById("message").style.display="block"
  document.getElementById("message").innerHTML = z;
  }
}
}

function Checkit(){
	var c = document.getElementById("message");
	var settype = document.getElementById("settype").value;
	if (settype == "setques"){
	var memo = document.getElementById("answer").value;
	}else{
	var memo = document.getElementById("idcard").value;
	}
	var id = document.getElementById("idserver").value;
	c.style.display="block";
	c.innerHTML = "<span class='font06'>正在验证,请稍后...</span>";
	x_Checkit(id,settype,memo,Checkit_cb);

function Checkit_cb(z) {
  if(z=="true")
  {
	doSub(id);
	}
	else
	{
	document.getElementById("message").innerHTML = z;
	}
}
}



			 
function doSub(id){
	var c = document.getElementById("message");
	c.style.display="block";
	c.innerHTML = "<span class='font06'>正在修改,请稍后...</span>";
	x_doSub(id,doSub_cb);

function doSub_cb(z) {
  if(z=="true")
  {
    c.innerHTML = "<span class='font06'>清空成功！</span>";
	alert("恭喜您,该分区的仓库密码已清空！");
	window.location.href="<?=HS_PATH?>game/index.php";
	}
	else
	{
	document.getElementById("message").innerHTML = z;
	alert(z);
	}
}
}

function changeone(){
 document.getElementById("idserver").disabled=false;
 document.getElementById("change").innerHTML = "";
}
//-->
</script>

<DIV class=main>
<DIV class=main>
{template 'game','left'}
<DIV class="ad_rbarB boxC">
<DIV class=columnC><SPAN class="l_tit f_l">重置仓库密码</SPAN></DIV>
<DIV class=ad_tabnav id=seltab><A id="tabq" href="javascript:void(0)" onclick="selectq()" class=tabnow>通过密码提示问题</A><A id="tabi" href="javascript:void(0)" onclick="selecti()" class=tabno>通过身份证号码</A></DIV>
<DIV class=mainboxD id="centermsg">
<div class="tipsboxC" id="message" style="display: none"><span class="font06"></span></div>
<TABLE class=regform cellSpacing=0 cellPadding=0 width="80%" align=center border=0 id="step">
<TBODY>
    <TR>
    <TH>游戏分区： </TH>
    <TD colSpan=2>

	<SELECT name="idserver" id="idserver" onchange="checkserv(this.value)">
	<OPTION value="">-- 请选择 --</OPTION>
	{loop $servers $value}
	<OPTION value="{$value[id]}">{$value[servername]}</OPTION>
	{/loop}
	</SELECT> <span id=change></span>
	</TD></TR>
</TBODY>
	<TBODY id=qconent>
  <TR>
    <TH>密码提示问题： </TH>
    <TD colSpan=2>{$infos[question]} </TD>
  </TR>
  <TR>
    <TH>密码提示答案： </TH>
    <TD colSpan=2><INPUT class=inputA id=answer type=text> </TD></TR>
	</TBODY>
	<TBODY id=iconent style="display:none">
  <TR>
    <TH>身份证号码： </TH>
    <TD colSpan=2><input type=text class=inputA id=idcard /></TD>
  </TR>
  </TBODY>
  <TBODY>
  <TR>
    <TH><input type="hidden" value="setques" id="settype"></TH>
    <TD colSpan=2>
      <input type="submit" onClick="Checkit()" class="hsbtn" value="确认"></TD></TR>
	  </TBODY></TABLE>
	  <div class="tipsboxC"><span class="fontH" style="font-weight:bold">重置仓库密码是将仓库密码清空，重置成功后请进游戏重新设置仓库密码！请保护好自己的资料信息避免给你造成不必要的损失！</span></div>

</DIV></DIV>
	  </DIV></DIV></DIV>
{template 'member','footer'}