//function document.getElementById(id) { return document.getElementById(id); }
var MultiIndustryNumber = 5;
var isShortSelect = 0;
var strExec = "";
var showDivsubWidth = 132;
var htmlDiv = "";
function GenBodyHtml(arrId, arrName, obj, isMulti, iWidth1, isNecessary, ShowLv3) {
    if (ShowLv3 != 0) ShowLv3 = 1;
    var _arrId = eval(arrId);
    var _arrName = eval(arrName);
    //var objId = obj.id.replace("txt", "");
    var objId = obj.id;
    if (arrName.toLowerCase().indexOf("jobtype") > 0)
        return JobDiv();
    else if (arrName.toLowerCase().indexOf("major") > 0)
        return MajorDiv();
    else
        return CommonDiv();

    function CommonDiv() {
        var strWidth = '';
        if (iWidth1 != null) strWidth = ' style="cursor:pointer;width:' + iWidth1 + 'px"';
        if (isMulti == 0) {
            bodyHtml = '<div class="DivShowB BgIcon">';
            bodyHtml += '<div class="NDivCl1"><ul>';
            if (isNecessary == 1) bodyHtml += '<li' + strWidth + ' onMouseOver="this.style.backgroundColor=\'#FFCC00\'" onMouseOut="this.style.backgroundColor=\'\'" onclick="saveInt(\'\',\'请选择\',\'' + objId + '\')">请选择</li>';
            for (i = 0; i < _arrId.length; i++) {
                if (arrName.toLowerCase().indexOf("region") < 0) {
                    bodyHtml += '<li' + strWidth + ' onMouseOver="this.style.backgroundColor=\'#FFCC00\'" onMouseOut="this.style.backgroundColor=\'\'" onclick="saveInt(\'' + _arrId[i] + '\',\'' + _arrName[i] + '\',\'' + objId + '\')">' + _arrName[i] + '</li>';
                } else {
                    if (objId == 'HomeRegion') {
                        bodyHtml += '<li' + strWidth + ' onMouseOver="Lv1Move(this)" onMouseOut="Lv1Move(this)" id="liReg' + _arrId[i] + '" onclick="Lv1Checked(this);RegionDivSubLv2(this, \'' + i + '\', \'' + objId + '\', ' + isMulti + ', ' + ShowLv3 + ')" ondblclick="saveInt(\'' + _arrId[i] + '\',\'' + _arrName[i] + '\',\'' + objId + '\')">' + _arrName[i] + '</li>';
                    }
                    else {
                        bodyHtml += '<li' + strWidth + ' onMouseOver="Lv1Move(this)" onMouseOut="Lv1Move(this)" id="liReg' + _arrId[i] + '" onclick="Lv1Checked(this);RegionDivSubLv2(this, \'' + i + '\', \'' + objId + '\', ' + isMulti + ', ' + ShowLv3 + ')">' + _arrName[i] + '</li>';
                    }
                }
            }
        }
        else {
            bodyHtml = '<div class="DivShowB">';
            bodyHtml += '<div class="DivShowBT"><div id="' + objId + 'Selected" style="float:left;width:' + (popup.W - 105) + 'px"></div><div style="float:right"><span><input type="button" value="确 定" onClick="btnOK_OnClick(\'' + objId + '\' );" /></span><span><a href="###" onClick="emptyData(\'' + objId + '\', \'' + arrId + '\', \'' + arrName + '\');"><img src="http://www.jxzp.cc/images/IconJ.gif" />清空</a></span></div><div style="clear:both;"></div></div>';
            bodyHtml += '<div id="SelectedDiv"><div class="NDivCl1"><ul>';
            for (i = 0; i < _arrId.length; i++) {
                if (arrName.toLowerCase().indexOf("region") < 0) {
                    bodyHtml += '<li style="cursor:pointer';
                    if (iWidth1 != null) bodyHtml += ';width:' + iWidth1 + 'px';
                    bodyHtml += '" onMouseOver="this.style.background=\'#FFCC00\';" onMouseOut="this.style.background=\'\';" onClick="BuildCheckbox(this, \'' + objId + '\', \'' + arrId + '\', \'' + arrName + '\')"' + strWidth + '><input name="' + _arrId[i] + '" value="' + _arrName[i] + '" type="checkbox" onclick="this.checked=!this.checked;" />' + _arrName[i] + '</li>';
                } else {
                    bodyHtml += '<li id="liReg' + _arrId[i] + '" style="cursor:pointer';
                    if (iWidth1 != null) bodyHtml += ';width:' + iWidth1 + 'px';
                    bodyHtml += '" onMouseOver="Lv1Move(this);" onMouseOut="Lv1Move(this);" onClick="Lv1Checked(this);RegionDivSubLv2(this, \'' + i + '\', \'' + objId + '\', ' + isMulti + ', ' + ShowLv3 + ');"><span onClick="Lv1Checked(document.getElementById(\'liReg' + _arrId[i] + '\'));BuildCheckbox(this, \'' + objId + '\', \'' + arrId + '\', \'' + arrName + '\');"><input name="' + _arrId[i] + '" value="' + _arrName[i] + '" type="checkbox" onclick="this.checked=!this.checked;" /></span>' + _arrName[i] + '</li>';
                }
            }
            bodyHtml += '<input type="hidden" id="' + objId + 'ProvisionalData">';
        }
        bodyHtml += '</ul></div>';
        if (arrName.toLowerCase().indexOf("region") >= 0) {
            bodyHtml += '<h6>选择城市</h6>';
            bodyHtml += '<div id="SelectedLi">';
            bodyHtml += '<div id="showSelectedLi"></div>'
            bodyHtml += '<div id="popDivSub" class="showDivsub" style="float:left; position:absolute" onMouseOut="hideSub()" onMouseOver="showSub()"></div></div>';
        }
        bodyHtml += '</div></div>';
        return bodyHtml;
    }

    function JobDiv() {
        var arrId = jsJobTypeL1ID;
        var arrName = jsJobTypeL1;
        var arrPos = [6, 9, 12, 19, 22, 25, 28, 31, 37, 41, 46, 47, 100];
        bodyHtml = '<div class="DivShow"><div class="DivShowB">';
        if (isMulti == 1)
            bodyHtml += '<div class="DivShowBT"><div id="' + objId + 'Selected" style="width:' + (popup.W - 105) + 'px;float:left;"></div><div style="float:right"><span><input type="button" value="确 定" onClick="btnOK_OnClick(\'' + objId + '\' );" /></span><span><a href="###" onClick="emptyData(\'' + objId + '\');" target="_self"><img src="http://www.jxzp.cc/images/IconJ.gif" />清空</a></span></div><div style="clear:both;"></div></div>';
        for (var j = 0; j < arrPos.length - 1; j++) {
            var sPos = 0;
            if (j > 0) sPos = arrPos[j - 1];
            var ePos = arrPos[j];
            bodyHtml += '<div class="NDivCl"';
            if (j % 2 == 1)
                bodyHtml += ' style="background-color:#eef2ff;"';

            bodyHtml += '><span class="NDivClSpan">' + SubIds[j] + '</span>';
            bodyHtml += '<ul class="NDivClUL">';
            for (i = sPos; i < ePos; i++) {
                var _LiIdNi = objId + i;
                if (isMulti == 0)
                    bodyHtml += '<li style="width:120px; cursor: pointer; color: rgb(0, 0, 0);" id="' + _LiIdNi + '" onClick="showSubArea(event,this,\'' + i + '\', \'' + objId + '\' ,\'' + isMulti + '\');" onMouseOut="this.style.color=\'\';this.style.backgroundColor=\'\';hideSub(\'' + objId + '\');" onMouseOver="this.style.color=\'\';this.style.backgroundColor=\'#FFCC00\'">' + arrName[i] + '</li>';
                else
                    bodyHtml += '<li id="' + _LiIdNi + '" style="width:120px;cursor:pointer;" onClick="showSubArea(event,this, \'' + i + '\', \'' + objId + '\' ,\'' + isMulti + '\')" onMouseOut="this.style.backgroundColor=\'\';this.style.color=\'#000\';hideSub(\'' + objId + '\');" onMouseOver="this.style.backgroundColor=\'#FFCC00\';this.style.color=\'\'">' + arrName[i] + '</li>';
            }
            if (isMulti == 1)
                bodyHtml += '<input type="hidden" id="' + objId + 'ProvisionalData">';

            bodyHtml += '</ul>';
            bodyHtml += '</div>';
        }
        bodyHtml += '<div style="clear:both;"></div></div></div>';
        bodyHtml += '<div id="SelectedDiv"><div class="showDivsub" id="popDivSub" onMouseOut="hideSub();"onMouseOver="showSub();" style="float:left;position:absolute;"></div></div>'
        return bodyHtml;
    }

    function MajorDiv() {
        var m1 = new Array();
        var m2 = new Array();
        if (jsMajor[0].indexOf("类") > -1)
            m1 = ["理工类", "农学类", "医学类", "管理学", "法学类", "文学类", "其他类"];
        else
            m1 = ["Technology", "Agronomy", "Medical", "Management", "Law", "Literature", "Others"];
        m2 = [38, 45, 53, 58, 63, 67, 74];

        bodyHtml = "<div class=\"DivShow\"><div class=\"DivShowB\">";
        bodyHtml += "<table width=\"700px\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"zyy\">";
        var bgc = "";
        var is = 0;
        var ie = 0;
        for (i = 0; i < m1.length; i++) {
            if (bgc == "")
                bgc = " bgcolor=\"#EEF2FF\"";
            else
                bgc = "";
            bodyHtml += "  <tr" + bgc + ">";
            bodyHtml += "    <td width=\"80px\" align=\"center\" class=\"zy_zuo\">" + m1[i] + "<\/td>";
            bodyHtml += "    <td align=\"left\" class=\"zy_you\">";
            bodyHtml += "	  <ul class=\"ulmajor\">";
            if (i == 0)
                ie = m2[0];
            else {
                is = m2[i - 1];
                ie = m2[i];
            }
            for (j = is; j < ie; j++) {
                bodyHtml += "        <li class=\"limajor\" onMouseOver=\"this.style.backgroundColor='#FFCC00'\" onMouseOut=\"this.style.backgroundColor=''\" onclick=\"saveInt('" + jsMajorID[j] + "', '" + jsMajor[j] + "', '" + objId + "')\">" + jsMajor[j] + "</li>";
            }
            bodyHtml += "      <\/ul>";
            bodyHtml += "	<\/td>";
            bodyHtml += "  <\/tr>";
        }
        bodyHtml += "<\/table>";
        bodyHtml += '</div></div>';
        return bodyHtml;
    }
}

