﻿$(function () {
    var layindex = 0;

    var mobileObj = $("#mobile");
    if (mobileObj) {
        mobileObj.attr("nullmsg", "手机号码必填");
        mobileObj.attr("errormsg", "手机号码有误");
        mobileObj.attr("datatype", "mobile");
    }

    var emailObj = $("#TxtEmail");
    if (emailObj) {
        emailObj.attr("nullmsg", "邮箱必填");
        emailObj.attr("errormsg", "邮箱有误");
        emailObj.attr("datatype", "email");
    }

    var checkCodeObj = $("#checkCode");
    if (checkCodeObj) {
        checkCodeObj.attr("nullmsg", "验证码必填");
        checkCodeObj.attr("errormsg", "验证码有误");
        checkCodeObj.attr("datatype", "^[^\\s]{4,8}$");
    }

    $(".yinpinjob").live("click", function () {

        var id = $(this).attr("data-code");
        var weixincode = $("#weixincode").val();
        var layindex = 0;
        layer.open({
            content: '<font color=#E00000>马上投递简历</font><br/>关注微信公众号('+ weixincode +')，及时获取简历反馈'
            , btn: ['马上投递', '我再看看']
            , shadeClose: false
            , yes: function (index) {
              
                $.ajax({
                    type: "POST",
                    url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=dodeliver&pid=" + id,
                    //  data: $("#form1").serialize(),
                    async: true,
                    dataType: "json",
                    beforeSend: function (request) {
                        layindex = layer.open({
                            type: 2, shadeClose: false
                             , content: '正在处理中，请等待...'
                        });
                    },
                    error: function (request) {
                        layer.close(layindex);
                        var index = layer.open({ content: "保存出错", btn: '确认' });
                    },
                    success: function (data) {

                        layer.closeAll();
                        if (data.errorcode == "0") {
                            $(".SuccessMenuBg").show();
                        }
                        if (data.errorcode == "1") {
                            layer.open({
                                content: data.info, btn: '我知道了'
                                , yes: function (index) {
                                    layer.close(index) ;
                                    window.location.href = data.url ;
                                }
                            });
                        }
                        if (data.errorcode == "2")  {
                            layer.open({
                                content: data.info
                                , btn: ['更多岗位', '我再看看']
                                , yes: function (index) {
                                    window.location.href = "/searchjob.html" ;
                                }, btn2: function () {
                                    layer.closeAll();
                                }
                            });
                        }
                    }
                });

            }, no: function (index) {
                layer.closeAll();
            }
        });


    

    });

    $(".p_suremobile").click(function () {
        $('body').css('overflow','auto');
        $.ajax({
            type: "POST",
            url: "/WeiXin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=checkMobile",
            data: $("#form1").serialize(),
            async: true,
            timeout:10000,
            dataType: "json",
            beforeSend: function (request) {
                layindex =   layer.open({
                    type: 2, content: '校验中，请耐心等待...', shadeClose: false
                });
            },
            error: function (request) {
                
                layer.close(layindex);
                layer.open({ content: "校验出错", shadeClose: false, btn: '确认' });
              
            },
            success: function (data) {
                errorCode = data.errorcode;
                layer.close(layindex);

                if (errorCode == "0") {
                   
                    $("#txtPhone").val(data.info) ;
                    //if (data.obj) {
                    //    $("#txtName").val(data.obj.userName);
                    //    $("#sex").val(data.obj.userSex);
                    //    $(".psex").removeClass("selected").addClass("unselected") ;
                    //    $(".psex").eq(parseInt(data.obj.userSex) - 1).removeClass("unselected").addClass("selected");
                    //    $("#birth").val(data.obj.birthday);
                    //    $("#txtEmail").val(data.obj.userEmail);
                    //    $("#txtYear").val(data.obj.userWorkyear);
                    //    $("#area").val(data.obj.area);
                    //    $("#title").val(data.obj.title);
                    //    $("#titleName").val(data.obj.title);
                    //    $("#titleCode").val(data.obj.titleCode);
                    //    $("#area").val(data.obj.area);
                    //    $("#areaname").html(data.obj.workAreaName);
                    //    $("#salary").val(data.obj.salary);
                    //    $("#degree").attr('value', data.obj.education);
                    //    $("#subject").val(data.obj.subject);
                    //    $("#desc").val(data.obj.userWorkdesc);
                    //}

                    $(".full").css("display", "none");
                    $(".p_box").animate({ top: '-20rem' }, 300);
                }
                else if (errorCode == "3")
                {
                    window.location.href = "/UserIndex.html" ;
                }
                else {
                    if (errorCode == "2") {
                        $("#yzm").show();
                    }
                    layer.open({ content: data.info, shadeClose: false, btn: '确认' });
                }
            }
            ,complete:function(data)
            {
                layer.close(layindex);
                if (data.statusText.toLowerCase() == "timeout") {
                    layer.open({ content: "校验超时，请重新点击“确定”按钮", shadeClose: false, btn: '确认' });
                }
            }
        });

        return false;

    });

    $("#full_Close").click(function () {
            
        $(".full").css("display", "none");
        $(".p_box").animate({ top: '-20rem' }, 0);
    });

    $("#btnvalidatecode").click(function () {

        if (checkLinkMobile() <= 0) {
            //unloading();
           
            $.ajax({
                type: "POST",
                url: "/WeiXin/ashx/Handler.ashx?action=getvalidatecode",
                data: $("#form1").serialize(),
                async: true,
                timeout: 10000,
                dataType: "json",
                beforeSend: function (request) {
                   layindex = layer.open({
                        type: 2, content: '正在处理中，请等待...', shadeClose: false
                    });
                },
                error: function (request) {
                    layer.close(layindex);
                    layer.open({ content: "获了验证码出错", shadeClose: false, btn: '确认' });
                   // alert("获了验证码出错");
                },
                success: function (data) {
                    layer.close(layindex);
                    if (data.errorcode == "1") {
                        //alert(data.info);
                        if (data.info == "nouser")
                        {
                            layer.open({
                                content: '系统显示您尚未注册，10秒钟即可创建完毕'
                               , btn: ['注册', '其它手机号码']
                               , shadeClose: false
                               , yes: function (index) {
                                   window.location.href = data.url;
                                   layer.close(index);
                               }, no: function (index) {
                                   layer.closeAll();
                               }
                            });

                        }
                        else
                        {
                            layer.open({ content: data.info, shadeClose: false, btn: '我知道了' });
                        }
                       
                    } else {
                        //alert(data.info);
                        GetYzm();
                        layer.open({ content: data.info, shadeClose: false, btn: '确认' });
                    }
                },
                complete: function (data) {
                    layer.close(layindex);
                    if (data.statusText.toLowerCase()  == "timeout") {
                        layer.open({ content: "查询超时，请重新操作", shadeClose: false, btn: '确认' });
                    }
                    
                }
            });
        }

        return false;
    });

    $("#btnSaveReg").click(function () {

        var reg = new RegExp("^[0-9]*$");

        if ($("#txtName").val() == "") {
            layer.open({ content: "姓名不能为空", shadeClose: false, btn: '确认' });
            return false;
        }
        if ($("#birth").val() == "") {
            layer.open({ content: "出生日期不能为空", shadeClose: false , btn: '确认' });
            return false;
        }

        var age = 0;
        age = jsGetAge($("#birth").val());
        $("#age").val(age);
        if (age < 18)
        {
            layer.open({ content: "出生日期填写不正确", btn: '确认' });
            return false;
        }

        if ($("#degree").val() == "") {
            layer.open({ content: "学历不能为空", btn: '确认' });
            return false;
        }
        if ($("#subject").val() == "") {
            layer.open({ content: "专业不能为空", btn: '确认' });
            return false;
        }

        if ($("#txtPhone").val() == "") {
            layer.open({ content: "手机不能为空", btn: '确认' });
            return false;
        }
        var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
        if (!re.test($("#txtEmail").val())) {
            layer.open({ content: "邮箱输入不正确", btn: '确认' });
            return false;
        }
        if ($("#txtYear").val() == "") {
            layer.open({ content: "工作年限不能为空", btn: '确认' });
            return false;
        }

        if (!reg.test($("#txtYear").val())) {
            layer.open({ content: "工作年限只能为数字", btn: '确认' });
            return false;
        }

        if (parseInt($("#txtYear").val()) > 50)
        {
            layer.open({ content: "请填写正确的工作年限,不能填写工作开始或结束时间", btn: '确认' });
            return false;
        }

        if ($("#area").val() == "") {
            layer.open({ content: "意向地区不能为空", btn: '确认' });
            return false;
        }
        if ($("#position").val() == "") {
            layer.open({ content: "意向岗位不能为空", btn: '确认' });
            return false;
        }
        if ($("#salary").val() == "") {
            layer.open({ content: "薪资要求不能为空，0表示面议", btn: '确认' });
            return false;
        }

        if (!reg.test($("#salary").val())) {
            layer.open({ content: "薪资只能为数字", btn: '确认' });
            return false;
        }
        
        if ($("#desc").val() == "") {
            var template = $("#template").val();
            layer.open({ content: "核心技能、自我评价不能为空。 请参与模板 <br/><br/>" + template, btn: '确认' });
            return false;
        }

        if ($("#desc").val().length < 20) {
            var template = $("#template").val();
            layer.open({ content: "核心技能，自我评价描述太简单，会大大降低求职成功率。 请参与模板 <br/><br/>" + template, btn: '确认' });
            return false;
        }


        $.ajax({
            type: "POST",
            url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=savereg",
            data: $("#form1").serialize(),
            async: true ,
            dataType: "json",
            beforeSend: function (request) {
              layindex =   layer.open({
                    type: 2, content: '正在处理中，请等待...', shadeClose: false
                 });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "保存出错", btn: '确认' });
            },
            success: function (data) {
                layer.close(layindex);
                if (data.errorcode == "1")
                {
                    layer.close(layindex);
                    layer.open({ content:data.info , btn: '确认' });
                }
                if (data.errorcode == "0")
                {
                    /// $(".SuccessMenuBg").show();
                    window.location.href = "/WeiXin/UserIndex.html" ;
                }
                

                //layer.open({ content: data.info,  btn: '确认' });
                //if (data.errorcode == "0")
                //{
                //    window.location.href = "/WeiXin/Action.aspx" ;
                //}
            }
        });

    });

    $("#q_dodeliver").click(function () {
        $.ajax({
            type: "POST",
            url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=dodeliver",
            data: $("#form1").serialize(),
            async: true,
            dataType: "json",
            beforeSend: function (request) {
               layindex =  layer.open({
                    type: 2, shadeClose: false
                    , content: '正在处理中，请等待...'
                });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "保存出错", shadeClose: false, btn: '确认' });
            },
            success: function (data) {
                layer.close(layindex);
                if (data.errorcode == "0") {
                    var exp = data.url;
                    if (!exp && typeof (exp) != "undefined" && exp != 0)
                    {
                        $(".SuccessMenuBg").show();
                    } else {
                        window.location.href = data.url;
                    }
                }
                else if (data.errorcode == "2") {
                    layer.open({
                        content: data.info, btn: '我知道了'
                        , yes: function (index) {
                            layer.close(index);
                        }
                    });
                }
                else
                {
                    layer.open({
                        content: data.info, btn: '立即注册/登陆'
                          , yes: function (index) {
                              layer.close(index);
                              var exp = data.url;
                              window.location.href = data.url;
                          }
                    });
                   
                }
            }
        });


    });

    $("#loginbtnOne").click(function () {
        var userType = $("#userType").val();
        var preurl = $("#preurl").val();
        var txtUserName = $("#txtUserName").val();
        var txtPwd = $("#txtPwd").val();
        if(txtUserName.length <=0)
        {
            layer.open({ content: "请输入用户名", shadeClose: false, btn: '确认' });
            return false;
        }
        if (txtPwd.length <= 0) {
            layer.open({ content: "请输入密码", shadeClose: false, btn: '确认' });
            return false;
        }
        var url = "" ;
        if (userType == "1")
        {
            url = "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=userlogin" ;
        }
        if (userType == "2")
        {
            url = "/weixin/ashx/ComHandler.ashx?rnd=" + Math.random() + "&action=userlogin";
        }

        $.ajax({
            type: "POST",
            url: url ,
            data: $("#form1").serialize(),
            async: true ,
            dataType: "json",
            beforeSend: function (request) {
               layindex =  layer.open({
                    type: 2, shadeClose: false
                     , content: '正在查询中，请等待...'
                });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "登陆出错", shadeClose: false, btn: '确认' });
            },
            success: function (data) {

                layer.close(layindex);
                if(data.errorcode == "0")
                {
                    if (preurl.length > 0)
                    {
                        window.location.href = preurl;  //data.url;
                    }
                    else
                    {
                        window.location.href = data.url;
                    }
                    
                } else {
                    layer.open({ content: data.info, shadeClose: false, btn: '确认' });
                }

            }
        });
        return false ;
    });

    $("#loginbtnTwo").click(function () {
        var userType = $("#userType").val();
        var preurl = $("#preurl").val();
        var txtUserName = $("#mobile").val();
        var txtPwd = $("#checkCode").val();
        if (txtUserName.length <= 0) {
            layer.open({ content: "请输入手机号码", shadeClose: false, btn: '确认' });
            return false;
        }
        if (txtPwd.length <= 0) {
            layer.open({ content: "请输入验证码", shadeClose: false, btn: '确认' });
            return false;
        }

        var url = "";
        if (userType == "1") {
            url = "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=mobilelogin" ;
        }
        if(userType == "2")
        {
            url = "/weixin/ashx/ComHandler.ashx?rnd=" + Math.random() + "&action=mobilelogin" ;
        }

        $.ajax({
            type: "POST",
            url: url ,
            data: $("#form1").serialize(),
            async: true,
            dataType: "json",
            beforeSend: function (request) {
               layindex =  layer.open({
                    type: 2, shadeClose: false
                     , content: '正在查询中，请等待...'
                });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "登陆出错", shadeClose: false, btn: '确认' });
            },
            success: function (data) {
                layer.close(layindex);
                if (data.errorcode == "0") {
                    if (data.info == "nouser") {
                        layer.open({
                            content: '系统显示您尚未注册，10秒钟即可创建完毕'
                            , btn: ['注册', '以后再注册']
                            , shadeClose: false
                            , yes: function (index) {
                                window.location.href = data.url ;
                                layer.close(index);
                            }, no: function (index) {
                                layer.closeAll();
                            }
                        });
                    } else {
                        layer.open({ content: data.info, shadeClose: false, skin: 'msg', time: 2 });
                        window.location.href = data.url ;
                    }
                } else {

                    layer.open({
                        content: data.info
                          , btn: ['立即注册', '以后再注册']
                          , shadeClose: false
                          , yes: function (index) {
                              if (userType == "1") {
                                  window.location.href = "/WeiXin/UserRegistration.aspx";
                              }
                              if (userType == "2") {
                                  window.location.href = "/WeiXin/Recruit/Reg.aspx" ;
                              }
                              layer.close(index);
                          }, no: function (index) {
                              layer.closeAll();
                          }
                    });
                   
                }

            }
        });
        return false ;


    });

    $("#loginbtnThree").click(function () {

        var url = $("#url").val();
        var txtUserName = $("#email").val();
        var txtPwd = $("#emailCode").val();
        if (txtUserName.length <= 0) {
            layer.open({ content: "请输入邮箱地址", shadeClose: false, btn: '确认' });
            return false;
        }
        if (txtPwd.length <= 0) {
            layer.open({ content: "请输入验证码", shadeClose: false, btn: '确认' });
            return false;
        }
        $.ajax({
            type: "POST",
            url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=emaillogin",
            data: $("#form1").serialize(),
            async: true,
            dataType: "json",
            beforeSend: function (request) {
               layindex =  layer.open({
                    type: 2, shadeClose: false
                });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "登陆出错", shadeClose: false, btn: '确认' });
            },
            success: function (data) {

                if (data.errorcode == "0") {
                    if (data.info == "nouser") {
                        layer.open({
                            content: '尚未查询到您的简历，是否现就在创建微简历？，10秒钟即可创建完毕'
                            , btn: ['创建微简历', '以后再创建']
                            , shadeClose: false
                            , yes: function (index) {
                                window.location.href = data.url;
                                layer.close(index);
                            }, no: function (index) {
                                layer.close(index);
                            }
                        });
                    } else {
                        layer.open({ content: data.info, shadeClose: false, skin: 'msg', time: 2 });
                        window.location.href = url;
                    }
                } else {
                    layer.closeAll();
                    layer.open({ content: data.info, shadeClose: false, btn: '确认' });
                }

            }
        });
        return false ;

    });

    $(".close_icon").click(function () {
        $(".follow9453").slideUp("fast");
    });

    $("#flo_icon").click(function () {
        // $("#showqrcodediv").fadeIn();

        var pageii = layer.open({
            type: 1
              , content: $("#showqrcodediv").html()
              , anim: 'up'
              , style: 'position:fixed; left:5%; top:15%; width:90%; height:65%; border: none; -webkit-animation-duration: .5s; animation-duration: .5s;'
                    });

    }) ;
    $("#showqrcodediv").click(function () {
       // $(this).fadeOut();
    });

    $("#modifyPhone").click(function () {
        $(".full").css("display", "block");
        $(".p_box").animate({ top: '30%' }, 0);
        return false;
    });

    $(".psex").click(function () {
        $(".psex").removeClass("selected").addClass("unselected");
        $(this).removeClass("unselected").addClass("selected");
        $("#sex").val($(this).attr("data-code"));
    })

    $(".pguipei").click(function () {
        $(".pguipei").removeClass("selected").addClass("unselected");
        $(this).removeClass("unselected").addClass("selected");
        $("#guipeiFlag").val($(this).attr("data-code"));
    })
    
    $("#Pnext").click(function () {
        var showValue = $('#nexts').css('display');

        if (showValue != "none") {
            $("#Pnext").removeClass("sla").addClass("la");
            $("#nexts").slideUp();
        }
        if (showValue == "none") {
            $("#Pnext").removeClass("la").addClass("sla");
            $("#nexts").slideDown();
        }
    });

  

    $("#saveZYCertificate").click(function () {

        var name = $("#name").val();
        if (name.length <= 0) {
            layer.open({ content: "名称不能为空", btn: '确认' });
            return false;
        }
        var certificate = $("#certificate").val();
        if (certificate.length <= 0) {
            layer.open({ content: "请上传证书,格式为jpg,bmp,png", btn: '确认' });
            return false;
        }

        var layindex = 0;
        $.ajax({
            type: "POST",
            url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=savezycertificate",
            data: $("#form1").serialize(),
            async: true,
            dataType: "json",
            beforeSend: function (request) {
                layindex = layer.open({
                    type: 2, content: '正在处理中，请等待...', shadeClose: false
                });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "保存出错", btn: '确认' });
            },
            success: function (data) {
                window.location.href = "/WeiXin/UserIndex.html";
            }
        });
      
    })

    $("#saveexperience").click(function () {
        var cn = $("#companyName").val();
        if(cn.length <=0)
        {
            layer.open({ content: "公司名称不能为空", btn: '确认' });
            return false;
        }
        var btime = $("#beginDate").val();
        if(btime.length <=0)
        {
            layer.open({ content: "开始时间不能为空", btn: '确认' });
            return false ;
        }
        var title = $("#title").val();
        if(title.length <=0)
        {
            layer.open({ content: "担任职位不能为空", btn: '确认' });
            return false ;
        }

        var description = $("#description").val();
        if (description.length <= 10) {
            layer.open({ content: "工作描述字数太少", btn: '确认' });
            return false;
        }

        $.ajax({
            type: "POST",
            url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=saveexperience",
            data: $("#form1").serialize(),
            async: true,
            dataType: "json",
            beforeSend: function (request) {
                layindex = layer.open({
                    type: 2, content: '正在处理中，请等待...', shadeClose: false
                });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "保存出错", btn: '确认' });
            },
            success: function (data) {
                window.location.href = "/WeiXin/UserIndex.html";
            }
        });


    }) ;

    $("#saveeducation").click(function () {

        var school = $("#school").val();
        if (school.length <= 0) {
            layer.open({ content: "学校名称不能为空", btn: '确认' });
            return false;
        }
        var subject = $("#subject").val();
        if (subject.length <= 0) {
            layer.open({ content: "专业不能为空", btn: '确认' });
            return false;
        }
        var degree = $("#degree").val();
        if (degree.length <= 0) {
            layer.open({ content: "学历不能为空", btn: '确认' });
            return false;
        }
        var btime = $("#beginDate").val();
        if (btime.length <= 0) {
            layer.open({ content: "入时间不能为空", btn: '确认' });
            return false;
        }
       
        $.ajax({
            type: "POST",
            url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=saveeducation",
            data: $("#form1").serialize(),
            async: true,
            dataType: "json",
            beforeSend: function (request) {
                layindex = layer.open({
                    type: 2, content: '正在处理中，请等待...', shadeClose: false
                });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "保存出错", btn: '确认' });
            },
            success: function (data) {
                window.location.href = "/WeiXin/UserIndex.html";
            }
        });

    })

    $("#savetrain").click(function () {

        var organization = $("#organization").val();
        if (organization.length <= 0) {
            layer.open({ content: "机构名称不能为空", btn: '确认' });
            return false;
        }
        var lession = $("#lession").val();
        if (lession.length <= 0) {
            layer.open({ content: "培训内容不能为空", btn: '确认' });
            return false;
        }
        var btime = $("#beginDate").val();
        if (btime.length <= 0) {
            layer.open({ content: "入时间不能为空", btn: '确认' });
            return false;
        }

        $.ajax({
            type: "POST",
            url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=savetrain",
            data: $("#form1").serialize(),
            async: true,
            dataType: "json",
            beforeSend: function (request) {
                layindex = layer.open({
                    type: 2, content: '正在处理中，请等待...', shadeClose: false
                });
            },
            error: function (request) {
                layer.close(layindex);
                layer.open({ content: "保存出错", btn: '确认' });
            },
            success: function (data) {
                window.location.href = "/WeiXin/UserIndex.html";
            }
        }) ;

    })

    $("#delaction").click(function () {

        layer.open({
            content: '确认删除吗？'
          , btn: ['马上删除', '再考虑一下']
          , shadeClose: false
          , yes: function (index) {

              $.ajax({
                  type: "POST",
                  url: "/weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=delaction" ,
                  async: true,
                  data: $("#form1").serialize(),
                  dataType: "json",
                  beforeSend: function (request) {
                      layindex = layer.open({
                          type: 2, shadeClose: false
                           , content: '正在处理中，请等待...'
                      });
                  },
                  error: function (request) {
                      layer.close(layindex);
                      var index = layer.open({ content: "删作出错", btn: '我知道了' });
                  },
                  success: function (data) {
                      window.location.href = "/WeiXin/UserIndex.html" ;
                  }
              });

          }, no: function (index) {
              layer.closeAll();
          }
        });

    })



    
    $("#posTouSu").live("click", function () {

        var layindex = 0;
        var html = "";
        $.ajax({
            url: "/WeiXin/ajax/AjaxTouSuJob.htm",
            async: true,
            beforeSend: function (request) {
                layindex = layer.open({
                    type: 2, content: '正在加载中，请等待...', shadeClose: false
                });
            },
            success: function (data) {
                layer.close(layindex);
                var pageii = layer.open({
                    type: 1
                    , content: data
                    , anim: 'up'
                      , shadeClose: false
                     , fix: true
                    , style: 'position:absolute; left:0; top:0;bottom: 0;overflow-y: auto; width:100%;overflow:auto; border: none; -webkit-animation-duration: .5s; animation-duration: .5s;-webkit-overflow-scrolling: touch'
                });

                $("#Postousuindex").val(pageii);
            }
        });

    })


    $("#Postousu_close").live("click", function () {
        layer.close($("#Postousuindex").val());
        $("#Postousuindex").val("");
    })

    $("#Postousu_save").live("click", function () {

        var tousuitem = $("#Postousuitem").val();
        var tousulink = $("#Postousulink").val();
        var tousure = $("#Postousure").val();

        if (tousuitem == "") {
            layer.open({ content: "请选择投诉原因", btn: '确认' });
            return false;
        }
        if (tousulink == "") {
            layer.open({ content: "请输入您的联系方式", btn: '确认' });
            return false;
        }
        if (tousure == "") {
            layer.open({ content: "请输入您的举报理由", btn: '确认' });
            return false;
        }

        var pID = $("#positionid").val();

        var layindex = 0;
        $.ajax({
            type: "POST",
            url: "/WeiXin/ashx/ComHandler.ashx?rnd=" + Math.random() + "&action=jobtousu&pid=" + pID,
            data: $("input[data-type='tousu'],textarea[data-type='tousu'],select[data-type='tousu']").serialize(),
            async: true,
            dataType: "json",
            error: function (request) {
            },
            beforeSend: function (request) {
                layindex = layer.open({
                    type: 2, content: '正在加载中，请等待...', shadeClose: false
                });
            },
            success: function (data) {
                layer.close(layindex);
                
               
                if (data.errorcode == "0")
                {
                    layer.open({ content: data.info, btn: '确认' });
                    layer.close($("#Postousuindex").val());
                }
                else
                {
                    if (data.url != "") {
                        layer.open({
                            content: data.info
                           , btn: ['马上登陆','我再看看']
                           , shadeClose: false
                           , yes: function (index) {
                               window.location.href = data.url;  
                           }, no: function (index) {
                               layer.close($("#Postousuindex").val());
                           }

                        });
                    }
                    else
                    {
                        layer.open({ content: data.info, btn: '确认' });
                    }
                }
              

               
              
            }
        });

    })



});


