/*Design by MT_Sniperwsz*/
/*2008.09.20*/

function regStep1(){}
/**************************************************验证开始**********************************************************/
regStep1.prototype.ChkUserName = function(){
    if(valid.userName($("user_name").value.replace(/\s+/g,""))&&$("user_name").value.replace(/\s+/g,"").length!=0){
		$("user_name1").style.display = "none";
		$("user_name2").style.display = "none";
		$("user_name3").style.display = "inline";
		$("spname").style.display="none";
		return true;
    }
    else{
        $("user_name1").style.display = "none";
        $("user_name2").style.display = "inline";
        $("user_name3").style.display = "none";
        $("spname").style.display="none";
        return false;
    }
}

regStep1.prototype.ChkPwd1=function(){
    if(valid.passWord($("user_password").value.replace(/\s+/g,""))&&$("user_password").value.replace(/\s+/g,"").length!=0){
        $("user_password1").style.display = "none";
        $("user_password2").style.display = "none";
        $("user_password3").style.display = "inline";
        return true;
    }
    else{
        $("user_password1").style.display = "none";
        $("user_password2").style.display = "inline";
        $("user_password3").style.display = "none";
        return false;
    }
}

regStep1.prototype.ChkPwd1_p=function(){
    if(valid.passWord($("user_password_p").value.replace(/\s+/g,""))&&$("user_password_p").value.replace(/\s+/g,"").length!=0){
        $("user_password1_p").style.display = "none";
        $("user_password2_p").style.display = "none";
        $("user_password3_p").style.display = "inline";
        return true;
    }
    else{
        $("user_password1_p").style.display = "none";
        $("user_password2_p").style.display = "inline";
        $("user_password3_p").style.display = "none";
        return false;
    }
}




regStep1.prototype.ChkPwd2=function(){
    if(valid.passWord($("user_password_2").value.replace(/\s+/g,""))&&$("user_password_2").value.replace(/\s+/g,"")==$("user_password").value.replace(/\s+/g,"")){
	    $("user_password21").style.display = "none";
        $("user_password22").style.display = "none";
        $("user_password23").style.display = "inline";
        return true;
    }
    else{
        $("user_password21").style.display = "none";
        $("user_password22").style.display = "inline";
        $("user_password23").style.display = "none";
        return false;
    }
}

regStep1.prototype.ChkPwd2_p=function(){
    if(valid.passWord($("user_password_2_p").value.replace(/\s+/g,""))&&$("user_password_2_p").value.replace(/\s+/g,"")==$("user_password_p").value.replace(/\s+/g,"")){
	    $("user_password21_p").style.display = "none";
        $("user_password22_p").style.display = "none";
        $("user_password23_p").style.display = "inline";
        return true;
    }
    else{
        $("user_password21_p").style.display = "none";
        $("user_password22_p").style.display = "inline";
        $("user_password23_p").style.display = "none";
        return false;
    }
}


regStep1.prototype.ChkTrueName=function(){
    if($("true_name").value.replace(/\s+/g,"").length!=0){
        $("true_name1").style.display = "none";
        $("true_name2").style.display = "none";
        $("true_name3").style.display = "inline";
        return true;
    }
    else{
        $("true_name1").style.display = "none";
        $("true_name2").style.display = "inline";
        $("true_name3").style.display = "none";
        return false;
    }
}
regStep1.prototype.ChkCoName=function(){
    if($("co_name").value.replace(/\s+/g,"").length!=0){
        $("co_name1").style.display = "none";
        $("co_name2").style.display = "none";
        $("co_name3").style.display = "inline";
        return true;
    }
    else{
        $("co_name1").style.display = "none";
        $("co_name2").style.display = "inline";
        $("co_name3").style.display = "none";
        return false;
    }
}
regStep1.prototype.ChkCoAddress=function(){
    if($("co_address").value.replace(/\s+/g,"").length!=0){
        $("co_address1").style.display = "none";
        $("co_address2").style.display = "none";
        $("co_address3").style.display = "inline";
        return true;
    }
    else{
        $("co_address1").style.display = "none";
        $("co_address2").style.display = "inline";
        $("co_address3").style.display = "none";
        return false;
    }
}
regStep1.prototype.ChkPartment=function(){
    if($("user_part").value.replace(/\s+/g,"").length!=0){
        $("user_part1").style.display = "none";
        $("user_part2").style.display = "none";
        $("user_part3").style.display = "inline";
        return true;
    }
    else{
        $("user_part1").style.display = "none";
        $("user_part2").style.display = "inline";
        $("user_part3").style.display = "none";
        return false;
    }
}
regStep1.prototype.ChkTelPhone=function(){
//    if($("code_1").value.replace(/\s+/g,"")!=""&&valid.isNum($("code_1").value.replace(/\s+/g,""))){//检测国家代码
//        $("code11").style.display = "none";
//        $("code12").style.display = "none";
//        $("code13").style.display = "inline";
//    }
//    else{
//        $("code11").style.display = "none";
//        $("code12").style.display = "inline";
//        $("code13").style.display = "none";
//        return false;
//    }
    
    if($("code_2").value.replace(/\s+/g,"")!=""&&valid.isNum($("code_2").value.replace(/\s+/g,""))){//检测区号
        $("code11").style.display = "none";
        $("code12").style.display = "none";
        $("code13").style.display = "inline";
    }
    else{
        $("code11").style.display = "none";
        $("code12").style.display = "inline";
        $("code13").style.display = "none";
        return false;
    }
	
    if($("code_3").value.replace(/\s+/g,"")!=""&&valid.isTelNum($("code_3").value.replace(/\s+/g,""))){
        $("code11").style.display = "none";
        $("code12").style.display = "none";
        $("code13").style.display = "inline";
    }
    else{
        $("code11").style.display = "none";
        $("code12").style.display = "inline";
        $("code13").style.display = "none";
        return false;
    }

}
regStep1.prototype.ChkTelPhone_s=function(){
//    if($("code_1_s").value.replace(/\s+/g,"")!=""&&valid.isNum($("code_1_s").value.replace(/\s+/g,""))){//检测国家代码
//        $("code11_s").style.display = "none";
//        $("code12_s").style.display = "none";
//        $("code13_s").style.display = "inline";
//    }
//    else{
//        $("code11_s").style.display = "none";
//        $("code12_s").style.display = "inline";
//        $("code13_s").style.display = "none";
//        return false;
//    }
    
    if($("code_2_s").value.replace(/\s+/g,"")!=""&&valid.isNum($("code_2_s").value.replace(/\s+/g,""))){//检测区号
        $("code11_s").style.display = "none";
        $("code12_s").style.display = "none";
        $("code13_s").style.display = "inline";
    }
    else{
        $("code11_s").style.display = "none";
        $("code12_s").style.display = "inline";
        $("code13_s").style.display = "none";
        return false;
    }
	
    if($("code_3_s").value.replace(/\s+/g,"")!=""&&valid.isTelNum($("code_3_s").value.replace(/\s+/g,""))){
        $("code11_s").style.display = "none";
        $("code12_s").style.display = "none";
        $("code13_s").style.display = "inline";
    }
    else{
        $("code11_s").style.display = "none";
        $("code12_s").style.display = "inline";
        $("code13_s").style.display = "none";
        return false;
    }

}