function saveInt(hiddenValue, buttonValue, objId) {
    //var _hiddenId = "id" + objId;
    //var _buttonId = "txt" + objId;
    var _hiddenId = objId + "Id";
    var _buttonId = objId;
    var strDisplay = buttonValue;

    document.getElementById(_hiddenId).value = hiddenValue;
    document.getElementById(_buttonId).value = strDisplay;
    popup.ibClose();
    if (document.getElementById(_buttonId).className) {
        var ThisInClass = document.getElementById(_buttonId);
        ThisInClass.className = ThisInClass.className.replace("N", "");
    }
    if (strExec != "") {
        eval(strExec);
        strExec = "";
    }
}

function Lv1Checked(obj) {
    for (i = 0; i < region1id.length; i++)
        document.getElementById('liReg' + region1id[i]).style.backgroundColor = "";

    obj.style.backgroundColor = '#00CCFF';
}

function Lv1Move(obj) {
    if (obj.style.backgroundColor == '#00ccff' || obj.style.backgroundColor == 'rgb(0, 204, 255)')
        return;
    if (obj.style.backgroundColor == '#ffcc00' || obj.style.backgroundColor == 'rgb(255, 204, 0)')
        obj.style.backgroundColor = '';
    else
        obj.style.backgroundColor = '#FFCC00';
}

