<script language="JavaScript">
    var feifei=1;
 $(document).ready(function(){

       $.formValidator.initConfig({validatorgroup:"2",onerror:function(str){xiugaixinxi_fail();},onsuccess:function(str){xiugaixinxi_ok();}});
       var nickname=$("#nickname").val();
        $("#nickname").formValidator({validatorgroup:"2",
        //onshow:"请输入昵称",
    onfocus:"请输入昵称"}).inputValidator({min:0,max:20,onerror:"昵称过长"});         
           //var username=$("#username").val();
     
         $("#username").formValidator({validatorgroup:"2",onshow:"请输入手机号码/邮箱",onfocus:"请输入手机号码/邮箱",oncorrect:"格式正确"}).inputValidator({min:2,max:32,onerror:"请输入正确的邮箱和手机号"}).functionValidator({
        fun:function(val,elem){
            if(val.indexOf('@') > 0){
                
                if(val.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)){
                    
            var message=1;
           
           $.ajax({
        
                type: "post",
                dataType: "html",
                async: false,   //关键问题,采用同步传输方式
                url: "<?=site_url("member/reg_check")?>",
                data:"username="+val,
                success:function(data){
                    
                    if( data == 0 ) {
                        
                    } else {
                        message='用户重复';
                    }
                
                }
            });    



           return message;    
                }else{
                    return '格式错误';    
                }
            }else{
                
                if(val.match(/^1[3|4|5|8][0-9]\d{4,8}$/)){
                
          var message=1;
           
           $.ajax({
        
                type: "post",
                dataType: "html",
                async: false,   //关键问题,采用同步传输方式
                url: "<?=site_url("member/reg_check")?>",
                data:"username="+val,
                success:function(data){
                    
                    if( data == 0 ) {
                        
                    } else {
                        message='用户重复';
                    }
                
                }
            });






           return message;    
                  }else{
                       return "格式错误";
                  }
            }
        }
    });     
    
        $.formValidator.initConfig({validatorgroup:"3",onerror:function(str){xiugaixinxi_fail();},onsuccess:function(str){xiugaixinxi_ok();}});
        $("#old_password").formValidator({validatorgroup:"3",onfocus:"密码长度6到16位",oncorrect:'验证通过'}).inputValidator({min:6,max:16,onerror:"密码长度6到16位",oncorrect:""}).functionValidator({
        fun:function(val,elem){
            
            var message=1;
           
           $.ajax({
        
                type: "post",
                dataType: "html",
                async: false,   //关键问题,采用同步传输方式
                url: "<?=site_url("member/password")?>",
                data:"old_password="+val,
                success:function(data){
                    if( data == 1 ) {
                        
                    } else {
                        message='密码验证失败';
                    }
                
                }
            });    
           
           return message;    
            
            }
            
        });
            
            $("#password").formValidator({validatorgroup:"3",
                //onshow:"请输入密码",
                onfocus:"密码长度6到16位"}).inputValidator({min:6,max:16,onerror:"密码长度6到16位"});
            $("#pwdconfirm").formValidator({validatorgroup:"3",onshow:"请确认密码",onfocus:"请确认密码",oncorrect:"密码匹配"}).compareValidator({desid:"password",operateor:"=",onerror:"密码不匹配"});
        
    
 })


function Submit1_onclick() {
    return jQuery.formValidator.pageIsValid("1");
}
function Submit2_onclick() {

        if(feifei==0){

            return jQuery.formValidator.pageIsValid("2");
        }else{
            $('.zz_share_bg,.share_pop').show();
            return false;
        }


       // return jQuery.formValidator.pageIsValid("2");
    //}

}

function sss(){
    //$('.zz_share_bg,.share_pop').show();
     $.ajax({

         type: "post",
         dataType: "html",
         async: false,   //关键问题,采用同步传输方式
         url: "<?=site_url("member/password_zhongxinxiugai")?>",
         data:"username="+$('#hide_username').val()+"&pwd_check="+$('#pwd_check').val(),
         success:function(data){
            if(data==1){
                 feifei=0;
                $('.popup_bg4').show(300);
                setTimeout(function(){$('.popup_bg4').hide(300)},2000)
             }else{

                $('.popup_bg3').show(300);
                setTimeout(function(){$('.popup_bg3').hide(300)},2000)
             }

         }
     });
 }




function Submit3_onclick() {
    return jQuery.formValidator.pageIsValid("3");
}


</script>