<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{$site_name}</title>
<meta name="keywords" content="{$site_key}">
<meta name="description" content="{$site_desc}">
<link href="css/dialog.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/fonts.css" rel="stylesheet">
<script src="js/jquery.min.js"></script>
<script src="js/superslide.js"></script>
<script src="js/code.js"></script>
<script src="js/tn_code.js"></script>
<script src="js/sucai.js"></script>
<script src="js/MiniDialog.js"></script>
<script src="js/masonry.js"></script>

<link type="image/png" href="favicon.ico" rel="shortcut icon">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<script>
function chk_reg(form){
	var chk=true
	if (!out_email()){chk=false}
	if (!out_pwd()){chk=false}
	if (!out_pwd2()){chk=false}
	if(chk){
		var name = $("#acount").val();
		var pwd  = $("#pwd").val();

		$.post("regact.php", {acount: name, pwd: pwd},function(data){
		   var rs=eval('('+data+')');
           var msg=rs.message;

		   if (rs.status==0){
		      Dialog.warn("注册失败", msg);
		   }
		   if (rs.status==1){
		      Dialog.success("提交成功", msg).ok(function () {
				 window.location="{$index}";
		      });
		   }
		   if (rs.status==2){
		      Dialog.success("注册成功", msg).ok(function () {
				 window.location="usercenter.php";
		      });
		   }
        });
	}
	return false;
}

function out_pwd(){
	var str=document.getElementById("pwd").value;
	var chk=true;
	if (str=='' || str.length<6 || str.length>12){chk=false;}
	if (chk){
        document.getElementById("pw").innerHTML='密码输入正确</font>';
	}else{
		document.getElementById("pw").innerHTML='<font color=red>密码字段必填,长度为6-12位数字或字符</font>';
		document.form.pwd.focus();
	}
	return chk;
}

function out_pwd2(){
    var str1=document.getElementById("pwd").value;
	var str2=document.getElementById("pwd2").value;
	var chk=true;
	if (str2=='' || str2.length<6 || str2.length>12 || str1!=str2){chk=false;}
	if (chk){
        document.getElementById("pw2").innerHTML='确认密码输入正确</font>';
	}else{
		document.getElementById("pw2").innerHTML='<font color=red>两次输入的密码必须一致,长度都为6-12位数字或字符</font>';
		document.form.pwd2.focus();
	}
	return chk;
}

function out_email() {
     var email = document.getElementById("acount").value;
     var patt1 = /^[a-z,A-Z,0-9]+@[a-z,A-Z,0-9]+.[a-z,A-Z]+$/;
	 var chk=true;
     if(form.acount.value=='') {
		 document.getElementById("email").innerHTML='<font color=red>帐号字段必填,请填写你的EMAIL地址</font>';
		 document.form.acount.focus();
         chk=false;
     }
	 if(email.match(patt1) == null){
	    document.getElementById("email").innerHTML='<font color=red>帐号不正确,请填写你的EMAIL地址</font>';
		document.form.acount.focus();
        chk=false;
		return false;
     }
	 if (chk){
        document.getElementById("email").innerHTML='帐号填写正确';
	 }else{
        document.getElementById("email").innerHTML='<font color=red>帐号字段必填,请填写你的EMAIL地址</font>';
		document.form.acount.focus();
	 }
     return chk;
}
</script>
<body>
    <?php 
	include_once('search_nav.php');
	?>
    <div class="fa-pins container clear" style="overflow:hidden;">
      <div class="fa-crumbs">
        <i class="ftsucai-227"></i>当前位置 :
        <a href="index.php">首页</a><span>></span>
		用户注册
	  </div>
      <div class="fa-pins-info" style="width:1158px;">
        <div class="pins-title">
          <h3 align="center">
            <strong>{$reg_title}</strong>
		  </h3>
        </div>
        <div class="pins-info" style="padding-top:0px;height:650px;">
		  <!--{if $do==1}-->
		  <form action="" method="post" name="form">
		  <table width="98%" border="0" class="font16">
		      <tr>
				<td width="28%" height="15" align="right" ></td>
				<td width="72%"></td>
			  </tr>
			  <!--{if $smtpoff==1}-->
			  <tr>
				<td width="28%" height="60" align="right" >说明：</td>
				<td width="72%"><font color="blue">本站已开启帐号验证机制，请填写你常用的EMAIL地址以便激活你注册的帐号!</font></td>
			  </tr>
			  <!--{/if}-->
			  <tr>
				<td width="28%" height="80" align="right" >帐号：</td>
				<td width="72%">
				  <input name="acount" type="text" class="myinput" id="acount" onBlur="out_email(this.value);" >
			      *<span id="email" style="font-size: 14px;">登录帐号请用EMAIL地址</span></td>
			  </tr>
			  <tr>
				<td  height="80" align="right">密码：</td>
				<td><input name="pwd" type="password" class="myinput" id="pwd" onBlur="out_pwd(this.value);">
				*<span id="pw" style="font-size: 14px;">登录密码请输入6-12位字符</span>
				</td>
			  </tr>
			  <tr>
				<td  height="80" align="right">确认密码：</td>
				<td><input name="pwd2" type="password" class="myinput" id="pwd2" onBlur="out_pwd2(this.value);">
				*<span id="pw2" style="font-size: 14px;">登录密码请输入6-12位字符</span>
				</td>
			  </tr>
			  <tr>
				<td height="80" align="right">验证：</td>
				<td align="left"><div class="tncode" style="text-align: center;"></div></td>
			  </tr>
			  <tr>
			    <td height="80" align="right"></td>
				<td  height="80" align="left">
				<input id="mybtn" class="mybtn" name="mybtn" type="button" value=" 确认提交 " onClick="chk_reg(form);" style="width:370px;cursor:pointer;">
				</td>
			  </tr>
		  </table>
		  </form>
		  <!--{else}-->
		  <div class="reg" contenteditable="true">{$reg}</div><br>
          <div align="center"><a class="mybtn" href="regist.php?do=1">我同意上述条款</a></div>
		  <!--{/if}-->
        </div>
      </div>
    </div>
    <?php 
	include_once('bottom.php');
	?>
</body>
</html>