﻿

       function Reg()
	    {
	       var UserName = jQuery.trim(document.getElementById("UserName").value);
	       var Phone= jQuery.trim(document.getElementById("Phone").value);
           var NQQ= jQuery.trim(document.getElementById("NQQ").value);

            var reg1=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
           var reg2=/^((\(\d{3,4}\))|(\d{3,4}\-))?((\d{8,11})|(\d{7,11})|(\d{6,11}))$/;
            var reg3=/^[1-9]\d{4,11}$/;
            
            if(reg2.test(Phone)==false)
            {
              alert("联系电话格式输入有误!");
              return false;
            }
            
            if(NQQ!="输入QQ号")
            {
                if(reg3.test(NQQ)==false)
                {
                    alert("QQ格式输入有误");
                    return false;
                }
           }
           if(UserName=="请填写姓名")
           {
                alert("请填写姓名");
                return false;
           }
          var Compid= jQuery.trim(document.getElementById("ddl_Compid").value);
          if(Compid=="0")
          {
               alert("请选择执业资格!");
               return false;
          }
           
           return true;
	    }
  
	    function DoPost()
	    {
	       if(Reg()==true)
	       {
	               var UserName = jQuery.trim(document.getElementById("UserName").value);
	               var Phone= jQuery.trim(document.getElementById("Phone").value);
                   var NQQ= jQuery.trim(document.getElementById("NQQ").value);
                   var Comid = document.getElementById("ddl_Compid").value;
                   var ComSubid=document.getElementById("ddl_CompSubid").value;
                   var  IsReg=1;
                   if(document.getElementById("rbn_CertReg2").checked==true)
                   {
                        IsReg=0;
                   }
                   var txt_Memo=document.getElementById("txt_Memo").value;
                   var ddl_CertPlace=document.getElementById("ddl_CertPlace").value;
                   var ddl_RegPlace=document.getElementById("ddl_RegPlace").value;
                   

	                $.get("CScript/publicajax.axd",{op:"insertNoPersonResume",txt_Memo:txt_Memo,UserName:UserName,Phone:Phone,NQQ:NQQ,IsReg:IsReg,Comid:Comid,ComSubid:ComSubid,IsSex:2,ddl_RegPlace:ddl_RegPlace,ddl_CertPlace:ddl_CertPlace,t:new Date().getTime()},function(data){
	                     if(parseInt(data)>0)
	                     {       
	                                 window.location.href="SelfResume/SelfIndex.aspx";
	                     }
	                     else
	                     {
	                           alert("登记失败");
	                     }
	                 },"json");
	           }
	    }

function Onfoucss(obj,nType)
{
     var nStr="输入QQ号";
     switch(obj,nType)
     {
      case "2":
          nStr="输入QQ号";break;
       case "1":
          nStr="输入联系电话";break;
       case "3":
          nStr="请填写姓名";break; 
     }
    if(obj.value==nStr)
    {
       obj.value="";
    }
}


