function JumpSearchLayers(typeid, positionid, arrayid, fname, vname, tname) {
    var e = e || window.event; // 获取鼠标坐标对象
    var objllist = document.getElementsByTagName("select");
    for (var i = 0; i < objllist.length; i++) {
        objllist[i].style.visibility = "hidden";
    }
    document.getElementById("bodyly").style.display = "block";
    document.getElementById("bodyly").style.width = document.documentElement.scrollWidth;
    document.getElementById("bodyly").style.height = document.documentElement.scrollHeight;
    document.getElementById("SearchDivhire").style.display = 'block';
    if (navigator.appName.indexOf("Explorer") > -1) {
        document.getElementById("SearchDivhire").style.top = document.documentElement.scrollTop + "px";
        document.getElementById("SearchDivhire").style.left = document.documentElement.scrollWidth / 2 - 270 + "px";
    }
    else {
        document.getElementById("SearchDivhire").style.top = document.body.scrollTop + "px";
        document.getElementById("SearchDivhire").style.left = e.clientX - 270 + "px";
    }
    document.getElementById("city").style.display = "none";
    var onecount;
    strs = '';
    if (arrayid == 1) {
        onecount = positionarray.length;
        arraynames = positionarray;
        document.getElementById("wintit").innerHTML = '请选择岗位类别';
        strss = '<span style=line-height:24px;float:left;font-weight:bold;width:500px;>请选择职位</span>'
    }
    if (arrayid == 2) {
        onecount = provincearray.length;
        arraynames = provincearray;
        document.getElementById("wintit").innerHTML = '请选择所在省市';
        strss = '<span style=line-height:24px;float:left;font-weight:bold;width:500px;>请选择城市</span>'
    }
    if (arrayid == 3) {
        onecount = positionarrays.length;
        arraynames = positionarrays;
        document.getElementById("wintit").innerHTML = '请选择岗位类别';
        strs = '<span style=line-height:24px;float:left;font-weight:bold;width:500px;>请选择职位</span>'
    }
    var positionid = positionid;
    var i;
    str = '';
    if (typeid == 2) {
        str = '';
    }
    else
        if (typeid == 0) {
            str = '';
        }
        else {
            str = strs;
        }
    for (i = 0; i < onecount; i++) {
        if (typeid == 2) {
            document.getElementById("hiretype").innerHTML = '';
            str += '<li style="float:left;width:160px;height:20px;cursor:pointer;" onclick=document.' + fname + '.' + vname + '.value="' + arraynames[i][0] + '";document.' + fname + '.' + tname + '.value="' + arraynames[i][0] + "," + arraynames[i][2] + '";unSearchLayers();>' + arraynames[i][0] + '</li>'
            document.getElementById("hiretypes").innerHTML = str;
        }
        else
            if (arraynames[i][1] == positionid) {
                if (typeid == 0) {
                    document.getElementById("hiretype").innerHTML = '';
                    str += '<li onclick=JumpSearchLayers(1,' + arraynames[i][2] + ',' + arrayid + ',"' + fname + '","' + vname + '","' + tname + '");InsertType(' + arraynames[i][2] + ',' + arrayid + ',"' + fname + '","' + vname + '","' + tname + '","' + arraynames[i][0] + '"); onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" style="float:left;width:160px;height:20px;cursor:pointer;"><input type="checkbox" id="checkbox' + arraynames[i][2] + '" name="checkbox' + arraynames[i][2] + '" value="' + arraynames[i][2] + '" onclick=d_checkbox("' + arraynames[i][0] + '","' + arraynames[i][2] + '","' + tname + '");>' + arraynames[i][0] + '</li>'
                    document.getElementById("hiretypes").innerHTML = str;
                }
                else {
                    document.getElementById("hiretype").innerHTML = '';
                    str += '<li onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" style="float:left;width:160px;height:20px;cursor:pointer;"><input type="checkbox" id="checkbox' + arraynames[i][2] + '" name="checkbox' + arraynames[i][2] + '" value="' + arraynames[i][2] + '" onclick=d_checkbox("' + arraynames[i][0] + '","' + arraynames[i][2] + '","' + tname + '")>' + arraynames[i][0] + '</li>'
                    document.getElementById("hiretype").innerHTML = str;
                }
            }
    }
}

