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

<script language="javascript">
<!--
function CheckForm() {
if ($F('reg_username') == "")
{
   $('tdUserNameValide').innerHTML="<div class=formtip_n>用户名不能为空";
    return false
 }
if ($F('reg_password') == "")
{
    $('tdPwdValide').innerHTML="<div class=formtip_n>密码不能为空";
    return false
 }
if ($F('pwdconfirm') != $F('reg_password'))
{
    $('tdRpwdValide').innerHTML="<div class=formtip_n>两次输入的密码不一致";
    return false
    }
if ($F('card') == "")
{
    $('trPwdValide').innerHTML="<div class=formtip_n>身份证不能为空";
    return false
 }
if ($F('s_q') == "")
{
    $('trS_QValide').innerHTML="<div class=formtip_n>安全问题不能为空";	 
    return false
    }	 
if ($F('t_ans') == "")
{
    $('tdAnsValide').innerHTML="<div class=formtip_n>安全答案不能为空";
    return false
    } 
if ($F('email') == "")
{
    $('tdEmailValide').innerHTML="<div class=formtip_n>邮箱地址不能为空";
    return false
 }
<?php if($MOD['enablecheckcodeofreg']) { ?>
if (myform.checkcodestr.value == "")
{
    $('tdCodeValide').innerHTML="<div class=formtip_n>验证码不能为空";
    return false
 }
<?php } ?>
    document.myform.submit.disabled = true;
}

function checkuser(inputname)
{
    if(inputname==''){
        $('tdUserNameValide').innerHTML="<div class=formtip_n>用户名不能为空";
    }else{
        var checkurl = '<?php echo $MOD['linkurl'];?>register.php';
var pars = "action=checkuser&username="+inputname;
var myAjax = new Ajax.Request(checkurl, {method: 'post', parameters: pars, onComplete: checkmessage});
    }
}

function checkmessage(Request)
{
if(Request.responseText == '1'){
$('tdUserNameValide').innerHTML="<div class=formtip_n>帐号应在5-12位之间！";
Field.clear('reg_username')
}else if(Request.responseText == '2'){
$('tdUserNameValide').innerHTML="<div class=formtip_n>您填写的帐号名含有非法字符";
Field.clear('reg_username')
}else if(Request.responseText == '3'){
$('tdUserNameValide').innerHTML="<div class=formtip_n>您填写的帐号名已被使用";
Field.clear('reg_username')
}else if(Request.responseText == '4'){
$('tdUserNameValide').innerHTML="<div class=formtip_n>您填写的帐号名被禁止使用";
Field.clear('reg_username')
}else if(Request.responseText == '5'){
$('tdUserNameValide').innerHTML="<div class=formtip_n>请不要使用其它字符，必须使用英文字母或数字";
Field.clear('reg_username')
}else{
$('tdUserNameValide').innerHTML="<div class=formtip_y>您注册的帐号名尚未被使用，可以注册。";
}
}

function checkpassword()
{
    if ($F('reg_password') == "")
{
    $('tdPwdValide').innerHTML="<div class=formtip_n>密码不能为空";
 }else if($F('reg_password').length <5||$F('reg_password').length>20){
    $('tdPwdValide').innerHTML="<div class=formtip_n>密码应该在5-20位之间";
Field.clear('reg_password')
 }else if($F('reg_password') == $F('reg_username')){
    $('tdPwdValide').innerHTML="<div class=formtip_n>密码不能与帐号相同";
Field.clear('reg_password')
}else{
    $('tdPwdValide').innerHTML="<div class=formtip_y>可以使用的密码";
 }
}

function checkpwdconfirm()
{
    if ($F('pwdconfirm') == "")
{
    $('tdRpwdValide').innerHTML="<div class=formtip_n>密码不能为空";
     }else if($F('pwdconfirm') != $F('reg_password')){
    $('tdRpwdValide').innerHTML="<div class=formtip_n>两次密码输入不一致";
Field.clear('pwdconfirm')
}else{
    $('tdRpwdValide').innerHTML="<div class=formtip_y>可以使用的密码";
 }
}




