﻿// JScript 文件
function showul(id, tds) {
    document.getElementById(id).style.display = "block";
    if (tds != null)
        document.getElementById(tds).style.color = "orange";
}
function closeul(id, tds) {
    document.getElementById(id).style.display = "none";
    var headid = "menu_a";
    if (document.getElementById("Head_id") != null)
        headid = headid + document.getElementById("Head_id").value;
    if (tds != null)
        document.getElementById(tds).style.color = "#fff";
    if (tds == headid)
        document.getElementById(tds).style.color = "Orange";
}


function left1(obj) {
    obj.style.background = "url('image/menu_bg.jpg') 0px 0px no-repeat";
    if (window.location.href.lastIndexOf('/ch/') > -1)
        obj.style.background = "url('../image/menu_bg.jpg') 0px 0px no-repeat";
}
function left2(obj) {
    obj.style.background = "url('image/left_title.gif') 14px 9px no-repeat";
    if (window.location.href.lastIndexOf('/ch/') > -1)
        obj.style.background = "url('../image/left_title.gif') 14px 9px no-repeat";
    var clientid = obj.firstChild.id.replace('href', '');

    if (window.location.href.substring(window.location.href.indexOf('-') + 1, window.location.href.indexOf('.')) == clientid) {
        obj.style.background = "url('image/left_title1.gif') 14px 9px no-repeat";
        if (window.location.href.lastIndexOf('/ch/') > -1)
            obj.style.background = "url('../image/left_title1.gif') 14px 9px no-repeat";
    }

}




function new_left1(obj) {
    obj.style.background = "url('image/menu_bg.jpg') 0px 0px no-repeat";
    if (window.location.href.lastIndexOf('/ch/') > -1)
        obj.style.background = "url('../image/menu_bg.jpg') 0px 0px no-repeat";

    obj.firstChild.style.color = "Orange";
}
function new_left2(obj) {
    obj.style.background = "url('image/left_title.gif') 14px 9px no-repeat";
    if (window.location.href.lastIndexOf('/ch/') > -1)
        obj.style.background = "url('../image/left_title.gif') 14px 9px no-repeat";
    obj.firstChild.style.color = "#000000";
    if (window.location.href.indexOf('csmc-') > 0) {
        document.getElementById("event-left").style.background = "url('image/left_title1.gif') 14px 9px no-repeat";
        if (window.location.href.lastIndexOf('/ch/') > -1)
            document.getElementById("event-left").style.background = "url('../image/left_title1.gif') 14px 9px no-repeat";

        document.getElementById("event-left").firstChild.style.color = "Orange";
    }
    if (window.location.href.indexOf('csmc-') < 0) {
        document.getElementById("center-left").style.background = "url('image/left_title1.gif') 14px 9px no-repeat";
        if (window.location.href.lastIndexOf('/ch/') > -1)
            document.getElementById("center-left").style.background = "url('../image/left_title1.gif') 14px 9px no-repeat";

        document.getElementById("center-left").firstChild.style.color = "Orange";
    }



}






function PageLoad(id) {

    document.getElementById(id).style.color = "#69a8cb";
}


function SelectChange(sel) {
    window.location.href = sel.value + ".aspx";
}

function showMenu(div) {
    document.getElementById(div).style.display = "block";
}
function showMenu1(div) {
    document.getElementById(div).style.display = "none";
}

//中文简体
// modify by lancy 2010-11-18，当新闻有ID号时，各版本能自动转换
//function LinkCH() {
//    var url = window.location.href.replace('#', '');
//    var newurl = url.substring(0, url.lastIndexOf('/')) + "/ch" + url.substring(url.lastIndexOf('/'));
//    window.location.href = newurl + "?lanuage=m";
//}