function d_checkbox(arrayname, arrayid, tname) {
    if (document.getElementById("checkbox" + arrayid).checked) {
        var xuan = $("#xuan");
        var ol = $("#xuan a");
        if (ol.length >= 5) {
            alert("已经达到最大的5个选择项，超过的选项将不会被查询");
            $("#checkbox" + arrayid).removeAttr("checked");
        }
        else {
            var names = "";
            var ids = "";
            $("#xuan a").each(function () {
                var o = $(this);
                names += o.text() + ",";
                ids += o.attr("itemid") + ",";
            });
            names += arrayname + ",";
            ids += arrayid + ",";
            xuan.append("<a href=\"###\" alt=\"单击取消该项\" id=\"pop_sel_item_" + arrayid + "\" itemid=" + arrayid + " onclick=\"remove('" + arrayid + "'," + tname + ")\">" + arrayname + "</a> ");
            if (tname == 'position') {
                $("#positions").val(names);
                $("#position").val(ids);
            }
            if (tname == 'workadd') {
                $("#workadds").val(names);
                $("#workadd").val(ids);
            }
        }
    } else {
        remove(arrayid, tname);
    }
}

function d_checkbox_old(arrayname, arrayid, tname) {
    if (document.getElementById("checkbox" + arrayid).checked) {
        var arraystr2 = "";
        var arraystr3 = "";
        document.getElementById("xuan").innerHTML += "<a href=\"###\" alt=\"单击取消该项\" id=" + arrayid + " onclick=\"remove(" + arrayid + "," + tname + ")\">" + arrayname + "." + arrayid + "</a> ";
        if (tname == 'position') {
            if (document.getElementById("positions").value == "默认不限") {
                document.getElementById("positions").value = "";
            }
            var arraystr0 = document.getElementById("xuan").innerHTML.replace(/<.+?>/gim, '').replace("[点击确认选择]", "");
            var arraystr1 = arraystr0.split(" ");
            if (arraystr1.length > 6) {
                alert("已经达到最大的5个选择项，超过的选项将不会被查询"); return;
            }
            for (var i = 0; i < arraystr1.length - 1; i++) {
                arraystr2 += arraystr1[i].split(".")[1] + ",";
                arraystr3 += arraystr1[i].split(".")[0] + ",";
            }
            document.getElementById("positions").value = arraystr3;
            document.getElementById("position").value = arraystr2;
        }
        if (tname == 'workadd') {
            if (document.getElementById("workadds").value == '默认不限') {
                document.getElementById("workadds").value = "";
            }
            var arraystr0 = document.getElementById("xuan").innerHTML.replace(/<.+?>/gim, '').replace("[点击确认选择]", "");
            var arraystr1 = arraystr0.split(" ");
            if (arraystr1.length > 6) {
                alert("已经达到最大的5个选择项，超过的选项将不会被查询"); return;
            }
            for (var i = 0; i < arraystr1.length - 1; i++) {
                arraystr2 += arraystr1[i].split(".")[1] + ",";
                arraystr3 += arraystr1[i].split(".")[0] + ",";
            }
            document.getElementById("workadds").value = arraystr3;
            document.getElementById("workadd").value = arraystr2;
        }
    }
}

function remove(id, tname) {
    document.getElementById("xuan").removeChild(document.getElementById('pop_sel_item_' + id));
    document.getElementById("checkbox" + id).checked = false;
    if (tname.id == 'position') {
        document.getElementById("positions").value = document.getElementById("xuan").innerText.replace("[点击确认选择]", "");
        var arraystr0 = document.getElementById("positions").value;
        var arraystr1 = arraystr0.split(" ");
        var arraystr2 = "";
        for (var i = 0; i < arraystr1.length - 1; i++) {
            arraystr2 += arraystr1[i].split(".")[1] + ",";
        }
        document.getElementById("position").value = arraystr2;
    }
    if (tname.id == 'workadd') {
        document.getElementById("workadds").value = document.getElementById("xuan").innerText.replace("[点击确认选择]", "");
        var arraystr0 = document.getElementById("workadds").value;
        var arraystr1 = arraystr0.split(" ");
        var arraystr2 = "";
        for (var i = 0; i < arraystr1.length - 1; i++) {
            arraystr2 += arraystr1[i].split(".")[1] + ",";
        }
        document.getElementById("position").value = arraystr2;
    }
}

function InsertType(positionid, arrayid, fname, vname, tname, nname) {
    document.getElementById("city").style.display = "block";
    strsss = '<li style="float:left;width:500px;height:20px;cursor:pointer;">' + nname + '：</li>'
    strss = strss + strsss;
    document.getElementById("city").innerHTML = strss;
}

