<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" /><meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta name="keywords" content="百联保">
<meta name="description" content="百联保是百川信（厦门）网络技术有限公司基于金融创新并响应互联网＋计划搭建的第三方金融服务平台。秉承开拓金融创新，减轻企业负担的服务理念，百联保利用互联网平台优势并结合保险的市场作用，将与保证金、银行保函、担保公司保函具备同等效力的保证保险保函纳入经贸合作的担保形式之一，旨在减轻企业资金负担，简化申办流程，缩短办理周期，为企业客户提供低成本、高效率、安全专业的新型互联网金融服务。">

<title>百联保—注册基本信息</title>
<link href="<c:url value='/resources/css/public.css' />" rel="stylesheet" type="text/css" />
<link href="<c:url value='/resources/css/login.css' />" rel="stylesheet" type="text/css" />
<%-- 
<%
	AuthenticationException  authenticationException = (AuthenticationException)session.getAttribute(org.springframework.security.web.WebAttributes.AUTHENTICATION_EXCEPTION);
	if(authenticationException != null){
		request.setAttribute("loginMessage",authenticationException.getMessage());
	}
	session.setAttribute(org.springframework.security.web.WebAttributes.AUTHENTICATION_EXCEPTION,null);
	String errorMessage = (String)session.getAttribute("yzkeyerror");
	if(errorMessage != null && !"".equals(errorMessage)){
		session.setAttribute("yzkeyerror", null);
	}
%> --%>

</head>
<body>
<!-- logo 开始 -->
<div class="bzbx_logowar bg_fff">
	<div class="bzbx_logosub">
    	<p><a href="<c:url value='/' />"><img src="<c:url value='/resources/images/bzbx_logo.png'/>" width="219" height="50" title="百联保"></a></p>
        <p><label></label></p>
        <p>注册</p>
    </div>
</div>
<!-- logo 结束 -->