regStep1.prototype.ChkFax=function(){
    if(valid.isNum($("code2_1").value.replace(/\s+/g,""))){//检测国家代码
        $("code21").style.display = "none";
        $("code22").style.display = "none";
        $("code23").style.display = "inline";
        
    }
    else{
        $("code21").style.display = "none";
        $("code22").style.display = "inline";
        $("code23").style.display = "none";
        return false;
    }
    
    if(valid.isNum($("code2_2").value.replace(/\s+/g,""))){//检测区号
        $("code21").style.display = "none";
        $("code22").style.display = "none";
        $("code23").style.display = "inline";
    }
    else{
        $("code21").style.display = "none";
        $("code22").style.display = "inline";
        $("code23").style.display = "none";
        return false;
    }
    
    if(valid.isTelNum($("code2_3").value.replace(/\s+/g,""))){
        $("code21").style.display = "none";
        $("code22").style.display = "none";
        $("code23").style.display = "inline";
       
    }
    else{
        $("code21").style.display = "none";
        $("code22").style.display = "inline";
        $("code23").style.display = "none";
        return false;
    }
    return true;
}
regStep1.prototype.ChkQQ=function(){
    if($("txtQQ").value.replace(/\s+/g,"")!=""){//如果qq不为空
        if(valid.isQQ($("txtQQ").value.replace(/\s+/g,""))){//验证是否合法
            $("QQImg1").style.display = "none";
            $("QQImg2").style.display = "none";
            $("QQImg3").style.display = "inline";
            $("txtEmail").value.replace(/\s+/g,"")=$("txtQQ").value.replace(/\s+/g,"")+"@qq.com";
            this.ChkEmail();
            return true;
        }
        else{
            $("QQImg1").style.display = "none";
            $("QQImg2").style.display = "inline";
            $("QQImg3").style.display = "none";
            return false;
        }
    }
    else
    {
        $("QQImg1").style.display = "inline";
        $("QQImg2").style.display = "none";
        $("QQImg3").style.display = "none";
        //$("txtEmail").value="";
        return true;
    }
}

regStep1.prototype.ChkMsn=function(){
    if(valid.isEMail($("txtMsn").value.replace(/\s+/g,""))){
        $("MsnImg1").style.display = "none";
        $("MsnImg2").style.display = "none";
        $("MsnImg3").style.display = "inline";
        return true;
    }
    else{
        $("MsnImg1").style.display = "none";
        $("MsnImg2").style.display = "inline";
        $("MsnImg3").style.display = "none";
        return false;
    }
}
regStep1.prototype.ChkEmail=function(){
    if($("user_mail").value.replace(/\s+/g,"")!=""&&valid.isEMail($("user_mail").value.replace(/\s+/g,""))){
        $("user_mail1").style.display = "none";
        $("user_mail2").style.display = "none";
        $("user_mail3").style.display = "inline";
        return true;
    }
    else{
        $("user_mail1").style.display = "none";
        $("user_mail2").style.display = "inline";
        $("user_mail3").style.display = "none";
        return false;
    }
}
regStep1.prototype.ChkEmail_p=function(){
    if($("user_mail_p").value.replace(/\s+/g,"")!=""&&valid.isEMail($("user_mail_p").value.replace(/\s+/g,""))){
        $("user_mail1_p").style.display = "none";
        $("user_mail2_p").style.display = "none";
        $("user_mail3_p").style.display = "inline";
        return true;
    }
    else{
        $("user_mail1_p").style.display = "none";
        $("user_mail2_p").style.display = "inline";
        $("user_mail3_p").style.display = "none";
        return false;
    }
}
regStep1.prototype.ChkEmail_s=function(){
    if($("user_mail_s").value.replace(/\s+/g,"")!=""&&valid.isEMail($("user_mail_s").value.replace(/\s+/g,""))){
        $("user_mail1_s").style.display = "none";
        $("user_mail2_s").style.display = "none";
        $("user_mail3_s").style.display = "inline";
        return true;
    }
    else{
        $("user_mail1_s").style.display = "none";
        $("user_mail2_s").style.display = "inline";
        $("user_mail3_s").style.display = "none";
        return false;
    }
}

regStep1.prototype.ChkEmail_1=function(){
    if($("user_mail_1").value.replace(/\s+/g,"")!=""&&valid.isEMail($("user_mail_1").value.replace(/\s+/g,""))){
        $("user_mail1_1").style.display = "none";
        $("user_mail2_1").style.display = "none";
        $("user_mail3_1").style.display = "inline";
        return true;
    }
    else{
        $("user_mail1_1").style.display = "none";
        $("user_mail2_1").style.display = "inline";
        $("user_mail3_1").style.display = "none";
        return false;
    }
}
regStep1.prototype.ChkEmail_1_s=function(){
    if($("user_mail_1_s").value.replace(/\s+/g,"")!=""&&valid.isEMail($("user_mail_1_s").value.replace(/\s+/g,""))){
        $("user_mail1_1_s").style.display = "none";
        $("user_mail2_1_s").style.display = "none";
        $("user_mail3_1_s").style.display = "inline";
        return true;
    }
    else{
        $("user_mail1_1_s").style.display = "none";
        $("user_mail2_1_s").style.display = "inline";
        $("user_mail3_1_s").style.display = "none";
        return false;
    }
}