function OnBlu(nId,nType)
{
     var nTemp=jQuery.trim(document.getElementById(nId).value);
     var nStr=""
     switch(nType)
     {
       case "2":
          nStr="输入QQ号";break;
       case "1":
          nStr="输入联系电话";break;
       case "3":
          nStr="请填写姓名";break; 
     }
     
     
     if(nTemp.length==0)
     {
         document.getElementById(nId).value=nStr;
     }
}
		
		function personLogout(){
            $.get("CScript/publicajax.axd",{op:"logout",t:new Date().getTime() },function(){
                $("#personLoginDiv").show();
                $("#personLoginOk").hide();
                $("#lbl_personName").html("******"); 
            });
        }
        function personLogin(){
            if(!perCheck())return false;
            $.get("Cscript/discuzLogin.aspx",{username:$("#txt_pName").val(),pwd:$("#txt_pPwd").val(),t:new Date().getTime() },function(data){
                if(data!="0"){
                   $("#lbl_personName").html($("#txt_pName").val());
                    $("#personLoginDiv").hide();
                    $("#personLoginOk").show();
                    $("body").append("<iframe style=\"display:none\" src=\"/Cscript/discuzLogin.aspx?username="+$("#txt_pName").val()+"&pwd="+$("#txt_pPwd").val()+"\"></iframe>");
                }else{alert("密码或用户名错误!");} 
            });
            return false;
        }
        
        function companyLogin(){
      
           if(!comCheck()) return false;
             $.get("CScript/publicajax.axd",{op:"companyLogin",uName:$("#txt_cName").val(),uPwd:$("#txt_cPwd").val(),t:new Date().getTime() },function(data){
                
                   if(data!=0)
                {
                     $("#lbl_companyName").html($("#txt_cName").val());
                    $("#companyLoginDiv").hide();
                    $("#companyLoginOk").show();
                }
                else
                {
                  alert("用户名或密码错误!");
                }
             });
        }
        
        function agentLogin()
        {
            if(!agentCheck()) return false;
            $.get("CScript/publicajax.axd",{op:"AgentLogin",uName:$("#txt_AgentUserName").val(),uPwd:$("#txt_AgentPwd").val(),t:new Date().getTime() },function(data){
                if(data!=0)
                {
                    $("#agentLoginAfter").show();
                    $("#agentLoginBefore").hide();
                    $("#lbl_AgentUserName").html($("#txt_AgentUserName").val())
                }
             });
        }
        function agentCheck()
        {
          
             if(!/^\w{4,20}$/.test($("#txt_AgentUserName").val())){alert("请输入正确格式的用户名!");return false;}
            if(!/^\w{4,20}$/.test($("#txt_AgentPwd").val())){alert("请输入正确格式的密码!");return false}
            return true;
        }
        
        function perCheck(){
            if(!/^\w{4,20}$/.test($("#txt_pName").val())){alert("请输入正确格式的用户名!");return false;}
            if(!/^\w{4,20}$/.test($("#txt_pPwd").val())){alert("请输入正确格式的密码!");return false}
            return true;
        }
        function comCheck(){
          if($("#txt_cName").val()==""){alert("请输入用户名!");return false;}else if($("#txt_cPwd").val()==""){alert("请输入密码!");return false;};
          return true;
        }
        var MyInterval=false;
        var MyTimeout=false;
        function PToCSlide(){
            $("#PToC")[0].nowTop = $("#PToC")[0].nowTop || 0;
            $("#PToC")[0].isMy = true;
            $("#CToP")[0].isMy = false;
            $("#PToC")[0].nowTop -= 1;
            if($("#PToC")[0].nowTop == -25){
                $("#PToC").append($("#PToC>li:first"));
                $("#PToC")[0].nowTop = 0;
                MyInterval = window.clearInterval(MyInterval);
                MyTimeout = window.setTimeout("StopSlide(CToPSlide)",2000);
            }
            $("#PToC").css("top",$("#PToC")[0].nowTop+"px")
        }
        function CToPSlide(){
            $("#CToP")[0].nowTop = $("#CToP")[0].nowTop || 0;
            $("#CToP")[0].isMy = true;
            $("#PToC")[0].isMy = false;
            $("#CToP")[0].nowTop -= 1;
            if($("#CToP")[0].nowTop == -25){
                $("#CToP").append($("#CToP>li:first"));
                $("#CToP")[0].nowTop = 0;
                MyInterval = window.clearInterval(MyInterval);
                MyTimeout = window.setTimeout("StopSlide(PToCSlide)",2000);
            }
            $("#CToP").css("top",$("#CToP")[0].nowTop+"px")
        }
        function StopSlide(fun){
            if(MyTimeout)MyTimeout = window.clearTimeout(MyTimeout);
            MyInterval = window.setInterval(fun,100);
        }
        function showtab(n,obj)
        {
           $("#jobtab a").removeClass("tab1");
           $(obj).addClass("tab1");
           $("#rejin ul").css("display","none");
           $("#rejin ul")[n].style.display="block"; 
        }
        function shownews(n,obj)
        {
           $("#ulnewsnav li").removeClass("athis");
           $(obj).addClass("athis");
           $("#newscon .newscon0").css("display","none");
          $("#newscon .newscon0")[n].style.display="block";
        }
          function tabchange(obj,boxdiv,boxul,index,className,divClassName,ajaxop)
        {
            if(null==divClassName) divClassName="";
             $("#"+boxul+" li").removeClass(className);
             $(obj).addClass(className);
             $("#"+boxdiv+" div"+divClassName).css("display","none");
             $("#"+boxdiv+" div"+divClassName)[index].style.display="block";
          
             if(null!=ajaxop)
             {
             
                $.get("CScript/indexajax.aspx?op="+ajaxop,function(data){
                  $("#"+boxdiv+" div"+divClassName)[index].innerHTML=data;
                })
             }
             
        } 
      