function RegionDivSubLv2(subareaid, Arraya, objId, isMulti, ShowLv3) {
    var subareaids = region2id[Arraya];
    var subareanames = region2[Arraya];
    var arrId = region1id;
    var arrName = region1;
    if (subareaids == undefined) {
        if (isMulti == 0)
            saveInt(arrId[Arraya], arrName[Arraya], objId);
        return false;
    }

    if ((objId == 'GrowPlace' || objId == 'AccountPlace' || objId == 'HomeRegion') && (arrName[Arraya].indexOf("北京") >= 0 || arrName[Arraya].indexOf("天津") >= 0 || arrName[Arraya].indexOf("上海") >= 0 || arrName[Arraya].indexOf("重庆") >= 0)) {
        saveInt(arrId[Arraya], arrName[Arraya], objId);
        return false;
    }
    if (objId == 'MobilePlace' && (arrName[Arraya].indexOf("北京") >= 0 || arrName[Arraya].indexOf("天津") >= 0 || arrName[Arraya].indexOf("上海") >= 0 || arrName[Arraya].indexOf("重庆") >= 0)) {
        document.getElementById("showSelectedLi").innerHTML = "";
        return false
    }

    var iWidth = 50;
    var mLen = 2;
    for (var m = 0; m < subareaids.length; m++) {
        if (subareanames[m].length > mLen) mLen = subareanames[m].length;
    }
    charWidth = 16;
    regValidator = /^[a-zA-Z]+$/;
    if (regValidator.exec(region1[1])) charWidth = 9;
    if (mLen * charWidth > iWidth) iWidth = mLen * (charWidth - 3);
    if (isMulti > 0) iWidth += 12;
    htmlDiv = '<ul>';
    for (var m = 0; m < subareaids.length; m++) {
        if (objId == 'GrowPlace' || objId == 'AccountPlace' || objId == 'HomeRegion')
            var strOnClick = 'saveInt(\'' + subareaids[m] + '\',\'' + subareanames[m] + '\',\'' + objId + '\');';
        else
            var strOnClick = 'RegionDivSubLv3(event,this ,\'' + Arraya + '\',\'' + objId + '\',\'' + m + '\', ' + isMulti + ');';

        if (isMulti == 0)
            htmlDiv += '<li style="cursor:pointer;width:' + iWidth + 'px" id="LI' + subareaids[m] + '" onMouseOver="this.style.backgroundColor=\'#FFCC00\';" onMouseOut="this.style.backgroundColor=\'\';" onClick="' + strOnClick + '">' + subareanames[m] + '</li>';
        else {
            htmlDiv += '<li id="Li' + subareaids[m] + '" style="cursor:pointer;width:' + iWidth + 'px" onMouseOver="this.style.color=\'\';this.style.background=\'#FFCC00\';" onMouseOut="this.style.color=\'#000\';this.style.background=\'\';hideSub(\'' + objId + '\');"'
            if (ShowLv3 == 1)
                htmlDiv += ' onClick="RegionDivSubLv3(event,this ,\'' + Arraya + '\',\'' + objId + '\',\'' + m + '\', ' + isMulti + ')"';

            htmlDiv += '><span onClick="BuildCheckbox(this, \'' + objId + '\', \'region2id\', \'region2\');"><input name="' + subareaids[m] + '" value="' + subareanames[m] + '" type="checkbox" onclick="this.checked=!this.checked;" />';

            if (ShowLv3 == 1)
                htmlDiv += '</span>' + subareanames[m] + '</li>';
            else
                htmlDiv += subareanames[m] + '</span></li>';
        }
    }
    htmlDiv += '</ul>';
    document.getElementById("showSelectedLi").innerHTML = htmlDiv;
    if (isMulti == 1) showCheckbox(objId, 'region2id', 'region2');

    //判断是否超出浏览器下端
    var clientHeight = document.getElementById("msg1").clientHeight;
    var styleTop = parseInt(document.getElementById("msg1").style.top.substring(0, document.getElementById("msg1").style.top.length - 2));
    var curScrollHeight = Math.max(document.documentElement.scrollTop, document.body.scrollTop) + Math.max(document.documentElement.clientHeight, document.body.clientHeight);
    if (clientHeight + styleTop > curScrollHeight)
        document.getElementById("msg1").style.top = (curScrollHeight - clientHeight) + 'px';
}