regStep1.prototype.ChkMobile=function(){  
        if(valid.isMobile($("user_ph").value.replace(/\s+/g,""))){
            $("user_ph1").style.display = "none";
            $("user_ph2").style.display = "none";
            $("user_ph3").style.display = "inline";
            return true;
        }
        else{
            $("user_ph1").style.display = "none";
            $("user_ph2").style.display = "inline";
            $("user_ph3").style.display = "none";
            return false;
        }
        return true;
}
regStep1.prototype.ChkMobile_p=function(){  
        if(valid.isMobile($("user_ph_p").value.replace(/\s+/g,""))){
            $("user_ph1_p").style.display = "none";
            $("user_ph2_p").style.display = "none";
            $("user_ph3_p").style.display = "inline";
            return true;
        }
        else{
            $("user_ph1_p").style.display = "none";
            $("user_ph2_p").style.display = "inline";
            $("user_ph3_p").style.display = "none";
            return false;
        }
        return true;
}
regStep1.prototype.ChkMobile_s=function(){  
        if(valid.isMobile($("user_ph_s").value.replace(/\s+/g,""))){
            $("user_ph1_s").style.display = "none";
            $("user_ph2_s").style.display = "none";
            $("user_ph3_s").style.display = "inline";
            return true;
        }
        else{
            $("user_ph1_s").style.display = "none";
            $("user_ph2_s").style.display = "inline";
            $("user_ph3_s").style.display = "none";
            return false;
        }
        return true;
}

regStep1.prototype.ChkMobile_1=function(){  
        if(valid.isMobile($("user_ph_1").value.replace(/\s+/g,""))){
            $("user_ph1_1").style.display = "none";
            $("user_ph2_1").style.display = "none";
            $("user_ph3_1").style.display = "inline";
            return true;
        }
        else{
            $("user_ph1_1").style.display = "none";
            $("user_ph2_1").style.display = "inline";
            $("user_ph3_1").style.display = "none";
            return false;
        }
        return true;
}
regStep1.prototype.ChkMobile_1_s=function(){  
        if(valid.isMobile($("user_ph_1_s").value.replace(/\s+/g,""))){
            $("user_ph1_1_s").style.display = "none";
            $("user_ph2_1_s").style.display = "none";
            $("user_ph3_1_s").style.display = "inline";
            return true;
        }
        else{
            $("user_ph1_1_s").style.display = "none";
            $("user_ph2_1_s").style.display = "inline";
            $("user_ph3_1_s").style.display = "none";
            return false;
        }
        return true;
}

/******************************/
/**修改人：李晨2009-8-14*******/
/**原因：添加了3个会员类型*****/
/******************************/
regStep1.prototype.ChkMType=function(){    
         if($("memberT2").checked||$("memberT3").checked||$("memberT4").checked||$("memberT5").checked){
            $("memberImg1").style.display = "none";
            $("memberImg2").style.display = "none";
            $("memberImg3").style.display = "inline";
            return true;
          
         }
         else{
            $("memberImg1").style.display = "none";
            $("memberImg2").style.display = "inline";
            $("memberImg3").style.display = "none";
            return false;
         }
}
regStep1.prototype.CheckForm = function(){
    //if(Sniper.CheckSession().value=="0"){//如果已经第一步注册未完成
        if(!this.ChkUserName()){show_error("请正确填写您的注册用户名称。");return false;}
        if(!this.ChkPwd1()){show_error("请正确填写您的注册用户密码。");return false;}
        if(!this.ChkPwd2()){show_error("您输入的密码不一致。");return false;}
        if(!this.ChkPartment()){show_error("请正确填写您的职务。");return false;}
        //if(!this.ChkTelPhone()){show_error("请正确填写您的固定电话。");return false;}
        //if(!this.ChkFax())return false;
        //if(!this.ChkQQ())return false;
        //if(!this.ChkMsn()){show_error("请正确填写您的MSN。");return false;}
        if(!this.ChkEmail()){show_error("请正确填写您电子邮箱。");return false;}
        if(!this.ChkMType()){show_error("请您选择会员类型");return false;}
        //if(!this.ChkMobile())return false;
  
    return true;
}
/**********************************************验证结束******************************************************/
regStep1.prototype.RegMe=function(){
    var r=new regStep2();
    if(this.CheckForm()){
        var sex="1";
        if(document.getElementsByName("colxrsex")[1].checked)
            sex="0";
        var telPhone = $("code_1").value + "-" + $("code_2").value + "-" + $("code_3").value;
        var fax = $("code2_1").value + "-" + $("code2_2").value + "-" + $("code2_3").value;
        
        var result = Sniper.AddClientUser($("user_name").value, $("user_password").value, $("co_name").value, $("co_address").value, $("true_name").value, sex,
        $("user_part").value, telPhone, fax, $("user_mail").value, $("user_ph").value).value;
        var jsonobj = eval("data=" + result);
        try{
            if(jsonobj.Detail){//如果Detail的Key存在
                if(parseInt(jsonobj.Detail[0].Success)>0){
                           r.go();
                }
            }
            else if(jsonobj.Session){//如果有Session，说明已经提交过，跳转掉。
                show_error("您已经完成了第一步注册。","r.go()");
            }
        }
        catch(ex){
            show_error(jsonobj.Error);//如果不返回Detail，则会返回Error的key
        }
    }
  
}