function LinkCH() {
var url = window.location.href.replace('#', '');
var newurl = url.substring(0, url.lastIndexOf('/')) + "/ch" + url.substring(url.lastIndexOf('/'));
if (url.indexOf('newinfo') != -1) {
newurl = "http://www.csmc.com.cn/hrsh2010/ch/center-1.aspx";
}
window.location.href = newurl + "?lanuage=m";
}
// modify end 



//中文繁体
function LinkCHT() {
    var url = window.location.href.replace('#', '');
    var newurl = url.substring(0, url.lastIndexOf('/')) + "/ch" + url.substring(url.lastIndexOf('/'));
    window.location.href = newurl + "?lanuage=t";
}
// modify by lancy 2010-11-18 当英文新闻有ID号时，各版本能自动转换



//function LinkEN() {
//    var url = window.location.href;
//    if (url.indexOf('?') > -1)
//        url = url.substring(0, url.indexOf('?'));
//    var newurl = url.replace('/ch/', '/');
//    window.location.href = newurl;
//}

function LinkEN() {
var url = window.location.href;
if (url.indexOf('?') > -1)
url = url.substring(0, url.indexOf('?'));
// add by lancy 2011-12-26 首页默认为中文页面，则www.csmc.com.cn页面时不能根据url来切换，先判断页面的地址是否包含ch,如果首页默认是英文的，则直接下面一行代码即可

//var newurl = url.replace('/ch/', '/'); // 2011-12-26前代码
var newurl;
 if (url.indexOf('ch') > -1) 
{
newurl = url.replace('/ch/', '/');
}
else
{
newurl = "http://www.csmc.com.cn/hrsh2010/home.aspx";
}
// add by lancy 2011-12-26 end 
if (url.indexOf('newinfo') != -1) {
newurl = "http://www.csmc.com.cn/hrsh2010/center-1.aspx";
}
window.location.href = newurl;
}




function changeMenu(menu, div) {
    menu.style.backgroundImage = "url('image/home_key_bg_hover.jpg')";
    for (var i = 1; i < 4; i++) {
        var home_div = "home_div" + i;
        var home_menu = "home_menu" + i;
        if (div == i) {
            document.getElementById(home_div).style.display = "block";
        } else {
            document.getElementById(home_div).style.display = "none";
            document.getElementById(home_menu).style.backgroundImage = "url('image/home_key_bg.jpg')";
            if (window.location.href.lastIndexOf('/ch/') > -1) {
                document.getElementById(home_menu).style.backgroundImage = "url('../image/home_key_bg.jpg')";
            }
        }
    }

    var imgId = "home_key" + div + ".jpg";
    document.getElementById("home_key").src = "image/" + imgId;
    if (window.location.href.lastIndexOf('/ch/') > -1) {
        document.getElementById("home_key").src = "../image/" + imgId;
        menu.style.backgroundImage = "url('../image/home_key_bg_hover.jpg')";
    }
}



/*  使用帮助的 DIV 扩展与收缩的JS代码块 */
var minheight = -20;
var maxheight = 510;

function shoppingcat(isopen) {
    var demo = content.style.pixelHeight;
    if (demo < maxheight)
        isopen = 'y';
    else
        isopen = 'n';
    ActionMap(isopen);
}


function ActionMap(isopen) {
    if (isopen == 'y') {
        content.style.display = "block";
        content.style.pixelHeight = maxheight;
        /*if(content.style.pixelHeight<maxheight){
        content.style.pixelHeight+=10;
        setTimeout("ActionMap('y');",1);
        }*/
    } else {
        content.style.pixelHeight -= 10;
        content.style.display = "none";
        /*if(content.style.pixelHeight>minheight)
        setTimeout("ActionMap('n');",1);
        if(content.style.pixelHeight==minheight)
        content.style.display="none";*/

    }
}





