<script language="javascript" type="text/javascript">
var lastname = "";
var msg=new Array(
	"<font color='red'>用户名长度错误！</font>",
	"<font color='red'>此用户名包含不可接受字符或被管理员屏蔽,请选择其它用户名</font>",
	"<font color='red'>为了避免论坛用户名混乱,用户名中禁止使用大写字母,请使用小写字母</font>",
	"<font color='red'>该用户名已经被注册，请选用其他用户名。</font>",
	"<font color='green'>恭喜您，该用户名还未被注册，您可以使用这个用户名注册！</font>"
);
function namecheck() {
	var username = document.getElementById("regname").value;
	if (username == "") {
		return false;
	}
	if (username == lastname) {
		return false;
	}
	lastname = username;
	document.checkForm.username.value = username;
	document.getElementById("check_info").innerHTML = "检测中，请稍等...";
	document.checkForm.submit();
	return true;

}
function retmsg(id){
	document.getElementById("check_info").innerHTML = msg[id];
}
</script>
<!--
<?php
print <<<EOT
-->
<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center" class="MainTable">
  <tr> 
    <td width="100%" valign="top" class="Main"> 
	 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="dragTable">
        <tr>
          <td class="head"><h3 class="L"></h3><span class="TAG">会员注册</span><h3 class="R"></h3></td>
        </tr>
        <tr>
          <td class="middle">
<iframe id="Checkframe" name="Checkframe" width="0" height="0"></iframe>
<form name="checkForm" action="?" method="post" target="Checkframe">
  <input type="hidden" name="username" />
  <input type="hidden" name="action" value="regnameck" />
</form>
<form action="?" method="post" name="register" onSubmit="return regcheck(this);">
<div class="t">
                <table width="99%" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td colspan="2" class="h">必填信息</td>
                  </tr><!--
EOT;
if($webdb[RegCompany]){print <<<EOT
-->
					  <tr> 
                        <td >会员类型:</td>
                        <td > 
                          <input type="radio" name="grouptype" value="0" style="border:0px;" checked>
                          个人用户 
                          <input type="radio" name="grouptype" value="1" style="border:0px;">
                          企业用户</td>
                      </tr>
<!--
EOT;
}print <<<EOT
-->
                  <!--
EOT;
if($rg_question && $rg_variable){
print <<<EOT
-->
                  <tr class="tr3 f_one"> 
                    <td> 论坛防恶意注册<font color="red">*</font><br />
                      请输入答案： $rg_question</td>
                    <td> 
                      <input class="input" type="text" name="$rg_variable" />
                    </td>
                  </tr>
                  <!--
EOT;
}print <<<EOT
-->
                  <tr class="tr3 f_one"> 
                    <td width="35%"> 用户名<font color="red">*</font><br />
                      不能有空格，可以是中文，长度控制在 3 - 12 字节以内</td>
                    <td valign="top"> 
                      <input class="input" type="text" size="20" maxlength="14" name="regname" id="regname" />
                      <input class="btn" type="button" value="检查用户名" onClick="return namecheck();" />
                      <br />
                      &nbsp; 
                      <div id="check_info"></div>
                    </td>
                  </tr>
                  <tr class="tr3 f_two"> 
                    <td> 密码<font color="red">*</font><br />
                      英文字母或数字等不少于6位</td>
                    <td style="vertical-align:middle"> 
                      <input class="input" type="password" size="20" maxlength="75" name="regpwd" id="regpwd" onchange="checkpwd();" />
                      &nbsp; <span id="pwd_info"></span></td>
                  </tr>
                  <tr class="tr3 f_one"> 
                    <td> 确认密码<font color="red">*</font></td>
                    <td> 
                      <input class="input" type="password" size="20" maxlength="75" name="regpwdrepeat" id="regpwdrepeat" onchange="checkpwdrepeat();" />
                      &nbsp; <span id="pwdrepeat_info"></span></td>
                  </tr>
                  <tr class="tr3 f_two"> 
                    <td> Email<font color="red">*</font> </td>
                    <td> 
                      <input class="input" type="text" size="20" maxlength="75" name="regemail" value="" id="regemail" onchange="checkemail();" />
                      <input type="checkbox" name="regemailtoall" value="1" checked />
                      <font color="#000000">公开邮箱 </font>&nbsp;<span id="email_info"></span> 
                    </td>
                  </tr>
                  <!--
