<?php defined('IN_HS') or exit('Access Denied'); ?>
<?php include template('member','header'); ?>

<script language="javascript">
<?php
sajax_show_javascript();
?>
function changeone(){
 document.getElementById("Gamelist").disabled=false;
 //document.getElementById("subok").disabled=true;
 document.getElementById("change").innerHTML = "";
 document.getElementById("fsos").innerHTML = "请先选择游戏分区";
 document.getElementById("fsoinfo").style.display="none";
}

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;font-weight:bold'>分区连接成功，请选择角色。</span>";
  document.getElementById("Gamelist").disabled=true;
  document.getElementById("change").innerHTML = "<a href='javascript:void(0);' onclick='changeone()'>重新选择</a>";
  listfso();
  }else{
  document.getElementById("message").style.display="block"
  document.getElementById("message").innerHTML = z;
  }
}
}

function listfso(){
var serverid = document.getElementById("Gamelist").value;
x_listfso(serverid,listfso_cb);

function listfso_cb(z) {
document.getElementById("fsos").innerHTML = z;
}
}

function doView(value){
var idserver = document.getElementById("Gamelist").value;
x_doView(idserver,value,doView_cb);

function doView_cb(z) {
document.getElementById("fsoinfo").innerHTML = z;
document.getElementById("fsoinfo").style.display="block";
}
}

function doSub(){
var idserver = document.getElementById("Gamelist").value;
var idfso = document.getElementById("idfso").value;
var newname = document.getElementById("newname").value;
x_doSub(idserver,idfso,newname,doSub_cb);

function doSub_cb(z) {
  if (z =="true"){
    window.alert("恭喜你,角色名称修改成功！");
window.location.href="<?=HS_PATH?>game/index.php";
  }else{
document.getElementById("message").innerHTML = z;
}
}
}
//-->
</script>

<DIV class=main>
<DIV class=main>

<?php include template('game','left'); ?>

<DIV class="ad_rbarB boxC">
<DIV class=columnC><SPAN class="l_tit f_l">角色昵称修改</SPAN></DIV>
<DIV class=mainboxD>
<div class="tipsboxC" id="message" style="display:none"></div>
<TABLE class=regform cellSpacing=0 cellPadding=0 width="80%" align=center border=0>
  <TBODY>
  <TR>
    <TH style="font-weight:bold;font-size:14px">游戏分区：</TH>
    <TD colSpan=2>
<select id="Gamelist" onchange="checkserv(this.value)">
<option>-- 请选择大区 --</option>

<?php if(is_array($gamelists)) foreach($gamelists AS $k => $games) { ?>
<option value="<?php echo $games['id'];?>">-- <?php echo $games['servername'];?> --</option>

<?php } ?>

</select> <span id=change></span>
  <TR>
    <TH style="font-weight:bold;font-size:14px">选择角色： </TH>
    <TD colSpan=2 id=fsos style="color:#ccc;font-size:14px;font-weight:bold">请先选择游戏分区</TD></TR>
 </TD></TR>
</TBODY></TABLE>
<div class="tipsboxC"><span class="fontH" style="font-weight:bold">改名需要游戏币：<?php if($MOD[cnamemoney] < '100000000') { ?><em style="font-weight:bold;color:#f00"><?= $MOD[cnamemoney]/10000 ?></em> 万<?php } else { ?><em style="font-weight:bold;color:#f00"><?= $MOD[cnamemoney]/100000000 ?></em> 亿<?php } ?>，并且保证角色正常退出游戏！</span></div>
<div id="fsoinfo" style="display:none">

</div>


  </DIV></DIV>
  </DIV></DIV></DIV>


<?php include template('member','footer'); ?>