function RegionDivSubLv3(event, subId, Arraya, objId, Arrayb, isMulti) {
    event = event ? event : window.event
    var tarObj = event.srcElement ? event.srcElement : event.target

    var _subId = subId.id.replace("LI", "");
    var arrId = region3id;
    var arrName = region3;

    var _Divsub = document.getElementById("popDivSub");
    var pos = subid2[Arraya][Arrayb]
    var subareaid = region3id[pos];
    var subarea = region3[pos];
    if (subareaid == undefined) {
        if (isMulti == 0)
            saveInt(_subId, subId.innerHTML, objId);
        return false;
    }
    showSub();
    htmlDiv = '';
    htmlDiv += '<ul style="width:250px">';
    for (var m = 0; m < subareaid.length; m++) {
        if (isMulti == 0)
            htmlDiv += '<li style="cursor:pointer;width:100px" onMouseOver="this.style.backgroundColor=\'#FFCC00\'" onMouseOut="this.style.backgroundColor=\'\'" onClick="saveInt(\'' + subareaid[m] + '\',\'' + subarea[m] + '\',\'' + objId + '\');">' + subarea[m] + '</li>';
        else
            htmlDiv += '<li style="cursor:pointer;width:110px" onMouseOver="this.style.backgroundColor=\'#FFCC00\';" onMouseOut="this.style.backgroundColor=\'\';" onClick="BuildCheckbox(this, \'' + objId + '\', \'region3id\', \'region3\');"><input name="' + subareaid[m] + '" value="' + subarea[m] + '" type="checkbox" onclick="this.checked=!this.checked;" />' + subarea[m] + '</li>';
    }

    htmlDiv += '</ul>';
    _Divsub.innerHTML = htmlDiv;
    var _DivsubTop = getAbsoluteOffsetTop(subId) - getAbsoluteOffsetTop(document.getElementById("msg1"));
    var _DivsubLeft = getAbsoluteOffsetLeft(subId) - getAbsoluteOffsetLeft(document.getElementById("msg1"));
    if (isMulti == 1) showCheckbox(objId, 'region3id', 'region3');
    var parentObj = tarObj;
    var parentOffTop = tarObj.offsetTop;
    while (parentObj = parentObj.offsetParent)
        parentOffTop += parentObj.offsetTop;
    if (parentOffTop - document.documentElement.scrollTop + Math.ceil(subareaid.length / 2) * 19 > document.documentElement.clientHeight)
        _Divsub.style.top = (_DivsubTop - Math.ceil(subareaid.length / 2) * 19) + "px";
    else
        _Divsub.style.top = _DivsubTop + 18 + "px";
    _Divsub.style.left = _DivsubLeft + "px";
    return;
}