EOT;
if($reggd){
print <<<EOT
-->
                  <tr class="tr3 f_one"> 
                    <td>认证码<font color="red">*</font></td>
                    <td> 
                      <input class="input" type="text" maxLength="4" name="gdcode" size="10" />
                      <img src="$webdb[passport_url]/ck.php?nowtime=1" align="absmiddle" onclick="this.src='$webdb[passport_url]/ck.php?nowtime=1'" style="cursor:pointer;" /> 
                      请将图片中的数字或英文字母填入到文本框中</td>
                  </tr>
                
                  <!--
EOT;
}print <<<EOT
-->  <tr class="tr3 f_one"> 
                    <td colspan="2">
<SCRIPT LANGUAGE="JavaScript">
<!--
var filed_id='';
var filed_name='';
function ckregdata(a,b){
	filed_id=a;
	filed_name=b;
}
function ckregdatapost(){
	id_array=filed_id.split(',');
	name_array=filed_name.split(',');
	for(var i=0;i<id_array.length;i++){
		if(id_array[i]!=''&&document.getElementById(id_array[i]).value==''){
			alert("“"+name_array[i]+'”不能为空');
			document.getElementById(id_array[i]).focus();
			return false;
		}
	}
}
document.write('<script src="$webdb[www_url]/images/default/setday.js"><\/script>');
/*如要为页面布局考虑的话，你可以把template\default\regfield.htm里边的内容复制过来，然后把以下两行删除即可*/
document.write('<div id="showRegDiv"></div>');
AJAX.get("showRegDiv","regfield.php?job=reg");
//-->
</SCRIPT></td>
                  </tr>
                  <tr align="center"> 
                    <td colspan="2" class="head"><b>选填信息</b></td>
                  </tr>
                  <tr class="tr3 f_one"> 
                    <td> 性别</td>
                    <td> 
                      <select name="regsex">
                        <option value="1">男</option>
                        <option value="2">女</option>
                        <option value="0" selected>保密</option>
                      </select>
                    </td>
                  </tr>
                  <tr class="tr3 f_one"> 
                    <td> 生日</td>
                    <td> 
                      <select name="regbirthyear">
                        <option value=""></option>
                        <option value="1960">1960</option>
                        <option value="1961">1961</option>
                        <option value="1962">1962</option>
                        <option value="1963">1963</option>
                        <option value="1964">1964</option>
                        <option value="1965">1965</option>
                        <option value="1966">1966</option>
                        <option value="1967">1967</option>
                        <option value="1968">1968</option>
                        <option value="1969">1969</option>
                        <option value="1970">1970</option>
                        <option value="1971">1971</option>
                        <option value="1972">1972</option>
                        <option value="1973">1973</option>
                        <option value="1974">1974</option>
                        <option value="1975">1975</option>
                        <option value="1976">1976</option>
                        <option value="1977">1977</option>
                        <option value="1978">1978</option>
                        <option value="1979">1979</option>
                        <option value="1980">1980</option>
                        <option value="1981">1981</option>
                        <option value="1982">1982</option>
                        <option value="1983">1983</option>
                        <option value="1984">1984</option>
                        <option value="1985">1985</option>
                        <option value="1986">1986</option>
                        <option value="1987">1987</option>
                        <option value="1988">1988</option>
                        <option value="1989">1989</option>
                        <option value="1990">1990</option>
                        <option value="1991">1991</option>
                        <option value="1992">1992</option>
                        <option value="1993">1993</option>
                        <option value="1994">1994</option>
                        <option value="1995">1995</option>
                        <option value="1996">1996</option>
                        <option value="1997">1997</option>
                        <option value="1998">1998</option>
                        <option value="1999">1999</option>
                        <option value="2000">2000</option>
                      </select>
                      年 
                      <select name="regbirthmonth">
                        <option value=""></option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                      </select>
                      月 
                      <select name="regbirthday">
                        <option value=""></option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                        <option value="13">13</option>
                        <option value="14">14</option>
                        <option value="15">15</option>
                        <option value="16">16</option>
                        <option value="17">17</option>
                        <option value="18">18</option>
                        <option value="19">19</option>
                        <option value="20">20</option>
                        <option value="21">21</option>
                        <option value="22">22</option>
                        <option value="23">23</option>
                        <option value="24">24</option>
                        <option value="25">25</option>
                        <option value="26">26</option>
                        <option value="27">27</option>
                        <option value="28">28</option>
                        <option value="29">29</option>
                        <option value="30">30</option>
                        <option value="31">31</option>
                      </select>
                      日</td>
                  </tr>
                  <tr class="tr3 f_two"> 
                    <td>OICQ</td>
                    <td> 
                      <input class="input" type="text" size="20" maxlength="14" name="regoicq" value="" />
                    </td>
                  </tr>
                  <tr class="tr3 f_one"> 
                    <td>53kf</td>
                    <td> 
                      <input class="input" type="text" size="20" maxlength="14" name="regkf" value="" />
                      &nbsp;<a href="http://www.53kf.com/reg.htm?from=phpwind" target="_blank">注册53kf帐号</a></td>
                  </tr>
                  <tr class="tr3 f_two"> 
                    <td> 个人主页</td>
                    <td> 
                      <input class="input" type="text" size="20" maxlength="75" name="reghomepage" value="" />
                    </td>
                  </tr>
                  <tr class="tr3"> 
                    <td> 来自</td>
                    <td> 
                      <input class="input" type="text" size="20" maxlength="20" name="regfrom" />
                    </td>
                  </tr>
                  <tr class="tr3 f_two" style="display:none;"> 
                    <td> 选择您的头像<br />
                    </td>
                    <td> 
                      <div style="margin-bottom:5px;"> 
                        <select name="regicon" onChange="showimage('$imgpath',this.options[this.selectedIndex].value)">
                          <option value="">不使用</option>