function checkzhengjian()
{
    if ($F('card') == "")
{
    $('trPwdValide').innerHTML="<div class=formtip_n>身份证不能为空";
 }else if($F('card').length <15||$F('card').length>18){
    $('trPwdValide').innerHTML="<div class=formtip_n>身份证应该在15-18位之间";
Field.clear('card')
}else{
    $('trPwdValide').innerHTML="<div class=formtip_y>可以使用的身份证";
 }
}




function checkwenti()
{
    if ($F('s_q') == "")
{
    $('trS_QValide').innerHTML="<div class=formtip_n>安全问题不能为空";
Field.clear('s_q')
}else{
    $('trS_QValide').innerHTML="<div class=formtip_y>可以使用的安全问题";
 }
}





function checkdaan()
{
    if ($F('t_ans') == "")
{
    $('tdAnsValide').innerHTML="<div class=formtip_n>安全答案不能为空";
 }else if($F('t_ans').length <4||$F('t_ans').length>6){
    $('tdAnsValide').innerHTML="<div class=formtip_n>安全答案应该在4-6位之间";
Field.clear('t_ans')
}else{
    $('tdAnsValide').innerHTML="<div class=formtip_y>可以使用的安全答案";
 }
}


function checkemail(email)
{
    if(email==''){
        $('tdEmailValide').innerHTML="<div class=formtip_n>邮箱地址不能为空";
    }else{
        var checkurl = '<?php echo $MOD['linkurl'];?>register.php';
var pars = "action=checkemail&email="+email;
var myAjax = new Ajax.Request(checkurl, {method: 'post', parameters: pars, onComplete: checkemailmessage});
    }
}

function checkemailmessage(Request)
{
if(Request.responseText == '1'){
 $('tdEmailValide').innerHTML="<div class=formtip_n>邮箱地址不合法";
Field.clear('email')
}else if(Request.responseText == '2'){
 $('tdEmailValide').innerHTML="<div class=formtip_n>邮箱地址已被使用";
Field.clear('email')
}else{
 $('tdEmailValide').innerHTML="<div class=formtip_y>可以注册的邮箱地址";
}
}



function chk_code()
{
    if ($F('code') == "")
{
    $('tdCodeValide').innerHTML="<div class=formtip_n>验证码不能为空";
     }else if($F('code').length != 4){
     $('tdCodeValide').innerHTML="<div class=formtip_n>验证码为4位";
 }else{
    $('tdCodeValide').innerHTML="&nbsp;";
 }
}

function regstart()
{
  $('creg').style.display="block";
}
//-->
</script>
<DIV class=main>
<DIV class=ad_main>
<DIV class=ad_main_m>
<form name="myform" method="post" action="<?php echo $MOD['linkurl'];?>register.php" onSubmit='return CheckForm();'>
<TABLE class=regform cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
  <TBODY>
  <TR>
    <TD style="font-size:14px;font-weight:bold;color:#FF0000;text-align:left;padding-left:50px">请选择你要注册的分区:</TD>
    </TR>
</TBODY></TABLE>
<style>
.server-list li{
list-style:none;
float:left;
margin-right:20px;
width:100px;
}
</style>
<ul class="server-list">
  	<?php if(is_array($servers)) foreach($servers AS $value) { ?>
<li><label style="font-size:14px; font-weight: bold; color: #333;"><input type='radio' name='gameid' id='gameid' value='<?php echo $value['id'];?>' onclick='regstart()'> <?php echo $value['servername'];?></span></label></li>
    
<?php } ?>

</ul>
<div id="creg" style="display:none">  
<TABLE class=regform cellSpacing=0 cellPadding=0 width="100%" align=center border=0 height="292">
  <TBODY>
  <TR>