function showSub() {
    var _Divsub = document.getElementById("popDivSub");
    _Divsub.style.display = "block";
}

function hideSub() {
    var _Divsub = document.getElementById("popDivSub");
    _Divsub.style.display = "none";
}

function getAbsoluteOffsetTop(obj) {
    var y = obj.offsetTop;
    while (obj = obj.offsetParent) y += obj.offsetTop;
    return y;
}

function getAbsoluteOffsetLeft(obj, dwidth) {
    var x = obj.offsetLeft;
    while (obj = obj.offsetParent) x += obj.offsetLeft;
    var wwidth = document.body.clientWidth;
    if (wwidth < 800)
        wwidth = 800;
    dwidth = wwidth - dwidth;
    if (x > dwidth)
        x = dwidth
    return x;
}

function BuildCheckbox(thisId, objId, arrId, arrName) {
    var _arrId = eval(arrId);
    var _arrName = eval(arrName);
    if (thisId != null) {
        var _thisId = thisId.getElementsByTagName("input")[0];
        var _thisName = _thisId.name;
        if (!_thisId.checked) {
            if (addCheckbox())
                _thisId.checked = true;
        }
        else {
            _thisId.checked = false;
            removeCheckbox(_thisName, objId, arrId, arrName);
        }
    }
    function addCheckbox() {
        var addData = document.getElementById(objId + "ProvisionalData").value;
        var saveAddData = '';
        if (addData.length > 0) {
            //var arr = addData.split(' ');
            var arr = addData.split(',');
            var num = 4;
            if (objId.toLowerCase().indexOf("industry") > 0)
                num = MultiIndustryNumber - 1;
            if (arr.length > num) {
                alert('您选择的数据已经超过' + (num + 1) + '个，请先删除再选择！');
                return false;
            }

            for (var i = 0; i < arr.length; i++) {
                if (_thisName == arr[i])
                    return true;

                if ((!(_thisName.indexOf(arr[i]) == 0 || arr[i].indexOf(_thisName) == 0)) || objId.indexOf("Industry") > -1) {
                    if (saveAddData.length == 0)
                        saveAddData = arr[i];
                    else
                    //saveAddData += ' ' + arr[i];
                        saveAddData += ',' + arr[i];
                }
            }

            if (saveAddData.length == 0)
                saveAddData = _thisName;
            else
            //saveAddData += ' ' + _thisName;
                saveAddData += ',' + _thisName;

            document.getElementById(objId + "ProvisionalData").value = saveAddData;
        }
        else {
            saveAddData = _thisName;
            document.getElementById(objId + "ProvisionalData").value = saveAddData;
        }

        showCheckbox(objId, arrId, arrName);
        return true;
    }
}