function LoadHref(num) {
    var id = "href" + location.href.substring(location.href.lastIndexOf("-") + 1, location.href.lastIndexOf("."));
    if (num != null)
        id = "href" + num;
    if (document.getElementById(id) != null) {
        document.getElementById(id).style.color = "Orange";
        var obj = document.getElementById(id).parentNode;

        obj.style.background = "url('image/left_title1.gif') 14px 9px no-repeat";
        if (window.location.href.lastIndexOf('/ch/') > -1)
            obj.style.background = "url('../image/left_title1.gif') 14px 9px no-repeat";
    }

    var obj_parent;
    if (obj != null && obj.parentNode != null)
        obj_parent = obj.parentNode;
    if (obj_parent != null)
        obj_parent = obj_parent.parentNode;
    if (obj_parent != null)
        obj_parent.style.display = "block";
}



function left_menu_show(div) {
    var div_li = document.getElementById(div);
    div_li.style.display = "block";
}




/****************************             登录注册        ******************/
function Jtrim(str) {

    var i = 0;
    var len = str.length;
    if (str == "") return (str);
    j = len - 1;
    flagbegin = true;
    flagend = true;
    while (flagbegin == true && i < len) {
        if (str.charAt(i) == " ") {
            i = i + 1;
            flagbegin = true;
        }
        else {
            flagbegin = false;
        }
    }

    while (flagend == true && j >= 0) {
        if (str.charAt(j) == " ") {
            j = j - 1;
            flagend = true;
        }
        else {
            flagend = false;
        }
    }

    if (i > j) return ("")

    trimstr = str.substring(i, j + 1);
    return trimstr;
}

function isEmail(s) {
    if (s.length > 100) {
        window.alert("Email地址长度不能超过100位！");
        return false;
    }

    var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|com|gov|mil|org|edu|int)$"
    var re = new RegExp(regu);
    if (s.search(re) != -1) {
        return true;
    } else {
        window.alert("请输入合法有效的Email地址！")
        return false;
    }
}

function CheckForm() {
    if (Jtrim(document.Form1.CName.value) == "") {
        window.alert("请填写姓名！")
        document.Form1.CName.focus();
        return false
    }
    if (Jtrim(document.Form1.txtCodes.value) == "") {
        alert("请填写身份证号码！")
        document.Form1.txtCodes.focus();
        return false;
    }
    if (!checkIdcard2(Jtrim(document.Form1.txtCodes.value))) {
        document.Form1.txtCodes.focus();
        return false;
    }
    if (Jtrim(document.Form1.degree.value) == "") {
        window.alert("请输入文化程度！");
        document.Form1.degree.focus();
        return false;
    }
    if (Jtrim(document.Form1.speciality.value) == "") {
        window.alert("请输入所学专业！");
        document.Form1.speciality.focus();
        return false;
    }
    if (document.Form1.Marriage.value == "") {
        window.alert("请选择婚育状况！");
        document.Form1.Marriage.focus();
        return false;
    }
    if (document.Form1.LocCat.value == "") {
        window.alert("请选择居住地！");
        return false;
    }

    if (Jtrim(document.Form1.WorkYear.value) == "") {
        window.alert("请选择工作年限！");
        document.Form1.WorkYear.focus();
        return false;
    }

    if (Jtrim(document.Form1.Email.value) == "") {
        window.alert("请输入Email地址！");
        document.Form1.Email.focus();
        return false;
    }

    if (!isEmail(Jtrim(document.Form1.Email.value))) {
        document.Form1.Email.focus();
        return false;
    }
    if (Jtrim(document.Form1.AboutStudy.value) == "") {
        window.alert("请填写教育、培训经历！");
        document.Form1.AboutStudy.focus();
        return false;
    }
    if (Jtrim(document.Form1.AboutJob.value) == "") {
        window.alert("请填写工作、项目经验！");
        document.Form1.AboutJob.focus();
        return false;
    }
    if (Jtrim(document.Form1.AboutIT.value) == "") {
        window.alert("请填写IT技能！");
        document.Form1.AboutIT.focus();
        return false;
    }
    if (Jtrim(document.Form1.ResumSource.value) == "员工推荐") {

        if (Jtrim(document.Form1.tjname.value) == "") {
            window.alert("请填写推荐人！");
            document.Form1.tjname.focus();
            return false;
        }
    }
    return true;
}