$imgselect
                        </select>
                      </div>
                      <img src="$imgpath/face/none.gif" name="useravatars" /> 
                    </td>
                  </tr>
                  <tr class="tr3 f_one"> 
                    <td>个性化签名<br>
                      将附在每篇文章后</td>
                    <td> 
                      <textarea cols="50" name="regsign" rows="4"></textarea>
                    </td>
                  </tr>
                  <tr class="tr3 f_two"> 
                    <td> 自我简介<br>
                      --少于100字节</td>
                    <td> 
                      <textarea name="regintroduce" rows="4" cols="50"></textarea>
                    </td>
                  </tr>
                  <tr class="tr3 f_one"> 
                    <td> 是否接受系统邮件</td>
                    <td> 
                      <input type="radio" name="regifemail" value="1" checked />
                      接收邮件 
                      <input type="radio" name="regifemail" value="2" />
                      不接收邮件</td>
                  </tr>
                </table>
              </div>
              <input type="hidden" name="forward" value="$_fromurl" />
<input type="hidden" value="2" name="step" />
<div style="text-align:center;margin-bottom:25px;">
<input class="btn" type="submit" name="regsubmit" value="提 交" /></div></form>		 
			 
			 </td>
        </tr>
        <tr><td class="foot"><h3 class="L"></h3><h3 class="R"></h3></td></tr>
      </table>
</td>
</tr>
</table>
<!--
EOT;
?>
-->

<script language="JavaScript1.2">
document.register.regname.focus();
function showimage(imgpath,value){
	if(value!= '') {
		document.images.useravatars.src=imgpath+'/face/'+value;
	} else{
		document.images.useravatars.src=imgpath+'/face/none.gif';
	}
}
function regcheck(formct){
	if (formct.regname.value=='' || formct.regpwd.value=='' || formct.regpwdrepeat.value==''){
		alert('会员名或密码为空,请填写');
		return false;
	}
	if (formct.regpwd.value!=formct.regpwdrepeat.value){
		alert('两次输入的密码不一致，请检查后重试。');
		return false;
	}
	if (formct.regpwd.value.length<6){
		alert('密码太少，请用6位以上');
		return false;
	}
	if(ckregdatapost()==false){
		return false;
	}
	formct.regsubmit.disabled=true;
}
function checkpwd(){
	var pwd = document.getElementById("regpwd").value;
	var pwdrepeat = document.getElementById("regpwdrepeat").value;
	if (pwd.length<6){
		document.getElementById("pwd_info").innerHTML = "<font color=\"red\">密码太少，请用6位以上</font>";
	} else{
		document.getElementById("pwd_info").innerHTML = "";
	}
	if(pwdrepeat){
		checkpwdrepeat();
	}
}
function checkpwdrepeat(){
	var pwd = document.getElementById("regpwd").value;
	var pwdrepeat = document.getElementById("regpwdrepeat").value;
	if (pwdrepeat==pwd){
		document.getElementById("pwdrepeat_info").innerHTML = "";
	} else{
		document.getElementById("pwdrepeat_info").innerHTML = "<font color=\"red\">两次输入的密码不一致，请检查后重试。</font>";
	}
}
function checkemail(){
	var email = document.getElementById("regemail").value;
	var myReg = /^[-a-zA-Z0-9_\.]+@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,5}$/; 
	if(myReg.test(email)){
		document.getElementById("email_info").innerHTML = "";
	} else{
		document.getElementById("email_info").innerHTML = "<font color=\"red\">Email 格式错误!</font>";
	}
}
</script>
 