function showCheckbox(objId, arrId, arrName) {
    if (document.getElementById(objId + "ProvisionalData").value.length == 0) {
        document.getElementById(objId + "Selected").innerHTML = '';
        document.getElementById(objId + "ProvisionalData").name = '';
        changeChecked(objId);
        return;
    }
    //var arr = document.getElementById(objId + "ProvisionalData").value.split(' ');
    var arr = document.getElementById(objId + "ProvisionalData").value.split(',');
    var sn = '';
    var regname = '';
    var sns = '';

    for (var i = 0; i < arr.length; i++) {
        if (i > 0) sn += ' ';
        regname = seekValueId(arr[i], arrId, arrName);

        if (!regname) {
            if (arrId.indexOf("region") > -1) {
                regname = seekValueId(arr[i], region1id, region1);
                if (!regname) regname = seekValueId(arr[i], region2id, region2);
            }
            else
                regname = seekValueId(arr[i], jsJobTypeL1ID, jsJobTypeL1);
        }
        if (arr[i].length == 2 && arrId.indexOf("Job") > 0) regname = "全部" + regname;

        sns += '<li onMouseOver="this.style.color=\'#ff7300\'" onMouseOut="this.style.color=\'\'" onclick="getThisValue(this,\'' + objId + '\', \'' + arrId + '\', \'' + arrName + '\')"><input onclick="this.checked=!this.checked;" type=\'checkbox\' value=\'' + arr[i] + '\' checked=\'checked\' />' + regname + '</li>';
        sn += regname;
    }
    sns = '<ul class="ThisLiInput">' + sns + '</ul>';

    document.getElementById(objId + "Selected").innerHTML = sns;
    document.getElementById(objId + "ProvisionalData").name = sn;
    changeChecked();

    function changeChecked() {
        //var arr = document.getElementById(objId + "ProvisionalData").value.split(' ');
        var arr = document.getElementById(objId + "ProvisionalData").value.split(',');
        var _inputs = document.getElementById("SelectedDiv").getElementsByTagName("input");
        for (var i = 0; i < _inputs.length; i++) {
            var obj = _inputs[i];
            obj.checked = false;
            for (var j = 0; j < arr.length; j++) {
                if (obj.name == arr[j])
                    obj.checked = true;
            }
        }
    }
}

function seekValueId(regid, arrId, arrName) {
    if (regid.length <= 2 || arrId.indexOf("Industry") > -1) {
        var _arrId = eval(arrId);
        var _arrName = eval(arrName);
        for (var i = 0; i < _arrId.length; i++) {
            if (_arrId[i] == regid)
                return _arrName[i];
        }
    }
    if (regid.length == 4) {
        if (arrName.toLowerCase().indexOf("region") >= 0) {
            subarrId = region2id;
            subarrName = region2;
        }
        else {
            subarrId = jsJobTypeL2ID;
            subarrName = jsJobTypeL2;
        }
        for (var i = 0; i < subarrId.length; i++) {
            if (subarrId[i] != null) {
                for (var j = 0; j < subarrId[i].length; j++) {
                    if (subarrId[i][j] == regid)
                        return subarrName[i][j];
                }
            }
        }
    }
    if (regid.length == 6) {
        for (var i = 0; i < region3id.length; i++) {
            if (region3id[i] != null) {
                for (var j = 0; j < region3id[i].length; j++) {
                    if (region3id[i][j] == regid)
                        return region3[i][j];
                }
            }
        }
    }
    return '';
}