/******************************/
/**修改人：李晨2009-8-14*******/
/**功能：重新填写信息全部清空**/
/******************************/
regStep1.prototype.reset1=function(){
    /*****用户名****/
    $("txtUserName").value ="";
    $("UserNameImg1").style.display = "inline";
    $("UserNameImg2").style.display = "none";
    $("UserNameImg3").style.display = "none";
    /*****密码****/
    $("txtPwd1").value ="";
    $("Pwd1Img1").style.display = "inline";
    $("Pwd1Img2").style.display = "none";
    $("Pwd1Img3").style.display = "none";
    
    $("txtPwd2").value ="";
    $("Pwd2Img1").style.display = "inline";
    $("Pwd2Img2").style.display = "none";
    $("Pwd2Img3").style.display = "none";
    
   /*****密码强度*****/
    $("strength_L").style.background="#eeeeee";
    $("strength_M").style.background="#eeeeee";
    $("strength_H").style.background="#eeeeee";
    $("strength_M").className=""
    $("strength_L").className="zi01";
    $("strength_H").className="";
    /****真是姓名****/
    $("txtTrueName").value ="";
    $("TrueNameImg1").style.display = "inline";
    $("TrueNameImg2").style.display = "none";
    $("TrueNameImg3").style.display = "none";
    /***性别*********/
    $("rbSex").checked = true;
    /***本人职务******/
    $("txtPartment").value = "";
    $("PartmentImg1").style.display = "inline";
    $("PartmentImg2").style.display = "none";
    $("PartmentImg3").style.display = "none";
    /****固定电话******/
    $("txtAreaCode").value = "";
    $("txtTelPhone").value = "";
    $("TelPhoneImg1").style.display = "inline";
    $("TelPhoneImg2").style.display = "none";
    $("TelPhoneImg3").style.display = "none";
    /*****传真*******/
    $("txtFax").value = "";
    $("txtAreaCodeFax").value = "";
    $("FaxImg1").style.display = "inline";
    $("FaxImg2").style.display = "none";
    $("FaxImg3").style.display = "none";
    /******手机************/
    $("txtMobile").value = "";
    $("MobileImg1").style.display = "inline";
    $("MobileImg2").style.display = "none";
    $("MobileImg3").style.display = "none";
    /****QQ,MSN****************/
    $("txtQQ").value = "";
    $("txtMsn").value = "";
    $("MsnImg1").style.display = "inline";
    $("MsnImg2").style.display = "none";
    $("MsnImg3").style.display = "none";
    /********Email*************/
    $("txtEmail").value = "";
    $("EmailImg1").style.display = "inline";
    $("EmailImg2").style.display = "none";
    $("EmailImg3").style.display = "none";
    /******会员类型****************/
    $("memberT3").checked = false;
    $("memberT2").checked = false;
    $("memberT5").checked = false;
    $("memberT4").checked = false;
    $("memberImg1").style.display = "inline";
    $("memberImg2").style.display = "none";
    $("memberImg3").style.display = "none";
    $("PersonalImg1").style.display = "inline";
    $("PersonalImg2").style.display = "none";
    $("PersonalImg3").style.display = "none"; 
}
function regStep2(){}
regStep2.prototype.go=function(){
    this.updateUserType();
    //this.receiveEmail();
    var result = "0";//获取选择了哪个类型，然后根据该类型对应的hidden控件来确定跳到哪个页面
    var rbs = document.getElementsByName("rbUserType");
    for(var i=0;i<rbs.length;i++){
        if(rbs[i].checked)
            result = rbs[i].value;
    }  
   switch(result){ //根据result跳转了
        case "1": //
           location.replace('/login/Login.aspx?Reg_3_Produce');
        break;
        case "2": 
            location.replace('/login/Login.aspx?Reg_3_Trade');
        break;
        case "3": 
         location.replace('/login/Login.aspx?Reg_3_Service');
        break;
        case "4": 
           location.replace('/login/Login.aspx?Reg_3_1');
        break;
        case "5": 
           location.replace('/login/Login.aspx?Reg_3_Other');
        break;
        case "6": 
        
        break;
        case "7": 
        
        break;
        case "8": 
        
        break;
        case "9": 
        
    } 

}
regStep2.prototype.updateUserType=function(){
    var result = "0";
    var rbs = document.getElementsByName("rbUserType");
    for(var i=0;i<rbs.length;i++){
        if(rbs[i].checked)
            result = rbs[i].value;
    }
    var upvalue = Sniper.UpdateUserType(result).value;
    var jsonobj = eval("data="+upvalue);
    try{
        if(!jsonobj.Detail){
            show_error("用户类型更改失败");
            return false;
        }
    }
    catch(ex){
       
    }
}
regStep2.prototype.receiveEmail=function(){
    var result="0";
    if($("cbReceiveEmail").checked)
        result = "1";
    
    var rvalue = Sniper.AddAppendInfo(result).value;
    var jsonobj = eval("data="+rvalue);
    try{
        if(!jsonobj.Detail){
            show_error("【我愿意收到我感兴趣的买卖信息】更改失败");
            return false;
        }
    }
    catch(ex){
    
    }
}