<!-- 内容部分  注册  开始 -->
<div class="reg_contentwar">
	<div class="clear"></div>
	<div class="reg_contentsub">
    	<div class="reg_message" id="reg_1">
        	<!-- 基本信息 邮箱激活 注册成功 开始 -->
        	<div class="reg_list" id="listing1">
                <div class="plan">
                    <ul>
                        <li><label>1</label></li>
                        <li><label>2</label></li>
                        <li><label>3</label></li>
                    </ul>
                </div>
                <div class="clear"></div>
                <div class="listing">
                    <ul>
                        <li id="color_ff6d37">基本信息</li>
                        <li>邮箱激活</li>
                        <li>注册成功</li>
                    </ul>
                </div>
            </div>
            <div class="reg_list" id="listing2" style="display: none;">
                <div class="plan">
                    <ul>
                        <li><label>1</label></li>
                        <li class="first_2_class"><label>2</label></li>
                        <li><label>3</label></li>
                    </ul>
                </div>
                <div class="clear"></div>
                <div class="listing">
                    <ul>
                        <li id="color_ff6d37">基本信息</li>
                        <li id="color_ff6d37">邮箱激活</li>
                        <li>注册成功</li>
                    </ul>
                </div>
            </div>
            <!-- 基本信息 邮箱激活 注册成功 结束 -->
            <!-- 基本信息 开始 -->
            <div class="reg_form">
            	<form action="<c:url value='/user/sendRE/init'/>" id="registerForm" name="registerForm" method="post">
                	<div id="form_1">
                	<p>
                        <span>用户名</span>
                        <span><input type="text" placeholder="7-20位以字母开头的字母数字组合" name="userName" id="regName" onblur="checkExistUserName(this)"  value="${user.userName }"/></span>
                        <span class="error_block"><img src="<c:url value='/resources/images/reg_error.png'/>">不能为空</span>
                    </p>
                    <div class="clear"></div>
                    <p>
                        <span>登录密码</span>
                        <span><input type="password" placeholder="6位以上的字母,数字,下划线" name="password" id="cPassword" value="${user.password }" onchange="pwdverify(this,'regConfirmPassword','0');"/></span>
                        <span class="error_block"><img src="<c:url value='/resources/images/reg_error.png'/>">不能为空</span>
                    </p>
                    <div class="clear"></div>
                    <p>
                        <span>确认密码</span>
                        <span><input type="password" placeholder="确认密码" name="regConfirmPassword"  id="regConfirmPassword" value="${user.password }" onchange="pwdverify(this,'cPassword','1');"/></span>
                        <span class="error_block"><img src="<c:url value='/resources/images/reg_error.png'/>">不能为空</span>
                    </p>
                    <div class="clear"></div>
                    
                    <p>
                        <span>手机号</span>
                        <span><input type="text" name="tel" id="tel" value="${user.classify }" placeholder="手机号码" onblur="checkExistTel('tel')"></span>
                        <span class="error_block"><img src="<c:url value='/resources/images/reg_error.png'/>">不能为空</span>
                    </p>
					<div class="clear"></div>
					<input type="hidden" id="ryzm_5">
                     <p>
                         <span>手机验证码</span>
                         <span id="code_input"><input type="text" id="ryzm" name='j_captcha' placeholder="请输入验证码" onchange="checkYzm(this);"></span>
                         <span><input type="button" id="auth_code" value="获取验证码"/></span>
                      	 <span class="error_block"><img src="<c:url value='/resources/images/reg_error.png'/>">不能为空</span>
                  	 </p>
                  
                  	<div class="clear"></div>
                  	<p class="sub_mit"><input type="button" id="regUp" value="下一步" onclick="register('1');"></p>
                  	<div class="clear"></div>
                    </div>
                    <div id="form_2" style="display: none;">
                    <p>
                        <span>邮箱地址</span>
                        <span><input type="text" placeholder="Email地址" name="email" id="email"  value="${user.validataCode }" onblur="checkExistEmail(this)"/></span>
                        <span class="error_block"><img src="<c:url value='/resources/images/reg_error.png'/>">请输入正确邮箱</span>
                    </p>
                    <div class="clear"></div>
                    <input type="hidden" id="ryzm_2">
                     <p>
                         <span>邮箱验证码</span>
                         <span id="code_input"><input type="text" id="ryzm2" name='j_captcha' placeholder="请输入验证码" onchange="checkYzms(this);"></span>
                         <span><input type="button" id="auth_code2" value="获取验证码"/></span>
                      	 <span class="error_block"><img src="<c:url value='/resources/images/reg_error.png'/>">不能为空</span>
                  	 </p>
                  
                  	<div class="clear"></div>
                    <p class="check_box">
                        <input type="checkbox" id="chek1"/>
                        <label  for="chek1"></label>
                        <span class="deal">我已阅读并同意<a href="<c:url value='/index/protocol/init' />" target="_blank">《百联保用户协议》</a></span>
                       	<span class="error_block"><img src="<c:url value='/resources/images/reg_error.png'/>">不能为空</span>
                    </p>
                    <p class="sub_mit"><input type="button" id="regUp" value="下一步" onclick="register('2');"></p>
                    </div>
                    <div id="form_3" style="display: none;">
                    <div class="clear"></div>
                    </div>
                    
                    
                    <%-- <div class="clear"></div>
                    <div class="reg_hint">
                    	<p>请输填写6～20位字符，只能输入数字、字母、符号，至少包含数字和字母（区分大小写）</p>
                        <label><img src="<c:url value='/resources/images/reg_hint.png'/>"></label>
                    </div> --%>
                </form>
            </div>
<!-- 基本信息 结束 -->
        </div>
        
        <div class="reg_message" id="reg_2" style="display: none;">
           	<!-- 基本信息 邮箱激活 注册成功 开始 -->
           	<div class="reg_list email_list finish_list">
                <div class="plan">
                    <ul>
                        <li><label>1</label></li>
                        <li><label>2</label></li>
                        <li><label>3</label></li>
                    </ul>
                </div>
                <div class="clear"></div>
                <div class="listing">
                    <ul>
                        <li id="color_ff6d37">基本信息</li>
                        <li id="color_ff6d37">邮箱激活</li>
                        <li id="color_ff6d37">注册成功</li>
                    </ul>
                </div>
            </div>
            <!-- 基本信息 邮箱激活 注册成功 结束 -->
            <!-- 注册完成 开始 -->
            <div class="reg_finish">
            	<p><img src="<c:url value='/resources/images/finish_img.jpg'/>" width="68" height="68" title="注册成功"></p>
                <div class="clear"></div>
                <h4>注册成功</h4>
                <p><a href="<c:url value='/'/>">购买保险</a><label></label><a href="<c:url value='/user/login/init'/>">立即登录</a></p>
            </div>
            <!-- 注册完成 结束 -->
        </div>
    </div>
</div>
<!-- 内容部分  注册  结束 -->
<jsp:include page="../../index/multi_f.jsp" />