function btnOK_OnClick(objId) {
    //    var _hiddenId = "id" + objId;
    //    var _buttonId = "txt" + objId;
    var _hiddenId = objId + "Id";
    var _buttonId = objId;
    document.getElementById(_hiddenId).value = document.getElementById(objId + "ProvisionalData").value;

    var IsChinese = false;
    //alert(document.getElementById(objId + "ProvisionalData").name);
    var arrCheck = document.getElementById(objId + "ProvisionalData").name.split("");
    for (var i = 0; i < arrCheck.length; i++) {
        regValidator = /^[\u4E00-\u9FFF]+$/;
        if (regValidator.exec(arrCheck[i])) {
            IsChinese = true;
            break;
        }
    }
    var num = 26;
    if (isShortSelect == 1) num = 15;
    if (isShortSelect == 2) num = 18;
    //    if (IsChinese) {
    //        if (document.getElementById(objId + "ProvisionalData").name.length > num)
    //            document.getElementById(_buttonId).value = document.getElementById(objId + "ProvisionalData").name.substr(0, num - 1) + "...";
    //        else
    //            document.getElementById(_buttonId).value = document.getElementById(objId + "ProvisionalData").name;
    //    }
    //    else {
    //        if (document.getElementById(objId + "ProvisionalData").name.length > 48)
    //            document.getElementById(_buttonId).value = document.getElementById(objId + "ProvisionalData").name.substr(0, 48) + "...";
    //        else
    //            document.getElementById(_buttonId).value = document.getElementById(objId + "ProvisionalData").name;
    //    }

    var sName = document.getElementById(objId + "ProvisionalData").name;
//   if (IsChinese) {
//        if (sName.length > num)
//            document.getElementById(_buttonId).value = sName.substr(0, num - 1) + "...";
//        else
//            document.getElementById(_buttonId).value = sName;
//    }
//    else {
//        if (sName.length > 48)
//            document.getElementById(_buttonId).value = sName.substr(0, 48) + "...";
//        else
//            document.getElementById(_buttonId).value = sName;
//    }
    document.getElementById(_buttonId).value = sName;
    if (document.getElementById(_buttonId).value.length == 0) {
        document.getElementById(_buttonId).value = "请选择";
    }
    popup.ibClose();
    if (document.getElementById(_buttonId).className) {
        var ThisInClass = document.getElementById(_buttonId);
        var _ThisInClass = ThisInClass.className.replace("N", "");
        ThisInClass.className = _ThisInClass;
    }
}

function getHiddenFormsData(objId, arrId, arrName) {
    if (document.getElementById(objId + "ProvisionalData")) {
        //var _hiddenId = "id" + objId;
        var _hiddenId = objId + "Id";
        document.getElementById(objId + "ProvisionalData").value = document.getElementById(_hiddenId).value;
        showCheckbox(objId, arrId, arrName);
    }
}

function getThisValue(chk, objId, arrId, arrName) {
    var removeid = chk.getElementsByTagName("input")[0].value;
    removeCheckbox(removeid, objId, arrId, arrName);
}

function removeCheckbox(removeId, objId, arrId, arrName) {
    var removeData = document.getElementById(objId + "ProvisionalData").value;
    removeData = removeData.replace(removeId + ' ', '').replace(' ' + removeId, '');
    if (removeData == removeId) {
        removeData = '';
    }
    document.getElementById(objId + "ProvisionalData").value = removeData;
    showCheckbox(objId, arrId, arrName);
}

function emptyData(objId, arrId, arrName) {
    document.getElementById(objId + "ProvisionalData").value = '';
    showCheckbox(objId, arrId, arrName);
}