var count = 60 ;
function GetYzm() {

    $("#btnvalidatecode").attr("disabled", "disabled");
    $("#btnvalidatecode").val(count + "秒后重新获取")
    count--;
    if (count > 0) {
        setTimeout(GetYzm, 1000);
    }
    else {
        $("#btnvalidatecode").val("获取验证码");
        $("#btnvalidatecode").attr("disabled", false);
        count = 60 ;
    }
    return false;
}

function checkLinkMobile() {
    var errorCode = $.mCheckNullAndReg("mobile", "mobileTip", $("#mobile").attr("nullmsg"), $("#mobile").attr("errormsg"), "text", $("#mobile").attr("datatype"));
    if (errorCode > 0) {
        return errorCode;
    }
    return errorCode;
}

function checkLinkEmail(userType) {
    var layindex = 0;
    var errorCode = $.mCheckNullAndReg("TxtEmail", "emailTip", $("#TxtEmail").attr("nullmsg"), $("#TxtEmail").attr("errormsg"), "text", $("#TxtEmail").attr("datatype"));
    if (errorCode > 0) {
        //$("#TxtEmail")[0].focus();
        return errorCode;
    }

    $.ajax({
        type: "POST",
        url: "/Weixin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=checkemail",
        data: $("#form1").serialize(),
        async: true ,
        dataType: "json",
        beforeSend: function (request) {
          layindex =   layer.open({
                type: 2, shadeClose: false
                 , content: '正在查询中，请等待...'
            });
        },
        error: function (request) {
            layer.close(layindex);
            layer.open({ content: "查询出错", shadeClose: false, btn: '确认' });
        },
        success: function (data) {
            errorCode = data.errorcode;
            layer.close(layindex);
            if (errorCode == "1") {
                layer.open({ content: "该邮箱已经被注册了,请通过邮箱登陆或更新其它邮箱", shadeClose: false, btn: '确认' });
            }
            //else
            //{
            //    layer.open({ content: '邮箱可以使用' , skin: 'msg', time: 2   });
            //}
        }
    });


    return errorCode;
}

