<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>{#$title#}</title>
<meta http-equiv="X-UA-Compatible" content="IE=7">
<link rel="shortcut icon" href="{#$QISHI.main_domain#}favicon.ico" />
<meta name="author" content="骑士CMS" />
<meta name="copyright" content="74cms.com" />
<link href="{#$QISHI.site_template#}css/common.css" rel="stylesheet" type="text/css" />
<link href="{#$QISHI.site_template#}css/bind.css" rel="stylesheet" type="text/css" />
<script src="{#$QISHI.site_template#}js/jquery.js" type='text/javascript' language="javascript"></script>
<script src="{#$QISHI.site_template#}js/jquery.validate.min.js" type='text/javascript' language="javascript"></script>
<script type="text/javascript">
//验证
$(document).ready(function() {
//验证
 $("#Form1").validate({
//debug: true,
// onsubmit:false,
//onfocusout :true,
   rules:{
   username:{
    required: true,
  userName : true,
  byteRangeLength : [3, 18],  
  remote:{     
    url:"{#$QISHI.site_dir#}plus/ajax_user.php",     
    type:"post",    
    data:{"usname":function (){return $("#username").val()},"act":"check_usname"}     
    }
   },
   email:{
    required: true,
  email:true,
  remote:{     
    url:"{#$QISHI.site_dir#}plus/ajax_user.php",     
    type:"post",    
    data:{"email":function (){return $("#email").val()},"act":"check_email"}     
    }
   },
    password:{
    required: true,
  minlength:6,
    maxlength:18
   },
    password2:{
   required: true,
   equalTo:"#password"
   },
   member_type:{
    required: true
   }
  },
    messages: {
    username: {
    required: "请填写用户名",
  remote: jQuery.format("用户名已经存在或者不合法") 
   },
    email: {
    required: "请填写电子邮箱",
  email: jQuery.format("电子邮箱格式错误"),
  remote: jQuery.format("email已经存在")  
   },
   password: {
    required: "请填写密码",
    minlength: jQuery.format("填写不能小于{0}个字符"),
  maxlength: jQuery.format("填写不能大于{0}个字符")
   },
   password2: {
   required: "请填写密码",
    equalTo: "两次输入的密码不同"
   },
   member_type:{
    required: "请选择您要成为哪种会员"
   }
  },
  errorPlacement: function(error, element) {
    if ( element.is(":radio") )
        error.appendTo( $("#member_type_tip"));
    else if ( element.is(":checkbox") )
        error.appendTo ( element.next());
    else
        error.appendTo(element.parent());
  }
    });
   //中文字两个字节
  jQuery.validator.addMethod("byteRangeLength", function(value, element,  param) {
  var length = value.length;
  for (var i = 0; i < value.length; i++) {
      if (value.charCodeAt(i) > 127) {
      length++;
      }
    }
  return this.optional(element) || (length >= param[0] && length <= param[1]);
  }, "确保的值在3-18个字节之间(1个中文字算2个字节)");
   //字符验证
  jQuery.validator.addMethod("userName", function(value, element) {
  return this.optional(element) || /^[\u0391-\uFFE5\w]+$/.test(value);
  }, "用户名只能包括中文、英文字母、数字和下划线");
});
</script>
</head>
<body class="login_body">
  <div class="sign_up_box">
    <div class="container">
      <div class="sign_lgo"><img src="{#$QISHI.upfiles_dir#}{#$QISHI.web_logo#}" alt="{#$QISHI.site_name#}" /></div>
      <div class="sign_centent">
        <!-- 绑定表单 -->
        <div class="sign_left bind">
          <div class="bind_top">
            <h2>只差一步，即可完成登录设置</h2>
            <p>欢迎使用微博帐号登录{#$QISHI.site_name#}</p>
            <p>完成账号创建后，即可直接登录哦！</p>
          </div>
          <form id="Form1" name="Form1" method="post" action="?act=reg_save">
          <div class="sign_form">
            <ul>
              <li>
                <div class="w99"><span>*</span>会员类型：</div>
                <div class="input_box">
                  <input name="member_type" id="member_type" type="hidden" />
                  <div class="bind_radio select" id="2">个人</div>
                  <div class="bind_radio" id="1">企业</div>
                  <div class="clear"></div>
                </div>
                <div class="clear"></div>
              </li>
              <li>
                <div class="w99"><span>*</span>用户名：</div>
                <div class="input_box"><input type="text" class="sign_up_input_name" placeholder="请输入用户名" name="username" id="username" /></div>
                <div class="clear"></div>
              </li>
              <li>
                <div class="w99"><span>*</span>设置密码：</div>
                <div class="input_box"><input type="password" class="sign_up_input_pwd" placeholder="请输入登录密码" name="password" id="password" /></div>
                <div class="clear"></div>
              </li>
              <li>
                <div class="w99"><span>*</span>确认密码：</div>
                <div class="input_box"><input type="password" class="sign_up_input_pwd" placeholder="请确认登录密码" name="password2" id="password2" /></div>
                <div class="clear"></div>
              </li>
              <li>
                <div class="w99"><span>*</span>电子邮箱：</div>
                <div class="input_box"><input type="text" class="sign_up_input_mail" placeholder="请输入您的常用邮箱" name="email" id="email" /></div>
                <div class="clear"></div>
              </li>
              <li>
                <div class="w99">&nbsp;</div>
                <div class="input_box"><input type="submit" value="完成" name="reg" id="reg" class="sign_up_but_sign" /></div>
                <div class="clear"></div>
              </li>
            </ul>
          </div>
        </form>
        </div>
        <!-- 绑定表单 结束 -->

        <div class="sign_right">
          <div class="fast_login">
            <div class="content_box">
              <p>已经有帐号，登录与微博帐号关联登录</p>
              <div><input type="button" value="立即登录" class="sign_up_but_login" onclick="window.location='{#"QS_login"|qishi_url#}'"/></div>
                <div class="clear"></div> 
                <p><strong><a href="{#$sinaurl#}">[更换微博帐号]</a></strong></p>
            </div>
          </div>
          <div class="other_sign">
            <p>您是企业用户？<a href="{#$QISHI.main_domain#}user/user_reg.php?type=1">注册<strong>企业会员</strong></a></p>
            <p>您是个人用户？<a href="{#$QISHI.main_domain#}user/user_reg.php?type=2">注册<strong>个人会员</strong></a></p>
          </div>
        </div>
        <div class="clear"></div>
        
      </div>
    </div>
  </div>

  <script>
  $(document).ready(function() {
    var bind_obj = $(".input_box .bind_radio").first();
    $("#member_type").val(bind_obj.attr("id"));
    $(".input_box .bind_radio").click(function(){
      $("#member_type").val($(this).attr('id'));
      $(".input_box .bind_radio").removeClass("select");
      $(this).addClass("select");
    });
    $("input[type='button']").hover(function(){
      $(this).addClass('hover');
    },function(){
      $(this).removeClass('hover');
    })
  });
    
  </script>
</body>
</html>