function showSubArea(event, SubId, Arrayb, objId, isMulti) {
    event = event ? event : window.event
    var tarObj = event.srcElement ? event.srcElement : event.target
    var subareaids = jsJobTypeL2ID[Arrayb];
    var subareanames = jsJobTypeL2[Arrayb];
    var _Divsub = document.getElementById("popDivSub");
    var _DivsubTop = getAbsoluteOffsetTop(SubId) - getAbsoluteOffsetTop(document.getElementById("msg1"));
    var _DivsubLeft = getAbsoluteOffsetLeft(SubId) - getAbsoluteOffsetLeft(document.getElementById("msg1"));
    var jobItemWidth = 130;
    if (isMulti == 1)
        jobItemWidth = 145;
    var ulWidth = jobItemWidth + 12;
    if (subareaids.length > 7) ulWidth = jobItemWidth * 2 + 12;
    _Divsub.style.width = ulWidth + 'px';
    htmlDiv = '';
    if (isMulti == 1)
        htmlDiv += '<p style=" width:' + ulWidth + 'px；overflow:hidden" onMouseOver="this.style.color=\'\';this.style.background=\'#FFCC00\';" onMouseOut="this.style.color=\'#000\';this.style.background=\'\';"  onClick="BuildCheckbox(this, \'' + objId + '\', \'jsJobTypeL2ID\', \'jsJobTypeL2\');"><input name="' + jsJobTypeL1ID[Arrayb] + '" value="' + jsJobTypeL1[Arrayb] + '" type="checkbox" onclick="this.checked=!this.checked;" />全部' + jsJobTypeL1[Arrayb] + '类</p>';

    htmlDiv += '<ul style="width:' + ulWidth + 'px">';
    for (var m = 0; m < subareaids.length; m++) {
        if (isMulti == 0) {
            htmlDiv += '<li style="cursor:pointer;width:' + jobItemWidth + 'px" onMouseOver="this.style.backgroundColor=\'#FFCC00\';"';
            htmlDiv += ' onMouseOut="this.style.backgroundColor=\'\';" onClick="saveInt(\'' + subareaids[m] + '\',\'' + subareanames[m] + '\',\'' + objId + '\');">' + subareanames[m];
            htmlDiv += '</li>';
        }
        else
            htmlDiv += '<li style="cursor:pointer; width:' + jobItemWidth + 'px;" onMouseOver="this.style.color=\'\';this.style.background=\'#FFCC00\';" onMouseOut="this.style.color=\'\';this.style.background=\'\';" onClick="BuildCheckbox(this, \'' + objId + '\', \'jsJobTypeL2ID\', \'jsJobTypeL2\');"><input name="' + subareaids[m] + '" value="' + subareanames[m] + '" type="checkbox" onclick="this.checked=!this.checked;" />' + subareanames[m] + '</li>';
    }
    htmlDiv += '</ul>';
    _Divsub.innerHTML = htmlDiv;
    _Divsub.style.display = "block";
    var _DivsubTop = getAbsoluteOffsetTop(SubId) - getAbsoluteOffsetTop(document.getElementById("msg1"));
    var _DivsubLeft = getAbsoluteOffsetLeft(SubId) - getAbsoluteOffsetLeft(document.getElementById("msg1"));
    var parentObj = tarObj;
    var parentOffTop = tarObj.offsetTop;
    while (parentObj = parentObj.offsetParent)
        parentOffTop += parentObj.offsetTop;
    if (parentOffTop - document.documentElement.scrollTop + Math.ceil(subareaids.length / 2) * 19 > document.documentElement.clientHeight)
        _Divsub.style.top = (_DivsubTop - Math.ceil(subareaids.length / 2) * 19) + "px";
    else
        _Divsub.style.top = _DivsubTop + 18 + "px";
    _Divsub.style.left = _DivsubLeft + "px";

    if (isMulti == 1) showCheckbox(objId, 'jsJobTypeL2ID', 'jsJobTypeL2');

}

function CommonSelect(obj, arrId, arrName, W, innerW, isNecessary, isMulti, HeaderTitle, ShowLv3) {
    popup.clearData()
    popup.drag = 1;
    popup.mask = 3;
    popup.H = 1;
    popup.W = W;
    popup.dockObj = obj;
    if (!HeaderTitle) {
        popup.headerTitle = "";
        popup.isHeader = 0;
    } else {
        popup.headerTitle = HeaderTitle;
        popup.isHeader = 1;
    }
    if (HeaderTitle)
        if (HeaderTitle.indexOf("双击选择") > -1)
            popup.dockTop = -190;
    popup.bodyHtml = GenBodyHtml(arrId, arrName, obj, isMulti ? 1 : 0, innerW, isNecessary, ShowLv3);
    popup.creatDiv();
    //getHiddenFormsData(obj.id.replace("txt", ""), arrId, arrName);
    getHiddenFormsData(obj.id, arrId, arrName);

    if (arrId.indexOf("region") > -1 && isMulti == 1) {
        var _li = document.getElementById("msg1").document.getElementsByTagName("li");
        for (var i = 0; i < _li.length; i++) {
            if (_li[i].id) {
                if (_li[i].id.toLowerCase().indexOf("lireg") > -1) {
                    Lv1Checked(_li[i]);
                    if (ShowLv3 != 0) ShowLv3 = 1;
                    //RegionDivSubLv2(_li[i], '0', obj.id.replace("txt", ""), isMulti ? 1 : 0, ShowLv3);
                    RegionDivSubLv2(_li[i], '0', obj.id, isMulti ? 1 : 0, ShowLv3);
                    break;
                }
            }
        }
    }
}

function GetRootUrl() {
    var url = window.location.href;
    var length = url.replace("//", "**").indexOf("/");
    length = length == -1 ? url.length : length;
    return url.substring(0, length);
}