function checkCode() {
    var checkCode = $("#checkCode").val();
    return $.mCheckNullAndReg("checkCode", "checkCodeTip", $("#checkCode").attr("nullmsg"), $("#checkCode").attr("errormsg"), "text", $("#checkCode").attr("datatype"));
}

function jsGetAge(strBirthday) {
    var returnAge;
    var strBirthdayArr = strBirthday.split("-");
    var birthYear = strBirthdayArr[0];
    var birthMonth = strBirthdayArr[1];
    var birthDay = strBirthdayArr[2];

    var d = new Date();
    
    var nowYear = d.getUTCFullYear();
    var nowMonth = d.getMonth() + 1;
    var nowDay = d.getDate();

    if (nowYear == birthYear) {
        returnAge = 0;//同年 则为0岁
        return returnAge;
    }
    else {
        var ageDiff = nowYear - birthYear; //年之差
        if (ageDiff > 0) {
            if (nowMonth == birthMonth) {
                var dayDiff = nowDay - birthDay;//日之差
                if (dayDiff < 0)
                { returnAge = ageDiff - 1; }
                else
                { returnAge = ageDiff; }
            } else {
                var monthDiff = nowMonth - birthMonth;//月之差
                if (monthDiff < 0)
                { returnAge = ageDiff - 1; }
                else
                { returnAge = ageDiff; }
            }
        }
        else {
            returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天}
        }
        return returnAge;//返回周岁年龄
    }
}