function sCheckForm() {
    if (Jtrim(document.Form1.sCName.value) == "") {
        window.alert("请填写姓名！")
        document.Form1.sCName.focus();
        return false
    }

    if (Jtrim(document.Form1.txt_code.value) == "") {
        alert("请填写身份证号码！")
        document.Form1.txt_code.focus();
        return false;
    }
    if (!checkIdcard2(Jtrim(document.Form1.txt_code.value))) {
        document.Form1.txt_code.focus();
        return false;
    }
    if (Jtrim(document.Form1.SCHOOLAddress.value) == "") {
        alert("请填写学校所在地址！")
        document.Form1.SCHOOLAddress.focus();
        return false;
    }

    if (Jtrim(document.Form1.txt_qq.value) == "" || isNaN(document.Form1.txt_qq.value)) {
        alert("请填写正确的QQ账号！")
        document.Form1.txt_qq.focus();
        return false;
    }
    if (Jtrim(document.Form1.pheight.value) == "" || isNaN(document.Form1.pheight.value)) {
        alert("请填写正确的身高厘米数！")
        document.Form1.pheight.focus();
        return false;
    }
    if (Jtrim(document.Form1.pweight.value) == "" || isNaN(document.Form1.pweight.value)) {
        alert("请填写正确的体重K数(KG)!")
        document.Form1.pweight.focus();
        return false;
    }
    if (Jtrim(document.Form1.psize.value) == "" || isNaN(document.Form1.psize.value)) {
        alert("请填写正确鞋码数！")
        document.Form1.psize.focus();
        return false;
    }

    if (Jtrim(document.Form1.sMP.value).length != 11 || isNaN(document.Form1.sMP.value)) {
        alert("请填写正确的移动电话！")
        document.Form1.sMP.focus();
        return false;
    }

    if (Jtrim(document.Form1.stxtschool.value) == "") {
        window.alert("请输入目前学校！");
        document.Form1.stxtschool.focus();
        return false;
    }

    if (Jtrim(document.Form1.sdegree.value) == "") {
        window.alert("请输入文化程度！");
        document.Form1.sdegree.focus();
        return false;
    }
    if (Jtrim(document.Form1.sspeciality.value) == "") {
        window.alert("请输入所学专业！");
        document.Form1.sspeciality.focus();
        return false;
    }
    if (document.Form1.sMarriage.value == "") {
        window.alert("请选择婚育状况！");
        document.Form1.sMarriage.focus();
        return false;
    }
    if (document.Form1.sLocCat.value == "") {
        window.alert("请选择居住地！");
        return false;
    }

    if (Jtrim(document.Form1.sWorkYear.value) == "") {
        window.alert("请选择工作年限！");
        document.Form1.sWorkYear.focus();
        return false;
    }

    if (Jtrim(document.Form1.sEmail.value) == "") {
        window.alert("请输入Email地址！");
        document.Form1.sEmail.focus();
        return false;
    }

    if (Jtrim(document.Form1.sCAddress.value) == "") {
        window.alert("请输入学校信箱地址！");
        document.Form1.sCAddress.focus();
        return false;
    }
    if (Jtrim(document.Form1.sZipCode.value).length != 6 || isNaN(Jtrim(document.Form1.sZipCode.value))) {
        window.alert("请输入邮编号码！");
        document.Form1.sZipCode.focus();
        return false;
    }
    if (Jtrim(document.Form1.sEmail.value) == "") {
        window.alert("请输入Email地址！");
        document.Form1.sEmail.focus();
        return false;
    }
    if (Jtrim(document.Form1.sAboutStudy.value) == "") {
        window.alert("请填写教育、培训经历！");
        document.Form1.sAboutStudy.focus();
        return false;
    }
    if (Jtrim(document.Form1.sAboutJob.value) == "") {
        window.alert("请填写实习经验");
        document.Form1.sAboutJob.focus();
        return false;
    }
    if (Jtrim(document.Form1.sAboutIT.value) == "") {
        window.alert("请填写IT技能");
        document.Form1.sAboutIT.focus();
        return false;
    }
    if (Jtrim(document.Form1.sResumSource.value) == "员工推荐") {

        if (Jtrim(document.Form1.stjname.value) == "") {
            window.alert("请填写推荐人！");
            document.Form1.stjname.focus();
            return false;
        }
    }
    return true;
}