<TD colspan="3" style="font-size:14px;font-weight:bold;color:#FF0000;text-align:left;padding-left:50px">填写注册资料：请妥善保管资料避免给您带来不必要的损失！</TD>
    </TR>
  <TR>
    <TH width="15%">帐号名称： </TH>
    <TD width="34%"><INPUT class=inputA id=reg_username onBlur="checkuser(this.value);" name=username style="ime-mode: disabled"> </TD>
    <TD id=tdUserNameValide width="51%"></TD></TR>
  <TR>
    <TH width="15%">登陆密码： </TH>
    <TD width="34%"><INPUT class=inputA id=reg_password onBlur="checkpassword();" type=password name=password> 
</TD>
    <TD id=tdPwdValide width="51%"></TD></TR>
  <TR>
    <TH width="15%">重复密码： </TH>
    <TD width="34%"><INPUT class=inputA id=pwdconfirm onBlur="checkpwdconfirm();" type=password name=pwdconfirm> 
    </TD>
    <TD id=tdRpwdValide width="51%"></TD></TR>
    <input type=hidden name="s_card_n" id="s_card" value="身份证">	
  <TR>
    <TH width="18%" height="19">身份证号： </TH>
    <TD width="33%" height="19"><INPUT class=inputA id=card name="card_n" onBlur="checkzhengjian();"></TD>
    <TD id=trPwdValide ></TD></TR>
  <TR>
    <TH height="19">密保问题： </TH>
    <TD height="19" ><LABEL>
      <SELECT class=inputA id="s_q" name="s_q_n" onBlur="checkwenti();"> <option selected>请选择</option> 
        <option value=母亲的名字>母亲的名字</option>
<option value=父亲的名字>父亲的名字</option> 
<option value="母亲的生日">母亲的生日</option>
<option value="父亲的生日">父亲的生日</option>
<option value="驾驶执照号">驾驶执照号</option>
<option value="计算机型号">计算机型号</option></SELECT></LABEL></TD>
    <TD id=trS_QValide height="19"></TD></TR>
  <TR>
    <TH width="18%" height="26">密保答案： </TH>
    <TD width="33%" height="26"><INPUT class=inputA id=t_ans name="t_ans_n" onBlur="checkdaan();"></TD>
    <TD id=tdAnsValide width="49%" height="26"></TD></TR>
  <TR>
    <TH width="15%">安全邮箱： </TH>
    <TD width="34%"><INPUT class=inputA id=email onBlur="checkemail(this.value);" name=email style="ime-mode: disabled"> </TD>
    <TD id=tdEmailValide width="51%"></TD></TR>
  <TR>
    <TH width="15%">&nbsp; </TH>
    <TD class=font04 colSpan=2 style="font-weight:bold;color:red">请确保该邮箱能接收邮件，在找回密码时将会往此邮箱发送确认邮件。  </TD>
  </TR>
  <?php if($MOD['enablecheckcodeofreg']) { ?>
  <TR>
    <TH width="15%">验证码： </TH>
    <TD width="34%"><INPUT class=inputB id=code onblur="chk_code()" name=checkcodestr style="ime-mode: disabled"> <img src="<?php echo HS_PATH;?>checkcode.php" id="checkcode" onclick="this.src='<?php echo HS_PATH;?>checkcode.php?id='+Math.random()*5;" style="cursor:pointer;" alt="看不清楚?请点击刷新" align="absmiddle" height=30 width=80> </TD>
    <TD id=tdCodeValide width="51%"></TD></TR>
<?php } ?>
</TBODY></TABLE>
<TABLE class=regform id=divUserInfo cellSpacing=0 cellPadding=0 width="100%" 
align=center border=0>
  <TBODY>
  <TR>
    <TH>　</TH>
    <TD colSpan=2>
<input name="dosubmit" type="hidden" id="dosubmit" value="1">
<input name="bill" type="hidden" id="bill" value="<?php echo $bill;?>">
<input name="submit" type="submit" class="hsbtn" value="注册"></TD></TR>
  <TR>
    <TH>　</TH>
    <TD colSpan=2 id=tdSubValide></TD></TR>
  </TBODY></TABLE>
</DIV></DIV></FORM>
</DIV>

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