function loadRe()
{
    var layindex = 0;
    $.ajax({
        type: "POST",
        url: "/WeiXin/ashx/Handler.ashx?rnd=" + Math.random() + "&action=loadresume",
        data: $("#form1").serialize(),
        async: true,
        dataType: "json",
        beforeSend: function (request) {
           layindex =  layer.open({
                type: 2, content: '正在处理中，请等待...', shadeClose: false
            });
        },
        error: function (request) {
            layer.close(layindex);
            layer.open({ content: "查询出错", shadeClose: false, btn: '确认' });

        },
        success: function (data) {
            errorCode = data.errorcode;
            layer.close(layindex);
            if (errorCode == "0") {
                if (data.obj) {
                    $("#TxtPhone").val(data.obj.userPhone);
                    $("#TxtName").val(data.obj.userName);
                    $(".radio-model").removeClass("radio-cur");
                    $(".radio-model").eq(parseInt(data.obj.userSex) - 1).addClass("radio-cur");
                    $("#TxtBirth").val(data.obj.birthday);
                    $("#TxtEmail").val(data.obj.userEmail);
                    $("#TxtYear").val(data.obj.userWorkyear);
                    $("#area").val(data.obj.area);
                    $("#professional").val(data.obj.professional);
                    $("#title").val(data.obj.title);
                    $("#titleName").html(data.obj.title);
                    $("#titleCode").val(data.obj.titleCode);
                    $("#area").val(data.obj.area);
                    $("#areaname").html(data.obj.workAreaName);
                    $("#salary").val(data.obj.salary);
                    $("#education").attr('value', data.obj.education);
                    $("#desc").val(data.obj.userWorkdesc);
                }
            }
            else {

                layer.open({ content: data.info, shadeClose: false, btn: '确认' });
            }

        }
    });

    return false;
}