function JumpSearchDate(fname, vname, tname) {
    var objllist = document.getElementsByTagName("select");
    for (var i = 0; i < objllist.length; i++) {
        objllist[i].style.visibility = "hidden";
    }
    document.getElementById("wintit").innerHTML = '请选择查询日期';
    document.getElementById("hiretypes").innerHTML = '';
    document.getElementById("hiretype").innerHTML = '';
    document.getElementById("city").innerHTML = '';
    document.getElementById("SearchDivhire").style.display = "block";
    document.getElementById("bodyly").style.display = "block";
    document.getElementById("bodyly").style.width = document.body.clientWidth;
    document.getElementById("bodyly").style.height = document.body.clientHeight;
    document.getElementById("SearchDivhire").style.display = 'block';
    if (navigator.appName.indexOf("Explorer") > -1) {
        document.getElementById("SearchDivhire").style.top = document.documentElement.scrollTop + "px";
        document.getElementById("SearchDivhire").style.left = document.documentElement.scrollWidth / 2 - 270 + "px";

    }
    else {
        document.getElementById("SearchDivhire").style.top = document.body.scrollTop + "px";
        document.getElementById("SearchDivhire").style.left = e.clientX - 270 + "px";

    }

    str = '';
    str += '<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.' + fname + '.' + tname + '.value="3";document.' + fname + '.' + vname + '.value="近三天";unSearchLayers();>·近三天</li>'
    str += '<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.' + fname + '.' + tname + '.value="7";document.' + fname + '.' + vname + '.value="近一周";unSearchLayers();>·近一周</li>'
    str += '<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.' + fname + '.' + tname + '.value="14";document.' + fname + '.' + vname + '.value="近两周";unSearchLayers();>·近两周</li>'
    str += '<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.' + fname + '.' + tname + '.value="30";document.' + fname + '.' + vname + '.value="近一月";unSearchLayers();>·近一月</li>'
    str += '<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.' + fname + '.' + tname + '.value="60";document.' + fname + '.' + vname + '.value="近两月";unSearchLayers();>·近两月</li>'
    str += '<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.' + fname + '.' + tname + '.value="182";document.' + fname + '.' + vname + '.value="近半年";unSearchLayers();>·近半年</li>'
    str += '<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.' + fname + '.' + tname + '.value="365";document.' + fname + '.' + vname + '.value="近一年";unSearchLayers();>·近一年</li>'
    document.getElementById("hiretypes").innerHTML = str;
}

function CsbSearchLayers() {
    var objllist = document.getElementsByTagName('select');
    for (var i = 0; i < objllist.length; i++) {
        objllist[i].style.visibility = "";
    }
    document.getElementById("SearchDivhire").style.display = "none";
    document.getElementById("bodyly").style.display = "none";

    document.getElementById("xuan").innerHTML = "<img src='../images/checkButton.jpg' />";
}


function unSearchLayers() {
    var objllist = document.getElementsByTagName('select');
    for (var i = 0; i < objllist.length; i++) {
        objllist[i].style.visibility = "";
    }
    document.getElementById("xuan").innerHTML = "<img src='../images/checkButton.jpg' />";
    document.getElementById("positions").value = '默认不限';
    document.getElementById("position").value = '';
    document.getElementById("workadds").value = '默认不限';
    document.getElementById("workadd").value = '';
    document.getElementById("SearchDivhire").style.display = "none";
    document.getElementById("bodyly").style.display = "none";
}

//实现层移动 
var mmm = '';
document.onmouseup = MUp;
document.onmousemove = MMove;

function MDown(Object) {
    mmm = Object.id;
    document.getElementById(mmm).setCapture();
    pX = event.x - document.getElementById(mmm).style.pixelLeft;
    pY = event.y - document.getElementById(mmm).style.pixelTop;
}

function MMove() {
    if (mmm != '') {
        document.getElementById(mmm).style.left = event.x - pX;
        document.getElementById(mmm).style.top = event.y - pY;
    }
}

function MUp() {
    if (mmm != '') {
        document.getElementById(mmm).releaseCapture();
        mmm = '';
    }
}
function LTrim(str) {
    var i;
    for (i = 0; i < str.length; i++) {
        if (str.charAt(i) != " " && str.charAt(i) != " ") break;
    }
    str = str.substring(i, str.length);
    return str;
}
function RTrim(str) {
    var i;
    for (i = str.length - 1; i >= 0; i--) {
        if (str.charAt(i) != " " && str.charAt(i) != " ") break;
    }
    str = str.substring(0, i + 1);
    return str;
}
function Trim(str) {
    return LTrim(RTrim(str));
}