<!-- script -->
<script src="<c:url value='/resources/script/jquery-1.8.3.min.js' />" type="text/javascript"></script>
<script src="<c:url value='/resources/js/insurance.js' />"></script>
<script type="text/javascript">
	var baseUrl = '${pageContext.request.contextPath }';
	$(function(){
		
		var msg = '${msg}';
	    if(msg.length>1){
	    	alert(msg);
	    }
	    var captchaCo = '${captchaCo}';
	    if(captchaCo == "300"){
	    	$("#ryzm").parent().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>验证码不正确");
	    	$("#ryzm").parent().next().next().attr("style","display:block;");
	    }
	});
	$(function(){
		$("#registerForm").keydown(function(e){
			 var e = e || event,
			 keycode = e.which || e.keyCode;
			 if (keycode==13) {
			  	$("#regUp").trigger("click");
			 }
		});
	});
	var wait=60;
	function time(o) {
	        if (wait == 0) {
	        	$("#auth_code").val("重新获取");   
	        	$("#auth_code").css("background-color","#ff6d37");
	            wait = 60;
				/*$("#btn").css("background-color","#229fff");*/
	        } else { // www.jbxue.com
	            $("#auth_code").val("重新发送(" + wait + ")");
	            wait--;
				$("#auth_code").css("background-color","#bbb6b6");
	            setTimeout(function() {
	                time(o)
	            },
	            1000)
	        }
	    }
	document.getElementById("auth_code").onclick=function(){
		var tel = $("#tel").val();
		if(tel == ""){

			$("#tel").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>手机不能为空");
    		$("#tel").parent().next().attr("style","display:block;");
		}else{
			$("#tel").parent().next().attr("style","display:none;");
    		$("#tel").parent().next().attr("style","display:none;");
			$.ajax({
    			type: 'POST',
    			url: baseUrl + "/user/register/sendAuthCode",
    			data:{'tel': tel},
    			dataType:"json",
    			cache: false,
    			success: function(json){
    				if(json.statusCode == '200') {
    					$("#auth_code").parent().next().attr("style","display:none;");
    					time(this);
    				}else if(json.statusCode == '301') {
    					$("#tel").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>"+json.resultDto.message);
    		    		$("#tel").parent().next().attr("style","display:block;");
    				}else{
    					$("#auth_code").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>"+json.resultDto.message);
    		    		$("#auth_code").parent().next().attr("style","display:block;");
    				}
    			}
    		}); 
			
		}
	}
  	//检查必选项
    function checkRegisterRequiredField(){
    	var regUserName = $("#regName").val();
    	//var email = $("#email").val();
    	var ryzm = $("#ryzm").val();
    	//var readMe = $("#chek1").attr("checked");
    	var tel = $("#tel").val();
    	var regPassword = $("#cPassword").val();
    	var regConfirmPassword = $("#regConfirmPassword").val();
    	if ( regUserName == "" || $("#regName").val() == $("#regName").attr("defaultValue")) {
    		$("#regName").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>登录名不能为空");
    		$("#regName").parent().next().attr("style","display:block;");
    		return false;
    	}else{
        	$("#regName").parent().next().attr("style","display:none;");
        }
    	/* if ( email == "" || $("#email").val() == $("#email").attr("defaultValue")) {
    		$("#email").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>邮箱不能为空");
    		$("#email").parent().next().attr("style","display:block;");
    		return false;
    	}else{
        	$("#email").parent().next().attr("style","display:none;");
        }
    	if(checkEmail(email) == false){
    		$("#email").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>邮箱格式有误");
    		$("#email").parent().next().attr("style","display:block;");
        	$('#email').focus();
        	 return false;
        }else{
        	$("#email").parent().next().attr("style","display:none;");
        } */
    	
    	
    	if ( regPassword == ""  || $("#cPassword").val() == "密码") {
    		$("#cPassword").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>密码不能为空");
    		$("#cPassword").parent().next().attr("style","display:block;");
    		return false;
    	}else{
        	$("#cPassword").parent().next().attr("style","display:none;");
        }
    	if ( regPassword.length < 6 ){
    		$(".reg_hint").attr("style","display:block;");
    		return false;
    	} else{
        	$(".reg_hint").attr("style","display:none;");
        }
    	
    	if ( regConfirmPassword == "" || $("#regConfirmPassword").val() == "确认密码" ) {
    		$("#regConfirmPassword").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>确认密码不能为空");
    		$("#regConfirmPassword").parent().next().attr("style","display:block;");
    		return false;
    	}else{
        	$("#regConfirmPassword").parent().next().attr("style","display:none;");
        }
    	
    	if ( regPassword != regConfirmPassword ){
    		$("#regConfirmPassword").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>密码不一致");
    		$("#regConfirmPassword").parent().next().attr("style","display:block;");
    		return false;
    	}else{
        	$("#regConfirmPassword").parent().next().attr("style","display:none;");
        }
    	
    	if(tel == "" || $("#tel").val() == $("#tel").attr("defaultValue")){
			$("#tel").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>手机不能为空");
    		$("#tel").parent().next().attr("style","display:block;");
		}else{
			$("#tel").parent().next().attr("style","display:none;");
		}
    	
    	if ( ryzm == "" || $("#ryzm").val() == $("#ryzm").attr("defaultValue")) {
    		$("#ryzm").parent().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>验证码不能为空");
    		$("#ryzm").parent().next().next().attr("style","display:block;");
    		return false;
    	}else{
        	$("#ryzm").parent().next().next().attr("style","display:none;");
        }
    	
    	if($("#ryzm_5").val() != "N") {
			$("#ryzm").parent().next().next().attr("style","display:none;");
		}else{
			$("#ryzm").parent().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>验证码不正确");
    		$("#ryzm").parent().next().next().attr("style","display:block;");
    		return false;
		}
    	
    	/* if (readMe != "checked" || !readMe) {
    		$("#chek1").next().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>阅读《服务协议》并勾选");
    		$("#chek1").next().next().next().attr("style","display:block;");
    		//alert("请详细阅读《服务协议》并勾选");
    		return false;
    	}else{
    		$("#chek1").next().next().next().attr("style","display:none;");
    	} */
    	
    	return true;
    }


  //(B)校验电子邮件 value:电子邮件的值，例：feizg@sinosoft.com.cn
    function checkEmail(value) {
    	var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    	return re.test(value);
    }
  
    //下一步
    function register(num){
    	if(num == "1"){
    		var flag = checkRegisterRequiredField();
        	if (flag){
        		$("#form_1").hide();
        		$("#listing1").hide();
        		$("#listing2").show();
        		$(".first_2_class").attr("id","first_2_class");
        		$("#form_2").show();
        	}
    	}else if(num == "2"){
    		var flag = checkRegisterRequiredFields();
        	if (flag){
        		$.ajax({
        			type: 'POST',
        			url: baseUrl + "/user/registerSava",
        			data:$("#registerForm").serialize(),
        			dataType:"json",
        			cache: false,
        			success: function(json){
        				if(json.statusCode == '200') {
        					$("#reg_1").hide();
        					$("#reg_2").show();
        				}else{
        					alert(json.resultDto.message);
        				}
        			}
        		}); 
        	}
    	}
    	/* var flag = checkRegisterRequiredField();
    	if (flag){
    		$("#registerForm").submit();
    	} */
    }

    function checkExistUserName(obj) {
    	//var test = obj.value.replace(/[^\w\.\/]/ig,'');
    	//var reg = /[^\w\.\/]/ig;  
    	var reg =/^[a-zA-Z][a-zA-Z0-9]{6,20}$/;
    	if(obj.value.length < 6) {
    		$("#"+obj.id).parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>账号长度不符合");
    		$("#"+obj.id).parent().next().attr("style","display:block;");
    		$("#"+obj.id).val('');
    	}else if(!reg.test(obj.value)){
    		$("#"+obj.id).parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>账号格式不符合");
    		$("#"+obj.id).parent().next().attr("style","display:block;");
    		$("#"+obj.id).val('');
    	} else if(obj.value == "userName"||obj.value == "username"||obj.value == "abcxin"||obj.value == "Abcxin"){
    		$("#"+obj.id).parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>关键词不可用");
    		$("#"+obj.id).parent().next().attr("style","display:block;");
    		$("#"+obj.id).val('');
    	} else{
    		$("#"+obj.id).parent().next().attr("style","display:none;");
    		if(obj.value != $("#regName").attr("defaultValue")) {
        		$.ajax({
        			type: 'POST',
        			url: baseUrl + "/user/register/checkUser.json",
        			data:{'loginName': obj.value},
        			dataType:"json",
        			cache: false,
        			success: function(json){
        				if(json.statusCode == '1') {
        					$("#regName").parent().next().html("<img title='"+json.resultDto.navTabId+"' src='<c:url value="/resources/images/reg_error.png"/>'>"+json.resultDto.message);
        		    		$("#regName").parent().next().attr("style","display:block;");
        					$("#regName").val($("#regName").attr("defaultValue"));
        					$("#regName").focus();
        				}else{
        					$("#regName").parent().next().attr("style","display:none;");
        				}
        			}
        		}); 
        	}
    	}
    	
    	
    }
    
    function checkYzm(obj) {
    	
   		$.ajax({
   			type: 'POST',
   			url: baseUrl + "/user/register/checkYzm.json",
   			data:{'captcha': $('#'+obj.id).val()},
   			dataType:"json",
   			success: function(json){
   				if(json.statusCode == "200") {
   					$("#ryzm").parent().next().next().attr("style","display:none;");
   					$("#ryzm_5").val("Y");
   				}else{
   					$("#ryzm").parent().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>验证码不正确");
   		    		$("#ryzm").parent().next().next().attr("style","display:block;");
   					$("#ryzm_5").val("N");
   				}
   			}
   		}); 
    }
    function pwdverify(this_,id_,sign_){
    	var this_val = this_.value;
    	var id_val = $("#"+id_).val();
    	if(sign_ == "0"){
    		if( this_val.length < 6){
    			$("#"+this_.id).parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>密码长度不符合");
        		$("#"+this_.id).parent().next().attr("style","display:block;");
        		$("#"+this_.id).val('');
        		return;
        	}else{
        		$("#"+id_).parent().next().attr("style","display:none;");
        	}
    	}
    	if( this_val == "" || this_val == $("#"+this_.id).attr("defaultValue")){
    		
    	}else{
    		if( id_val == "" || id_val == $("#"+id_).attr("defaultValue")){
    			
        	}else{
        		if(this_val != id_val){
            		$("#"+this_.id).parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>密码不一致");
            		$("#"+this_.id).parent().next().attr("style","display:block;");
            		$("#"+id_).parent().next().attr("style","display:none;");
            	}else{
            		$("#"+this_.id).parent().next().attr("style","display:none;");
            		$("#"+id_).parent().next().attr("style","display:none;");
            	}
        	}
    	}
    	
    }
    
    
    function checkExistEmail(obj) {
    	//var test = obj.value.replace(/[^\w\.\/]/ig,'');
    	var reg = /[^\w\.\/]/ig;  
    	
    	if(obj.value == "") {
    		$("#"+obj.id).parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>邮箱不能为空");
    		$("#"+obj.id).parent().next().attr("style","display:block;");
    		$("#"+obj.id).val('');
    	}if(checkEmail(obj.value) == false && obj.value != ""){
    		$("#email").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>邮箱格式有误");
    		$("#email").parent().next().attr("style","display:block;");
    		$("#email").val('');
        } else{
    		$("#"+obj.id).parent().next().attr("style","display:none;");
    		if(obj.value != $("#email").attr("defaultValue")) {
        		$.ajax({
        			type: 'POST',
        			url: baseUrl + "/user/register/checkEmail",
        			data:{'email': obj.value},
        			dataType:"json",
        			async: false,
        			success: function(json){
        				if(json.statusCode == '1') {
        					$("#email").parent().next().html("<img title='"+json.resultDto.navTabId+"' src='<c:url value="/resources/images/reg_error.png"/>'>"+json.resultDto.message);
        		    		$("#email").parent().next().attr("style","display:block;");
        					$("#email").val('');
        				}else{
        					$("#email").parent().next().attr("style","display:none;");
        				}
        			}
        		}); 
        	}
    	}
    	
    	
    }
    
    function checkExistTel(id_) {
    	var tels = $("#"+id_).val();
    	if(tels == "") {
    		$("#"+id_).parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>手机不能为空");
    		$("#"+id_).parent().next().attr("style","display:block;");
    		return false;
    	}else{
    		$("#"+id_).parent().next().attr("style","display:none;");
    		if(tels != $("#tel").attr("defaultValue")) {
        		$.ajax({
        			type: 'POST',
        			url: baseUrl + "/user/register/checkTel.json",
        			data:{'tel': tels},
        			dataType:"json",
        			async: true,
        			success: function(json){
        				if(json.statusCode == '1') {
        					$("#tel").parent().next().html("<img title='"+json.resultDto.navTabId+"' src='<c:url value="/resources/images/reg_error.png"/>'>"+json.resultDto.message);
        		    		$("#tel").parent().next().attr("style","display:block;");
        					$("#tel").val($("#tel").attr("defaultValue"));
        					return false;
        				}else{
        					$("#tel").parent().next().attr("style","display:none;");
        					return true;
        				}
        			}
        		}); 
        	}
    	}
    	
    }
    
    
    var wait2=60;
	function time2(o) {
	        if (wait2 == 0) {
	        	$("#auth_code2").val("重新获取");   
	        	$("#auth_code2").css("background-color","#ff6d37");
	            wait2 = 60;
				/*$("#btn").css("background-color","#229fff");*/
	        } else { // www.jbxue.com
	            $("#auth_code2").val("重新发送(" + wait2 + ")");
	            wait2--;
				$("#auth_code2").css("background-color","#bbb6b6");
	            setTimeout(function() {
	                time2(o)
	            },
	            1000)
	        }
	    }
	document.getElementById("auth_code2").onclick=function(){
		var email = $("#email").val();
		if(email == ""){
			$("#email").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>手机不能为空");
    		$("#email").parent().next().attr("style","display:block;");
		}else{
			$("#email").parent().next().attr("style","display:none;");
    		$("#email").parent().next().attr("style","display:none;");
			$.ajax({
    			type: 'POST',
    			url: baseUrl + "/user/register/sendAuthCodeE",
    			data:{'email': email},
    			dataType:"json",
    			cache: false,
    			success: function(json){
    				if(json.statusCode == '200') {
    					$("#auth_code2").parent().next().attr("style","display:none;");
    					time2(this);
    				}else if(json.statusCode == '301') {
    					$("#email").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>"+json.resultDto.message);
    		    		$("#email").parent().next().attr("style","display:block;");
    				}else{
    					$("#auth_code2").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>"+json.resultDto.message);
    		    		$("#auth_code2").parent().next().attr("style","display:block;");
    				}
    			}
    		}); 
			
		}
	}
    
	function checkYzms(obj) {
    		
   		$.ajax({
   			type: 'POST',
   			url: baseUrl + "/user/register/checkYzm.json",
   			data:{'captcha': $('#'+obj.id).val()},
   			dataType:"json",
   			success: function(json){
   				if(json.statusCode == "200") {
   					$("#ryzm2").parent().next().next().attr("style","display:none;");
   					$("#ryzm_2").val("Y");
   				}else{
   					$("#ryzm2").parent().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>验证码不正确");
   		    		$("#ryzm2").parent().next().next().attr("style","display:block;");
   					$("#ryzm_2").val("N");
   				}
   			}
   		}); 
    }
    
	function checkRegisterRequiredFields(){
    	var email = $("#email").val();
    	var ryzm2 = $("#ryzm2").val();
    	var readMe = $("#chek1").attr("checked");
    	
    	if ( email == "" || $("#email").val() == $("#email").attr("defaultValue")) {
    		$("#email").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>邮箱不能为空");
    		$("#email").parent().next().attr("style","display:block;");
    		return false;
    	}else{
        	$("#email").parent().next().attr("style","display:none;");
        }
    	if(checkEmail(email) == false){
    		$("#email").parent().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>邮箱格式有误");
    		$("#email").parent().next().attr("style","display:block;");
        	$('#email').focus();
        	 return false;
        }else{
        	$("#email").parent().next().attr("style","display:none;");
        } 
    	
    	
    	if ( ryzm2 == "" || $("#ryzm2").val() == $("#ryzm2").attr("defaultValue")) {
    		$("#ryzm2").parent().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>验证码不能为空");
    		$("#ryzm2").parent().next().next().attr("style","display:block;");
    		return false;
    	}else{
        	$("#ryzm2").parent().next().next().attr("style","display:none;");
        }
    	
    	if($("#ryzm_2").val() != "N") {
			$("#ryzm2").parent().next().next().attr("style","display:none;");
		}else{
			$("#ryzm2").parent().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>验证码不正确");
    		$("#ryzm2").parent().next().next().attr("style","display:block;");
    		return false;
		}
    	
    	if (readMe != "checked" || !readMe) {
    		$("#chek1").next().next().next().html("<img src='<c:url value="/resources/images/reg_error.png"/>'>阅读《服务协议》并勾选");
    		$("#chek1").next().next().next().attr("style","display:block;");
    		//alert("请详细阅读《服务协议》并勾选");
    		return false;
    	}else{
    		$("#chek1").next().next().next().attr("style","display:none;");
    	}
    	
    	return true;
    }
    
    
</script>
</body>
</html>