function resetForm() {
    document.Form1.CName.value = "";

    document.Form1.Birthday.value = "";
    document.Form1.IDCard.value = "";
    document.Form1.degree.value = "";
    document.Form1.speciality.value = "";
    document.Form1.Marriage.value = "";
    document.Form1.Email.value = "";
    document.Form1.AboutStudy.value = "";
    document.Form1.AboutJob.value = "";
    document.Form1.AboutIT.value = "";
    document.Form1.tjname.value = "";
}



function SetIDType() {
    if (document.Form1.Country.value == "中国大陆")
        document.Form1.IDType.options[0].selected = true;
    else
        document.Form1.IDType.options[1].selected = true;
}




function GetObjID(ObjName) {
    for (var ObjID = 0; ObjID < window.Form1.elements.length; ObjID++)
        if (window.Form1.elements[ObjID].id == ObjName) {
        return (ObjID);
        break;
    }
    return (-1);
}

function ChangeOption(ObjName, DesName) {                    //校园招聘
    //GET OBJECT VALUE, ID OF DESTINATION OBJECT
    ObjID = GetObjID(ObjName);
    DesObjID = GetObjID(DesName);
    if (ObjID != -1 && DesObjID != -1) {
        CatValue = window.Form1.elements[ObjID].value.substring(0, 2);
        if (CatValue == "0")
            document.Form1.elements[DesObjID].length = 0;
        else { //PARSING
            document.Form1.elements[DesObjID].length = 0;
            var tt = document.getElementById("AreaCode").value;
            var SubCategory = tt.split(";");
            //GENERATE OPTIONS
            j = 0;
            //window.alert (CatValue)
            for (var i = 0; i < SubCategory.length; i++) {
                pp = SubCategory[i].split(",");
                //window.alert ( "s:" + pp[0] + "e")
                //window.alert ( pp[0].substring(0,2))
                if (pp[0].substring(0, 2) == CatValue) {
                    if (pp[0].substring(0, 2) == CatValue) {
                        document.Form1.elements[DesObjID].options[j] = new Option(pp[1], pp[0]);
                        document.getElementById("hidsLocation").value = pp[1];
                        j++;
                    }
                }
            }
        }
    }
}

function ChangeOptions(ObjName, DesName) {                      //社会招聘
    //GET OBJECT VALUE, ID OF DESTINATION OBJECT
    ObjID = GetObjID(ObjName);
    DesObjID = GetObjID(DesName);
    if (ObjID != -1 && DesObjID != -1) {
        CatValue = window.Form1.elements[ObjID].value.substring(0, 2);
        if (CatValue == "0")
            document.Form1.elements[DesObjID].length = 0;
        else { //PARSING
            document.Form1.elements[DesObjID].length = 0;
            var tt = document.getElementById("AreaCode").value;
            var SubCategory = tt.split(";");
            //GENERATE OPTIONS
            j = 0;
            //window.alert (CatValue)
            for (var i = 0; i < SubCategory.length; i++) {
                pp = SubCategory[i].split(",");
                //window.alert ( "s:" + pp[0] + "e")
                //window.alert ( pp[0].substring(0,2))
                if (pp[0].substring(0, 2) == CatValue) {
                    if (pp[0].substring(0, 2) == CatValue) {
                        document.Form1.elements[DesObjID].options[j] = new Option(pp[1], pp[0]);
                        document.getElementById("save").value = pp[1];
                        j++;
                    }
                }
            }
        }
    }
}