function regStep3()
{
  
}
//begin---------------------个人表单检测-------------------------
regStep3.prototype.ChkCard = function(){
    if(valid.isCard($("txtCardId").value)&&$("txtCardId").value!=""){
            $("UserCardImg1").style.display = "none";
            $("UserCardImg2").style.display = "none";
            $("UserCardImg3").style.display = "inline";
            return true;
    }
    else{
        $("UserCardImg1").style.display = "none";
        $("UserCardImg2").style.display = "inline";
        $("UserCardImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkUrl = function(){
    if(valid.isUrl0k($("txturl").value)){
            $("UrlImg1").style.display = "none";
            $("UrlImg2").style.display = "none";
            $("UrlImg3").style.display = "inline";
            return true;
    }
    else{
        $("UrlImg1").style.display = "none";
        $("UrlImg2").style.display = "inline";
        $("UrlImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkPostAddr = function(){
    if(!valid.isEmpty($("txtPostAddr").value)){
            $("PostAddrImg1").style.display = "none";
            $("PostAddrImg2").style.display = "none";
            $("PostAddrImg3").style.display = "inline";
            return true;
    }
    else{
        $("PostAddrImg1").style.display = "none";
        $("PostAddrImg2").style.display = "inline";
        $("PostAddrImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkIntr = function(){
    if(!valid.isEmpty($("txtIntr").value)){
            $("IntrImg1").style.display = "none";
            $("IntrImg2").style.display = "none";
            $("IntrImg3").style.display = "inline";
            return true;
    }
    else{
        $("IntrImg1").style.display = "none";
        $("IntrImg2").style.display = "inline";
        $("IntrImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkPicture = function(){
    if(!valid.isEmpty($("Picture").value)){
            $("PictureImg1").style.display = "none";
            $("PictureImg2").style.display = "none";
            $("PictureImg3").style.display = "inline";
            return true;
    }
    else{
        $("PictureImg1").style.display = "none";
        $("PictureImg2").style.display = "inline";
        $("PictureImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.Chkform=function(){
    if(!this.ChkCard()){show_error("请正确填写您的身份证号码。");return false;}
    if(!this.ChkPostAddr()){show_error("请正确填写您的邮寄地址。");return false;}
    if(!this.ChkIntr()){show_error("请正确填写您的个人简介。");return false;}
    //if(!this.ChkPicture()){show_error("请正确上传您的身份证号。");return false;}
    //if(!this.ChkUrl()){show_error("请正确填写您的个人网址。");return false;}
    return true;
}
//--------------------------end------------------------
///-----------------------beging商业服务企业注册,表单检测---------
regStep3.prototype.ChkComName = function(){
    if(!valid.isEmpty($("txtComName").value)){
            $("ComNameImg1").style.display = "none";
            $("ComNameImg2").style.display = "none";
            $("ComNameImg3").style.display = "inline";
            return true;
    }
    else{
        $("ComNameImg1").style.display = "none";
        $("ComNameImg2").style.display = "inline";
        $("ComNameImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkRegCode = function(){
    if(!valid.isEmpty($("txtRegCode").value)){
            $("RegCodeImg1").style.display = "none";
            $("RegCodeImg2").style.display = "none";
            $("RegCodeImg3").style.display = "inline";
            return true;
    }
    else{
        $("RegCodeImg1").style.display = "none";
        $("RegCodeImg2").style.display = "inline";
        $("RegCodeImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkWeburl = function(){
    if(!valid.isEmpty($("txtUrl").value)){
            $("UrlImg1").style.display = "none";
            $("UrlImg2").style.display = "none";
            $("UrlImg3").style.display = "inline";
            return true;
    }
    else{
        $("UrlImg1").style.display = "none";
        $("UrlImg2").style.display = "inline";
        $("UrlImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkProvince = function(){
    if(!valid.isEmpty($("selProvinceID").value)){
            $("ProvinceImg1").style.display = "none";
            $("ProvinceImg2").style.display = "none";
            $("ProvinceImg3").style.display = "inline";
            return true;
    }
    else{
        $("ProvinceImg1").style.display = "none";
        $("ProvinceImg2").style.display = "inline";
        $("ProvinceImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkCity = function(){
    if(!valid.isEmpty($("selCityID").value)){
            $("CityImg1").style.display = "none";
            $("CityImg2").style.display = "none";
            $("CityImg3").style.display = "inline";
            return true;
    }
    else{
        $("CityImg1").style.display = "none";
        $("CityImg2").style.display = "inline";
        $("CityImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkComAddr = function(){
    if(!valid.isEmpty($("txtComAddr").value)){
            $("ComAddrImg1").style.display = "none";
            $("ComAddrImg2").style.display = "none";
            $("ComAddrImg3").style.display = "inline";
            return true;
    }
    else{
        $("ComAddrImg1").style.display = "none";
        $("ComAddrImg2").style.display = "inline";
        $("ComAddrImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkTelPhone=function(){
//    if($("txtNationalCode").value!=""&&valid.isNum($("txtNationalCode").value)){//检测国家代码
//        $("TelPhoneImg1").style.display = "none";
//        $("TelPhoneImg2").style.display = "none";
//        $("TelPhoneImg3").style.display = "inline";
//    }
//    else{
//        $("TelPhoneImg1").style.display = "none";
//        $("TelPhoneImg2").style.display = "inline";
//        $("TelPhoneImg3").style.display = "none";
//        return false;
//    }
    
    if($("txtAreaCode").value!=""&&valid.isNum($("txtAreaCode").value)){//检测区号
        $("TelPhoneImg1").style.display = "none";
        $("TelPhoneImg2").style.display = "none";
        $("TelPhoneImg3").style.display = "inline";
    }
    else{
        $("TelPhoneImg1").style.display = "none";
        $("TelPhoneImg2").style.display = "inline";
        $("TelPhoneImg3").style.display = "none";
        return false;
    }

    if($("txtTelPhone").value!=""&&valid.isTelNum($("txtTelPhone").value)){
        $("TelPhoneImg1").style.display = "none";
        $("TelPhoneImg2").style.display = "none";
        $("TelPhoneImg3").style.display = "inline";
        return true;
    }
    else{
        $("TelPhoneImg1").style.display = "none";
        $("TelPhoneImg2").style.display = "inline";
        $("TelPhoneImg3").style.display = "none";
        return false;
    }
}

regStep3.prototype.ChkFax=function(){
    if($("txtNationalCodeFax").value!=""&&valid.isNum($("txtNationalCodeFax").value)){//检测国家代码
        $("FaxImg1").style.display = "none";
        $("FaxImg2").style.display = "none";
        $("FaxImg3").style.display = "inline";
        
    }
    else{
        $("FaxImg1").style.display = "none";
        $("FaxImg2").style.display = "inline";
        $("FaxImg3").style.display = "none";
        return false;
    }
    
    if(valid.isNum($("txtAreaCodeFax").value)){//检测区号
        $("FaxImg1").style.display = "none";
        $("FaxImg2").style.display = "none";
        $("FaxImg3").style.display = "inline";
    }
    else{
        $("FaxImg1").style.display = "none";
        $("FaxImg2").style.display = "inline";
        $("FaxImg3").style.display = "none";
        return false;
    }
    
    if(valid.isTelNum($("txtFax").value)){
        $("FaxImg1").style.display = "none";
        $("FaxImg2").style.display = "none";
        $("FaxImg3").style.display = "inline";
        return true;
    }
    else{
        $("FaxImg1").style.display = "none";
        $("FaxImg2").style.display = "inline";
        $("FaxImg3").style.display = "none";
        return false;
    }
}
 regStep3.prototype.ChkSafeCode = function(){
    if(!valid.isEmpty($("txtCode").value)){
            $("CodeImg1").style.display = "none";
            $("CodeImg2").style.display = "none";
            $("CodeImg3").style.display = "inline";
            return true;
    }
    else{
        $("CodeImg1").style.display = "none";
        $("CodeImg2").style.display = "inline";
        $("CodeImg3").style.display = "none";
        return false;
    }
}
regStep3.prototype.ChkPostCode = function(){
    if(!valid.isEmpty($("txtPostCode").value)&&valid.isNums($("txtPostCode").value)){
            $("PostCodeImg1").style.display = "none";
            $("PostCodeImg2").style.display = "none";
            $("PostCodeImg3").style.display = "inline";
            return true;
    }
    else{
        $("PostCodeImg1").style.display = "none";
        $("PostCodeImg2").style.display = "inline";
        $("PostCodeImg3").style.display = "none";
        return false;
    }
}
 regStep3.prototype.ChkServicesform=function(){
    if(!this.ChkComName()){show_error("请正确填写您公司名称。");return false;}
    if(!this.ChkRegCode()){show_error("请正确填写您的注册代码。");return false;}
    if(!this.ChkWeburl()){show_error("请正确填写您的网址。");return false;}
    if(!this.ChkProvince()){show_error("请正确填写您的省份。");return false;}
    if(!this.ChkCity()){show_error("请正确填写您的城市。");return false;}
    if(!this.ChkComAddr()){show_error("请正确填写您的详细地址。");return false;} 
    if(!this.ChkPostCode()){show_error("请正确填写您的邮政编码。");return false;} 
    if(!this.ChkTelPhone()){show_error("请正确填写您的电话。");return false;} 
    if(!this.ChkFax()){show_error("请正确填写您的传真。");return false;} 
    if(!this.ChkSafeCode()){show_error("请填写您的验证码。");return false;} 
    
    //if(!this.ChkUrl()){show_error("请正确填写您的个人网址。");return false;}
    return true;
}

//------------------end------------------------
///个人注册第三步
regStep3.prototype.updateUserAppend=function(){
       if(this.Chkform()){
       var result = Sniper.UpdateClientUserAddppend($("txtCardId").value, $("txtPostAddr").value, $("txturl").value,
        $("txtIntr").value, $("txtComName").value, '', $("txtComAddr").value, $("Picture").value,$("txtCode").value).value;
        if(result=="-1"){
            show_error('验证码错误');
            return false;
        }
        else{
            if(result>0){
              window.location = '/login/Login.aspx';
            }
        }
    }      
 
}
////////////-----------------------------begin其它注册第三步----------------------
regStep3.prototype.ChkOtherform=function(){
    if(!this.ChkComName()){show_error("请正确填写您公司名称。");return false;}
//    if(!this.ChkWeburl()){show_error("请正确填写您的网址。");return false;}
    if(!this.ChkProvince()){show_error("请正确填写您的省份。");return false;}
    if(!this.ChkCity()){show_error("请正确填写您的城市。");return false;}
    if(!this.ChkComAddr()){show_error("请正确填写您的详细地址。");return false;} 
    if(!this.ChkPostCode()){show_error("请正确填写您的邮政编码。");return false;} 
    if(!this.ChkTelPhone()){show_error("请正确填写您的电话。");return false;} 
    if(!this.ChkSafeCode()){show_error("请填写您的验证码。");return false;} 
    //if(!this.ChkUrl()){show_error("请正确填写您的个人网址。");return false;}
    return true;
}
//(string CompanyName,string url, string pid, string cid,
//            string addr, string postcode, string tel, string intro, string SafeCode)
regStep3.prototype.AddOthers=function(){
           if(this.ChkOtherform()){
                var telPhone = $("txtNationalCode").value + "-" + $("txtAreaCode").value + "-" + $("txtTelPhone").value;
                var result = Sniper.AddCompanyOther($("txtComName").value,
                $("txtUrl").value, $("selProvinceID").value, $("selCityID").value, $("txtComAddr").value, $("txtPostCode").value,telPhone,$("txtIntro").value,
                $("txtCode").value).value;
                 var jsonobj = eval("data=" + result);
                if(result=="-1"){
                    show_error('验证码错误');
                    return false;
                }
                else if(result=="-2")
                {
                /****************************/
                /**修改人：李鹏2010-6-12*****/
                /**原因：验证是否添加过公司**/
                /****************************/
                   show_error('您已经添加过公司，不能再次添加');
                   return false; 
                }
                else{
                    if(jsonobj.Detail[0].Success>0){
            /*************************/
            /**修改人：李晨2008-8-24**/
            /**原因：取消邮箱验证的***/
            /*************************/
                     window.location = '/login/Login.aspx';
                     // window.location = '/login/Login.aspx?Reg_4_1';
                    }
                    else
                    {
                      show_error('提交失败');
                      return false;
                    }
                }
           
         }
                    
}
////----------------------------------------end------------------------------------
///商业服务企业注册第三步
regStep3.prototype.AddComname=function(){
       if(this.ChkServicesform()){
       var telPhone = $("txtNationalCode").value + "-" + $("txtAreaCode").value + "-" + $("txtTelPhone").value;
       var fax = $("txtNationalCodeFax").value + "-" + $("txtAreaCodeFax").value + "-" + $("txtFax").value;
       var result = Sniper.AddCompany($("txtComName").value,$("txtRegCode").value, $("Picture").value,
        $("txtUrl").value, $("selProvinceID").value, $("selCityID").value, $("txtComAddr").value, $("txtPostCode").value,telPhone,fax,$("txtJyfw").value,
        $("selComType").value,$("selComBulidTime").value,
        $("txtCode").value).value;
        if(result=="-1"){
            show_error('验证码错误');
            return false;
        }
        else if(result=="-2"){
            show_error('您已经添加过公司，不能再次添加');
            return false;
        }
        else{
            if(result>0){
              window.location = '/login/Login.aspx?Reg_4_1';
            }
            else
            {
              show_error('提交失败');
              return false;
            }
        }
    }
}

//---------------------begin生产企业表单检测----------------
regStep3.prototype.ChkConnactName = function(){
    if(!valid.isEmpty($("txtConnactName").value)){
            $("ConnactNameImg1").style.display = "none";
            $("ConnactNameImg2").style.display = "none";
            $("ConnactNameImg3").style.display = "inline";
            return true;
    }
    else{
        $("ConnactNameImg1").style.display = "none";
        $("ConnactNameImg2").style.display = "inline";
        $("ConnactNameImg3").style.display = "none";
        return false;
    }
}
//选择展区
regStep3.prototype.ChkChannelID = function(){
    if(!valid.isEmpty($("channelIds").value)){
            $("ChannelImg1").style.display = "none";
            $("ChannelImg2").style.display = "none";
            $("ChannelImg3").style.display = "inline";
            return true;
    }
    else{
        $("ChannelImg1").style.display = "none";
        $("ChannelImg2").style.display = "inline";
        $("ChannelImg3").style.display = "none";
        return false;
    }
}




/************************************/
/*修改人：李晨2009-7-15**************/
/*原因：添加验证**********************/
/************************************/
 regStep3.prototype.ChkProductsform=function(){
    if(!this.ChkComName()){show_error("请正确填写您公司名称。");return false;}
    if(!this.ChkChannelID()){show_error("请选择贵公司所属的行业分类。");return false;}
    //if(!this.ChkRegCode()){show_error("请正确填写您的注册代码。");return false;}
   // if(!this.ChkWeburl()){show_error("请正确填写您的网址。");return false;}
    if(!this.ChkProvince()){show_error("请正确填写您的省份。");return false;}
    if(!this.ChkCity()){show_error("请正确填写您的城市。");return false;}
    if(!this.ChkComAddr()){show_error("请正确填写您的详细地址。");return false;}
    if(!this.ChkPostCode()){show_error("请正确填写您的邮政编码。");return false;}  
    if(!this.ChkTelPhone()){show_error("请正确填写您的电话。");return false;} 
    //if(!this.ChkFax()){show_error("请正确填写您的传真。");return false;} 
    if(!this.ChkConnactName()){show_error("请正确填写您的联系人。");return false;} 
    if(!this.ChkSafeCode()){show_error("请填写您的验证码。");return false;} 
    //if(!this.ChkUrl()){show_error("请正确填写您的个人网址。");return false;}
    if(valid.isEmpty($("txtComProduct").value)|| $("txtComProduct").value=="最多可填12个主营产品"){show_error("请填写主营产品。");return false;}
    if(valid.isEmpty($("txtComfw").value) || $("txtComfw").value =="请描述企业的经营范围，5-200字"){show_error("请填写经营范围。");return false;}
    var txtIntvalue = FCKeditorAPI.GetInstance("txtIntr").GetXHTML(true);
    if(valid.isEmpty(txtIntvalue))
    {
        show_error("请写公司简介。");return false;
    }
    else
    {
        var strint = txtIntvalue.replaceAll("&nbsp;","").replaceAll("<p>","").replaceAll("</p>","");
       
        if(valid.isEmpty(strint))
        {
            show_error("请写公司简介。");return false;
        }
    }
    
    return true;
}
function isSpace(str)
{
    str = str.replace(/(^\s*)|(\s*$)/g,"");
    return str; 
}
//---------------------end--------------------------
///-------------begin生产企业注册的第三步-----------------------
regStep3.prototype.addppend=function(){
  if(this.ChkProductsform()){
       var xz="私营";
       var rbs = document.getElementsByName("radxz");
       for(var i=0;i<rbs.length;i++){
         if(rbs[i].checked)
               xz = rbs[i].value;
         }
       var channelIds = $("channelIds").value;
       var telPhone = $("txtNationalCode").value + "-" + $("txtAreaCode").value + "-" + $("txtTelPhone").value;
       var fax = $("txtNationalCodeFax").value + "-" + $("txtAreaCodeFax").value + "-" + $("txtFax").value;
       var result = Sniper.Addappednd($("txtComName").value,$("txtRegCode").value, "",xz,
        $("txtUrl").value, $("selProvinceID").value, $("selCityID").value, $("txtComAddr").value, $("txtPostCode").value,$("txtConnactName").value,
        telPhone,fax,$("Picture").value,$("Span1").value,$("txtComMobile").value,$("txtComfw").value,$("txtComProduct").value,$("txtComProcurement").value,
        $("txtComType").value, $("txtComSales").value,$("txtComNum").value,$("txtComTime").value,$("txtCode").value,FCKeditorAPI.GetInstance("txtIntr").GetXHTML(true)).value;
        if(result=="-1"){
            show_error('验证码错误');
            return false;
        }
        else{
            var jsonobj = eval("data="+result);
            if(jsonobj.Detail){//如果Detail的Key存在
               result=parseInt(jsonobj.Detail[0].Success);
            }
            if(result>0){
               if(!valid.isEmpty(channelIds)){
                try
                {
                    Jason.OtherInsertCompanyChannel(channelIds,jsonobj.Detail[0].CompanyID);
                }
                catch(ex)
                {
                    show_error("频道更新失败");
                    return;
                }
                
             }
             window.location = '/login/Login.aspx?register_Third';
            }
            else
            {
              if(result==-2006){
               show_error('您录入的信息存在非法字符');
               return;
              }
              if(result==-2005){
                show_error('该公司名称已经被注册');
              }
              else
              {
              show_error('提交失败');
              }
              return false;
            }
        }
     }
     
}
///-----------------------end-----------------
//****************************begin贸易企业第三步********************************
 regStep3.prototype.ChkTradeform=function(){
    if(!this.ChkComName()){show_error("请正确填写您公司名称。");return false;}
    //if(!this.ChkRegCode()){show_error("请正确填写您的注册代码。");return false;}
    //if(!this.ChkWeburl()){show_error("请正确填写您的网址。");return false;}
    if(!this.ChkProvince()){show_error("请正确填写您的省份。");return false;}
    if(!this.ChkCity()){show_error("请正确填写您的城市。");return false;}
    if(!this.ChkComAddr()){show_error("请正确填写您的详细地址。");return false;}
    if(!this.ChkPostCode()){show_error("请正确填写您的邮政编码。");return false;}  
    if(!this.ChkTelPhone()){show_error("请正确填写您的电话。");return false;} 
    //if(!this.ChkFax()){show_error("请正确填写您的传真。");return false;} 
    if(!this.ChkSafeCode()){show_error("请填写您的验证码。");return false;} 
    //if(!this.ChkUrl()){show_error("请正确填写您的个人网址。");return false;}
    return true;
}
function ChoseChannel()
{
    show_frame('/login/login.aspx?admin_leimu',650,520,'','no',false);
}
regStep3.prototype.Tradeaddppend=function(){
  if(this.ChkTradeform()){
       var channelIds = $("channelIds").value;
       var telPhone = $("txtNationalCode").value + "-" + $("txtAreaCode").value + "-" + $("txtTelPhone").value;
       var fax = $("txtNationalCodeFax").value + "-" + $("txtAreaCodeFax").value + "-" + $("txtFax").value;
       
       var result = Sniper.AddTradeappednd($("txtComName").value,$("txtRegCode").value,"",
        $("txtUrl").value, $("selProvinceID").value, $("selCityID").value, $("txtComAddr").value, $("txtPostCode").value,
        telPhone,fax,$("txtComfw").value,$("txtComProduct").value,"",
        $("txtComType").value, "0","0",$("txtComTime").value,$("txtCode").value,FCKeditorAPI.GetInstance("txtIntr").GetXHTML(true)).value;
        if(result=="-1"){
            show_error('验证码错误');
            return false;
        }
        else if(result=="-2"){
            show_error('您已经添加过公司，不能再次添加');
            return false;
        }
        else{
            var jsonobj = eval("data="+result);
            if(jsonobj.Detail){//如果Detail的Key存在
               result=parseInt(jsonobj.Detail[0].Success);
            }
            if(result>0){
               if(!valid.isEmpty(channelIds))
            {
                try
                {
                    Jason.InsertCompanyChannel(channelIds);
                }
                catch(ex)
                {
                    show_error("频道更新失败");
                    return;
                }
                
            }
            /*************************/
            /**修改人：李晨2008-8-24**/
            /**原因：取消邮箱验证的***/
            /*************************/
             window.location = '/login/Login.aspx';
//            window.location = '/login/Login.aspx?register_Third';
            }
            else
            {
              show_error('提交失败');
              return false;
            }
        }
     }
     
}

///-----------------------end-----------------
//---------调城市函数-------------//
function getCityByPid(p,cid){
    var citys = Sniper.getCity(p).value;
    try{
        var citysObj = eval("citys="+citys);
        $("selCityID").options.length=0;
        $("selCityID").options.add(new Option("请选择城市",""));
        for(var i=0;i<citysObj.Detail.length;i++){
            $("selCityID").options.add(new Option(citysObj.Detail[i].city,citysObj.Detail[i].ID));
        }
        if(cid!="")
        {
         $("selCityID").value=cid;
        }
    }
    catch(ex){
        dialog.alert2(ex);
    }
  }

/**********************************************检测密码强度开始**********************************************/
//CharMode函数
//测试某个字符是属于哪一类
function CharMode(iN) {
   if (iN>=48 && iN <=57) //数字
    return 1;
   if (iN>=65 && iN <=90) //大写字母
    return 2;
   if (iN>=97 && iN <=122) //小写
    return 4;
   else
    return 8; //特殊字符
}

//bitTotal函数
//计算出当前密码当中一共有多少种模式
function bitTotal(num) {
   modes=0;
   for (i=0;i<4;i++) {
    if (num & 1) modes++;
     num>>>=1;
    }
   return modes;
}

//checkStrong函数
//返回密码的强度级别
function checkStrong(sPW) {
   if (sPW.length<=5)
    return 0; //密码太短
    Modes=0;
    for (i=0;i<sPW.length;i++) {
     //测试每一个字符的类别并统计一共有多少种模式
     Modes|=CharMode(sPW.charCodeAt(i));
   }
   return bitTotal(Modes);
}

//pwStrength函数
//当用户放开键盘或密码输入框失去焦点时,根据不同的级别显示不同的颜色

function pwStrength(pwd) {
   if (pwd==null||pwd==''){
     document.getElementById("strength_L").className="mem_6";
     document.getElementById("strength_M").className="mem_6"
     document.getElementById("strength_H").className="mem_6";
   }
   else {
    S_level=checkStrong(pwd);
    switch(S_level) {
    case 0:
     document.getElementById("strength_L").className="mem_6";
     document.getElementById("strength_M").className="mem_6"
     document.getElementById("strength_H").className="mem_6";
    break;
    case 1:
     document.getElementById("strength_L").className="mem_7";
     document.getElementById("strength_M").className="mem_6"
     document.getElementById("strength_H").className="mem_6";
    break;
    case 2:
     document.getElementById("strength_L").className="mem_7";
     document.getElementById("strength_M").className="mem_7"
     document.getElementById("strength_H").className="mem_6";
    break;
    default:
     document.getElementById("strength_L").className="mem_7";
     document.getElementById("strength_M").className="mem_7"
     document.getElementById("strength_H").className="mem_7";
    }
   }
return;
}

function pwStrength_p(pwd) {
   if (pwd==null||pwd==''){
     document.getElementById("strength_L_p").className="mem_6";
     document.getElementById("strength_M_p").className="mem_6"
     document.getElementById("strength_H_p").className="mem_6";
   }
   else {
    S_level=checkStrong(pwd);
    switch(S_level) {
    case 0:
     document.getElementById("strength_L_p").className="mem_6";
     document.getElementById("strength_M_p").className="mem_6"
     document.getElementById("strength_H_p").className="mem_6";
    break;
    case 1:
     document.getElementById("strength_L_p").className="mem_7";
     document.getElementById("strength_M_p").className="mem_6"
     document.getElementById("strength_H_p").className="mem_6";
    break;
    case 2:
     document.getElementById("strength_L_p").className="mem_7";
     document.getElementById("strength_M_p").className="mem_7"
     document.getElementById("strength_H_p").className="mem_6";
    break;
    default:
     document.getElementById("strength_L_p").className="mem_7";
     document.getElementById("strength_M_p").className="mem_7"
     document.getElementById("strength_H_p").className="mem_7";
    }
   }
return;
}

/**********************************************检测密码强度结束************************************************/