function ChangeOption_school(ObjName, DesName) {
    //GET OBJECT VALUE, ID OF DESTINATION OBJECT
    ObjID = GetObjID(ObjName);
    DesObjID = GetObjID(DesName);
    if (ObjID != -1 && DesObjID != -1) {
        CatValue = window.Form1.elements[ObjID].value.substring(0, 2);
        if (CatValue == "0")
            document.Form1.elements[DesObjID].length = 0;
        else { //PARSING
            document.Form1.elements[DesObjID].length = 0;
            var tt = document.getElementById("AreaCode").value;
            var SubCategory = tt.split(";");
            //GENERATE OPTIONS
            j = 0;
            //window.alert (CatValue)
            for (var i = 0; i < SubCategory.length; i++) {
                pp = SubCategory[i].split(",");
                //window.alert ( "s:" + pp[0] + "e")
                //window.alert ( pp[0].substring(0,2))
                if (pp[0].substring(0, 2) == CatValue) {
                    if (pp[0].substring(0, 2) == CatValue) {
                        document.Form1.elements[DesObjID].options[j] = new Option(pp[1], pp[0]);
                        document.getElementById("hidschool").value = pp[1];
                        j++;
                    }
                }
            }
        }
    }
}



/**********************    新用户注册       ******/
function checkReg() {
    if (Jtrim(document.getElementById("txt_name").value) == "") {
        alert("请输入用户名！");
        return false;
    }

    if (Jtrim(document.getElementById("txt_pwd").value) == "") {
        alert("请输入密码！");
        return false;
    }
    if (document.getElementById("txt_pwd").value.length < 6) {
        alert("密码不能少于6位！");
        return false;
    }
    if (document.getElementById("txt_pwd").value != document.getElementById("txt_checkPwd").value) {
        alert("两次密码输入的不一致，请重新输入！");
        document.getElementById("txt_pwd").value = "";
        document.getElementById("txt_checkPwd").value = "";
        return false;
    }
    if (Jtrim(document.getElementById("txt_email").value) == "") {
        alert("请输入您的Email地址！");
        return false;
    }
    if (!isEmail(Jtrim(document.getElementById("txt_email").value))) {

        document.getElementById("txt_email").value = "";
        return false;
    } else
    { return true; }
}



/**********            登录验证            ********/
function user_login() {
    if (Jtrim(document.getElementById("txt_login_name").value) == "") {
        alert("请输入登录名！");
        return false;
    }
    if (Jtrim(document.getElementById("txt_login_pwd").value) == "") {
        alert("请输入登录密码！");
        return false;
    } else {
        return true;
    }
}


function showMap(div) {
    var div_id = "map_" + div;
    var obj = document.getElementById(div_id);

    for (var i = 1; i < 6; i++) {
        if (i != div)
            document.getElementById("map_" + i).style.display = "none";
    }
    obj.style.display = "block";
}


function closeMap(div) {
    var div_id = "map_" + div;
    var obj = document.getElementById(div_id);
    obj.style.display = "none";
}



/* 身份证号失去焦点事件  */
function CheckCode(txt) {
    var value = txt.value;
    if (checkIdcard2(value) != false) {
    //edit by lancy 2011-6-28 取身份证最后一位，男双女单
        //if (value.substring(value.length - 1, 1) % 2 == 0)
         if (value.substring(value.length - 1 , value.length - 2) % 2 == 0)
            document.getElementById("txt_sex").value = "女";
        else
            document.getElementById("txt_sex").value = "男";
        var year = value.substring(10, 6);
        var month = value.substring(12, 10);
        var day = value.substring(14, 12);
        var today = new Date();
        document.getElementById("txt_age").value = (Number(today.getFullYear()) - Number(year)).toString();
        document.getElementById("txt_day").value = year + "-" + month + "-" + day;
    }
}

function GetCode(txt) {
    var value = txt.value;
    if (checkIdcard2(value) != false) {
    //edit by lancy 2011-6-28 取身份证最后一位，男双女单
       // if (value.substring(value.length - 1, 1) % 2 == 0)
       if (value.substring(value.length - 1 , value.length - 2) % 2 == 0)
            document.getElementById("txt_sexs").value = "女";
        else
            document.getElementById("txt_sexs").value = "男";
        var year = value.substring(10, 6);
        var month = value.substring(12, 10);
        var day = value.substring(14, 12);
        var today = new Date();
        document.getElementById("txt_ages").value = (Number(today.getFullYear()) - Number(year)).toString();
        document.getElementById("txt_days").value = year + "-" + month + "-" + day;
    }
}

function checkIdcard2(idcard) {
    var Errors = new Array(
"验证通过!",
"身份证号码位数不对!",
"身份证号码出生日期超出范围或含有非法字符!",
"身份证号码校验错误!",
"身份证地区非法!"
);
    var area = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外" }

    var idcard, Y, JYM;
    var S, M;
    var idcard_array = new Array();
    idcard_array = idcard.split("");
    //地区检验
    if (area[parseInt(idcard.substr(0, 2))] == null) {
        alert(Errors[4]);
        return false;
    }
    //身份号码位数及格式检验
    switch (idcard.length) {
        case 15:
            if ((parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0 || ((parseInt(idcard.substr(6, 2)) + 1900) % 100 == 0 && (parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0)) {
                ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/; //测试出生日期的合法性
            } else {
                ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/; //测试出生日期的合法性
            }
            if (ereg.test(idcard)) return true;
            else {
                alert(Errors[2]);
                return false;
            }
            break;
        case 18:
            //18位身份号码检测
            //出生日期的合法性检查 
            //闰年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))
            //平年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))
            if (parseInt(idcard.substr(6, 4)) % 4 == 0 || (parseInt(idcard.substr(6, 4)) % 100 == 0 && parseInt(idcard.substr(6, 4)) % 4 == 0)) {
                ereg = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/; //闰年出生日期的合法性正则表达式
            } else {
                ereg = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/; //平年出生日期的合法性正则表达式
            }
            if (ereg.test(idcard)) {//测试出生日期的合法性
                //计算校验位
                S = (parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7
+ (parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9
+ (parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10
+ (parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5
+ (parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8
+ (parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4
+ (parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2
+ parseInt(idcard_array[7]) * 1
+ parseInt(idcard_array[8]) * 6
+ parseInt(idcard_array[9]) * 3;
                Y = S % 11;
                M = "F";
                JYM = "10X98765432";
                M = JYM.substr(Y, 1); //判断校验位
                if (M == idcard_array[17]) return true; //检测ID的校验位
                else {
                    alert(Errors[3]);
                    return false;
                }
            }
            else {
                alert(Errors[2]);
                return false;
            }
            break;
        default:
            alert(Errors[1]);
            return false;
            break;
    }
}


function SetXY() {
    var x = document.getElementById("btn_job").getBoundingClientRect().left;
    var y = document.getElementById("btn_job").getBoundingClientRect().top;
   
    document.getElementById("div_login_panel").style.left = (x-120) + "px";
    document.getElementById("div_login_panel").style.top = (y-180) + "px";
}


function showLogin() {
    document.getElementById("div_login").style.display = "block";
    document.getElementById("div_login_panel").style.display = "block";
}

function CloseLogin() {
    document.getElementById("div_login").style.display = "none";
    document.getElementById("div_login_panel").style.display = "none";
}
