window.onload = function() {
    App.SetNullHref(0);
    var trCentent = document.getElementById("tbSheetContentContainer");
    trCentent.style.height = document.body.clientHeight*0.9;
}
function jsSystemSettings() { }
/*计算设计的第几列*/
jsSystemSettings.settingCol = "";
/*保存修改的是个人还是单位资料*/
jsSystemSettings.typeMaterial = "";
/*标题的操作*/
jsSystemSettings.showTitle = function(id) {
    var titleDom = $(".titleContent");
    for (var i = 0; i < titleDom.length; i++) {
        titleDom[i].style.display = "none";
    }
    var showTitle = document.getElementById(id);
    showTitle.style.display = "";
    titleDom.length = 0;
    titleDom = null;
    showTitle = null; 
    CollectGarbage(); 
}
/*表单内容切换*/
jsSystemSettings.changeTableContent = function(type) {
    var fieldAdd = document.getElementById("FieldAdd");
    var fieldSave = document.getElementById("FieldSave");
    var tbContent = document.getElementById("tbSheetContentContainer");
    var title = document.getElementById("topDiv");
    var leftMoving = document.getElementById("leftMoving");
    var upMoving = document.getElementById("upMoving");
    var rightMoving = document.getElementById("rightMoving");
    var downMoving = document.getElementById("downMoving");
    leftMoving.style.display = "none";
    upMoving.style.display = "none";
    rightMoving.style.display = "none";
    downMoving.style.display = "none";
    var getTableString = [];
    var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    if (window.ActiveXObject) {
        Sys.ie = ua.match(/msie ([\d.]+)/)[1]
    }
    if (type == "personal") {
        var trCentent = document.getElementById("tbSheetContentContainer");
        trCentent.style.height = document.body.clientHeight * 0.9;/*0.86*/
        title.childNodes[0].innerText = "个人资料设置";
        if (jsSystemSettings.settingTableContent("tdContent")) {
            if (!(document.getElementById("tdContent"))) {/*个人资料*/
                getTableString.push('<table id="tdContent" class="formtable" style="width:98%;background-color:white;" cellpadding="0" cellspacing="0">');
                //                getTableString.push('<colgroup><col style="width:10%"/><col style="width:20%"/><col style="width:5%"/><col style="width:10%"/><col style="width:10%"/><col style="width:20%"/><col style="width:5%"/><col style="width:10%"/><col style="width:10%"/></colgroup>');
                getTableString.push('<tr id="trSheetTitle" ItemCount="0" Path="0_1" >');
                getTableString.push('<td style="text-align:center">标题</td>');
                getTableString.push('<td style="text-align:center">内容</td>');
                getTableString.push('<td style="text-align:center">查询</td>');
                getTableString.push('<td style="text-align:center">操作</td>');
                getTableString.push('<td style="text-align:center">标题</td>');
                getTableString.push('<td style="text-align:center">内容</td>');
                getTableString.push('<td style="text-align:center">查询</td>');
                getTableString.push('<td style="text-align:center">操作</td>');
                getTableString.push('<td style="text-align:center">删除行</td>');
                getTableString.push('</tr></table>');
            } else {
                document.getElementById("tdContent").style.display = "";
            }
        }
        document.getElementById("divDataFields").style.display = "";
        if (document.getElementById("tdRegistration")) {
            document.getElementById("tdRegistration").style.display = "none";
        }
        if (document.getElementById("tdUContent")) {
            document.getElementById("tdUContent").style.display = "none";
        }
        if (document.getElementById("tdRegistration")) {
            document.getElementById("tdRegistration").style.display = "none";
        }
        fieldAdd.onclick = function() { jsSystemSettings.AddRows("tdContent", "trSheetTitle") };
        fieldSave.onclick = function() { jsSystemSettings.SaveRows("jsPersonalInformation.js", "jsPersonalInformation", "tdContent", "trSheetTitle") };
    } else if (type == "unit") {
        var trCentent = document.getElementById("tbSheetContentContainer");
        trCentent.style.height = document.body.clientHeight * 0.9;
        title.childNodes[0].innerText = "单位资料设置";
        if (jsSystemSettings.settingTableContent("tdUContent")) {
            if (!(document.getElementById("tdUContent"))) {/*单位资料*/
                getTableString.push('<table id="tdUContent" class="formtable" style="width:98%;background-color:white;" cellpadding="0" cellspacing="0">');
                //                getTableString.push('<colgroup><col style="width:10%"/><col style="width:20%"/><col style="width:5%"/><col style="width:10%"/><col style="width:10%"/><col style="width:20%"/><col style="width:5%"/><col style="width:10%"/><col style="width:10%"/></colgroup>');
                getTableString.push('<tr id="trUnitTitle" ItemCount="0" Path="0_1" >');
                getTableString.push('<td style="text-align:center">标题</td>');
                getTableString.push('<td style="text-align:center">内容</td>');
                getTableString.push('<td style="text-align:center">查询</td>');
                getTableString.push('<td style="text-align:center">操作</td>');
                getTableString.push('<td style="text-align:center">标题</td>');
                getTableString.push('<td style="text-align:center">内容</td>');
                getTableString.push('<td style="text-align:center">查询</td>');
                getTableString.push('<td style="text-align:center">操作</td>');
                getTableString.push('<td style="text-align:center">删除行</td>');
                getTableString.push('</tr></table>');
            } else {
                document.getElementById("tdUContent").style.display = "";
            }
        }
        document.getElementById("divDataFields").style.display = "";
        if (document.getElementById("tdRegistration")) {
            document.getElementById("tdRegistration").style.display = "none";
        }
        if (document.getElementById("tdContent")) {
            document.getElementById("tdContent").style.display = "none";
        }
        if (document.getElementById("tdRegistration")) {
            document.getElementById("tdRegistration").style.display = "none";
        }
        fieldAdd.onclick = function() { jsSystemSettings.AddRows("tdUContent", "trUnitTitle") };
        fieldSave.onclick = function() { jsSystemSettings.SaveRows("jsDepartmentInformation.js", "jsDepartmentInformation", "tdUContent", "trUnitTitle") };
    } else if (type == "registration" || type == "product") {
        var trCentent = document.getElementById("tbSheetContentContainer");
        trCentent.style.height = document.body.clientHeight * 0.9;
        if (jsSystemSettings.settingTableContent("tdRegistration")) {
            if (!(document.getElementById("tdRegistration"))) {/*单位资料*/
                //                getTableString.push('<input type="text" id="aa" style="width:100%" size ="15"><br/><input type="button" value="测试" onclick="function (){var a = document.getElementById(\'aa\');document.getElementById(\'tdRegistration\').src = a.value; alert(a.value); };">');
                getTableString.push('<iframe id="tdRegistration" width="' + tbContent.clientWidth + '" height="670px" frameborder="0" ></iframe>');
            } else {
                document.getElementById("tdRegistration").style.display = "";
            }
        }
        if (document.getElementById("tdContent")) {
            document.getElementById("tdContent").style.display = "none";
        }
        if (document.getElementById("tdUContent")) {
            document.getElementById("tdUContent").style.display = "none";
        }
        document.getElementById("divDataFields").style.display = "none";
    }
    if (getTableString.length > 0) {
        tbContent.innerHTML += getTableString.join("");
    }
    if (type == "unit") {
        jsSystemSettings.AddOnmouseDownEvent("tdUContent");
    } else if (type == "personal") {
        jsSystemSettings.AddOnmouseDownEvent("tdContent");
    }
    if (type != "registration" && type != "product") {
        fieldSave.style.display = "";
        fieldAdd.style.display = "";
        tbContent.style.position = "";
        //        jsSystemSettings.ShowFieldSaveBtn();
    } else if (type == "registration") {
        title.childNodes[0].innerText = "服务登记设置";
        tbContent.style.position = "relative";
        App.SetNullHref(0);
        document.getElementById('tdRegistration').src = '../CallInputSheetDesign/frmCallInputSheetManage.htm';
        document.getElementById("tdRegistration").parentElement.scrollTop = 0;
    } else if (type == "product") {
        title.childNodes[0].innerText = "产品资料设置";
        tbContent.style.position = "relative";
        App.SetNullHref(0);
        document.getElementById('tdRegistration').src = '../frmProductDataSetting/frmProductData.htm';
        document.getElementById("tdRegistration").parentElement.scrollTop = 0;
    }
    var backClass = $(".TDColor");
    if (backClass.length > 0) {
        for (var j = 0; j < backClass.length; j++) {
            backClass[j].className = "";
        }
    }
    var imgItem = document.getElementsByTagName("IMG");
    for (var i = 0; i < imgItem.length; i++) {
        if (imgItem[i].imageSrc != undefined) {
            imgItem[i].src = imgItem[i].imageSrc;
        } else if (imgItem[i].imageSrc == undefined && imgItem[i].isClick != undefined) {
            imgItem[i].src = "images" + imgItem[i].src.substring(imgItem[i].src.lastIndexOf("/"), imgItem[i].src.length);
        }
    }
    imgItem = null;
    leftMoving = null;
    upMoving = null;
    rightMoving = null;
    downMoving = null;
    fieldAdd = null;
    fieldSave = null;
    tbContent = null;
    App.SetNullHref(0);
    CollectGarbage();
}

/*标题*/
jsSystemSettings.FieldString = "<input type='text' class='ipt' style='width:100px'/>";
/*查询*/
jsSystemSettings.IsOrNotSelect = "<input type='checkbox'/>";
/*条件操作串*/
jsSystemSettings.ConditionOperateString = function(i, tableId) { var showRow = ""; if (i == 3) { showRow = "&nbsp;<input type='button' class='btn' dataSource ='' value='单行显示' onclick='jsSystemSettings.showSingleRow(this,\"" + tableId + "\");'/>" } return "<input type='button' class='btn' value='设计' onclick='jsSystemSettings.designCondition(this," + i + ",\"" + tableId + "\");'/>" + showRow + "&nbsp;<input type='button' class='btn' value='清空' onclick='jsSystemSettings.cleanCondition(this," + i + ");'/>"; }
/*删除按钮*/
jsSystemSettings.deleteButton = function(tbId, trId) { return "<input type='button' class='btn' value='删除' onclick='jsSystemSettings.deleteCondition(this,\"" + tbId + "\",\"" + trId + "\");'/>"; };

/*缓存时间控件设置内容*/
jsSystemSettings.strDateTime = "";
/*缓存多文本输入控件设置内容*/
jsSystemSettings.strTextEareInitAction = null;
/*表单内容新建行*/
jsSystemSettings.AddRows = function(tableId, trId) {
    var rowObj = document.getElementById(trId);
    try {
        var newRowObj = null;
        var insertIndex = parseInt(parseInt(rowObj.rowIndex) + parseInt(rowObj.ItemCount) + 1);
        var newItemIndex = new Date().getTime() + parseInt(Math.random() * 10);
        newRowObj = document.getElementById(tableId).insertRow(insertIndex);
        /*本行内容个数*/
        rowObj.ItemCount = parseInt(rowObj.ItemCount) + 1;
        //        var newItemIndex = rowObj.ItemCount - 1;
        newRowObj.ItemIndex = newItemIndex;
        newRowObj.id = "ItemCondition_" + rowObj.Path + "_" + newRowObj.ItemIndex;
        newRowObj.ParentID = rowObj.id;
        newRowObj.Path = rowObj.Path + "_" + (newRowObj.ItemIndex + 1);
        var ParentPath = rowObj.Path;

        var newCellObj = newRowObj.insertCell(0);
//        $(newCellObj).attr("onmousedown", "jsSystemSettings.newRowEvent(\"" + newRowObj.id + "\", \"" + tableId + "\", 1);");
        newCellObj.innerHTML = jsSystemSettings.FieldString;
        eval('newCellObj.onmousedown = function() { jsSystemSettings.newRowEvent("' + newRowObj.id + '", tableId, 1); }');
        newCellObj = null;
        newCellObj = newRowObj.insertCell(1);
//        $(newCellObj).attr("onmousedown", "jsSystemSettings.newRowEvent(\"" + newRowObj.id + "\", \"" + tableId + "\", 1);");
        newCellObj.innerHTML = "&nbsp;";
        eval('newCellObj.onmousedown = function() { jsSystemSettings.newRowEvent("' + newRowObj.id + '", tableId, 1); }');
        newCellObj = null;
        newCellObj = newRowObj.insertCell(2);
//        $(newCellObj).attr("onmousedown", "jsSystemSettings.newRowEvent(\"" + newRowObj.id + "\", \"" + tableId + "\", 1);");
        newCellObj.style.textAlign = "center";
        newCellObj.innerHTML = jsSystemSettings.IsOrNotSelect;
        eval('newCellObj.onmousedown = function() { jsSystemSettings.newRowEvent("' + newRowObj.id + '", tableId, 1); }');
        newCellObj = null;
        newCellObj = newRowObj.insertCell(3);
        newCellObj.innerHTML = jsSystemSettings.ConditionOperateString(3, tableId);
        newCellObj = null;
        newCellObj = newRowObj.insertCell(4);
//        $(newCellObj).attr("onmousedown", "jsSystemSettings.newRowEvent(\"" + newRowObj.id + "\", \"" + tableId + "\", 2);");
        newCellObj.innerHTML = jsSystemSettings.FieldString;
        eval('newCellObj.onmousedown = function() { jsSystemSettings.newRowEvent("' + newRowObj.id + '", tableId, 2); }');
        newCellObj = null;
        newCellObj = newRowObj.insertCell(5);
//        $(newCellObj).attr("onmousedown", "jsSystemSettings.newRowEvent(\"" + newRowObj.id + "\", \"" + tableId + "\", 2);");
        newCellObj.innerHTML = "&nbsp;";
        eval('newCellObj.onmousedown = function() { jsSystemSettings.newRowEvent("' + newRowObj.id + '", tableId, 2); }');
        newCellObj = null;
        newCellObj = newRowObj.insertCell(6);
//        $(newCellObj).attr("onmousedown", "jsSystemSettings.newRowEvent(\"" + newRowObj.id + "\", \"" + tableId + "\", 2);");
        newCellObj.innerHTML = jsSystemSettings.IsOrNotSelect;
        newCellObj.style.textAlign = "center";
        eval('newCellObj.onmousedown = function() { jsSystemSettings.newRowEvent("' + newRowObj.id + '", tableId, 2); }');
        newCellObj = null;
        newCellObj = newRowObj.insertCell(7);
        newCellObj.innerHTML = jsSystemSettings.ConditionOperateString(7, tableId);
        newCellObj = null;
        newCellObj = newRowObj.insertCell(8);
        newCellObj.innerHTML = jsSystemSettings.deleteButton(tableId, trId);
        newCellObj.style.textAlign = "center";
        //        newRowObj.onmousedown = function() { jsSystemSettings.newRowEvent(this,tableId); }
        newCellObj = null;
        newRowObj = null;
        var tbRows = document.getElementById(tableId).rows;
        if (tbRows.length > 2) {
            var downMoving = document.getElementById("downMoving");
            downMoving.style.display = "";
        }
        //        jsSystemSettings.ShowFieldSaveBtn();
    }
    catch (e) {
        alert(e.message);
    }
    rowObj = null;
    downMoving = null;
    CollectGarbage();
};

jsSystemSettings.newRowEvent = function(id, tableId, position) {
    if (id != undefined && id != "") {
        var obj = document.getElementById(id);
        var leftMoving = document.getElementById("leftMoving");
        var upMoving = document.getElementById("upMoving");
        var rightMoving = document.getElementById("rightMoving");
        var downMoving = document.getElementById("downMoving");
        var tbRows = document.getElementById(tableId).rows;
        leftMoving.style.display = "none";
        upMoving.style.display = "none";
        rightMoving.style.display = "none";
        downMoving.style.display = "none";
        for (var i = 0; i < tbRows.length; i++) {
            if (tbRows[i].id == obj.id) {
                var backClass = $(".TDColor");
                if (backClass.length > 0) {
                    for (var j = 0; j < backClass.length; j++) {
                        backClass[j].className = "";
                    }
                }
                if (position == 2) {
                    var newCells = tbRows[i].cells;
                    for (var j = 4; j < 7; j++) {
                        newCells[j].className = "TDColor";
                    }
                    newCells = null;
                    leftMoving.style.display = "";
                    leftMoving.onclick = function() { jsSystemSettings.alignedMoving(tbRows[i], position, tableId); };
                } else {
                    var newCells = tbRows[i].cells;
                    for (var j = 0; j < 3; j++) {
                        newCells[j].className = "TDColor";
                    }
                    newCells = null;
                    rightMoving.style.display = "";
                    rightMoving.onclick = function() { jsSystemSettings.alignedMoving(tbRows[i], position, tableId); };
                }
                if (i != 1) {
                    upMoving.style.display = "";
                    upMoving.onclick = function() { jsSystemSettings.upMoving(tbRows[i], tbRows[i - 1], position, tableId); };
                }
                if (i != (tbRows.length - 1)) {
                    downMoving.style.display = "";
                }
                downMoving.onclick = function() { jsSystemSettings.downMoving(tbRows[i], tbRows[i + 1], position, tableId); };
                break;
            }
        }
    }
    if (!(obj.cells[3].children[1].dataSource == "" || obj.cells[3].children[1].dataSource == undefined || obj.cells[3].children[1].dataSource == "undefined")) {
        leftMoving.style.display = "none";
        rightMoving.style.display = "none";
    }
    leftMoving = null;
    upMoving = null;
    rightMoving = null;
    downMoving = null;
    obj = null;
    CollectGarbage();
}

/*左右移*/
jsSystemSettings.alignedMoving = function(obj, parameter, tableId) {
    var newCellObj = null;
    var cells = obj.cells;
    for (var i = 0; i < 3; i++) {
        newCellObj = cells[i].innerHTML;
        cells[i].innerHTML = cells[i + 4].innerHTML;
        cells[i + 4].innerHTML = newCellObj;
        newCellObj = null;
    }
    var dateSource = cells[3].children[0].insertSource;
    if (cells[7].children[0] != null) {
        cells[3].children[0].insertSource = cells[7].children[0].insertSource;
        cells[7].children[0].insertSource = dateSource;
    }
    var leftMoving = document.getElementById("leftMoving");
    var upMoving = document.getElementById("upMoving");
    var rightMoving = document.getElementById("rightMoving");
    var downMoving = document.getElementById("downMoving");
    var tbRows = document.getElementById(tableId).rows;
    leftMoving.style.display = "none";
    upMoving.style.display = "none";
    rightMoving.style.display = "none";
    downMoving.style.display = "none";
    if (parameter == 2) {
        parameter = 1;
    } else {
        parameter = 2;
    }
    for (var i = 0; i < tbRows.length; i++) {
        if (tbRows[i].id == obj.id) {
            var backClass = $(".TDColor");
            if (backClass.length > 0) {
                for (var j = 0; j < backClass.length; j++) {
                    backClass[j].className = "";
                }
            }
            if (parameter == 2) {
                var newCells = tbRows[i].cells;
                for (var j = 4; j < 7; j++) {
                    newCells[j].className = "TDColor";
                }
                newCells = null;
                leftMoving.style.display = "";
                leftMoving.onclick = function() { jsSystemSettings.alignedMoving(tbRows[i], parameter, tableId); };
            } else {
                var newCells = tbRows[i].cells;
                for (var j = 0; j < 3; j++) {
                    newCells[j].className = "TDColor";
                }
                newCells = null;
                rightMoving.style.display = "";
                rightMoving.onclick = function() { jsSystemSettings.alignedMoving(tbRows[i], parameter, tableId); };
            }
            if (i != 1) {
                upMoving.style.display = "";
                upMoving.onclick = function() { jsSystemSettings.upMoving(tbRows[i], tbRows[i - 1], parameter, tableId); };
            }
            if (i != (tbRows.length - 1)) {
                downMoving.style.display = "";
            }
            downMoving.onclick = function() { jsSystemSettings.downMoving(tbRows[i], tbRows[i + 1], parameter, tableId); };
            break;
        }
    }
    leftMoving = null;
    upMoving = null;
    rightMoving = null;
    downMoving = null;
    CollectGarbage();
}

/*下移*/
jsSystemSettings.downMoving = function(obj, upsideobj, parameter, tableId) {
    var newCellObj = null;
    var cells = obj.cells;
    var upcells = upsideobj.cells;
    var i = 0;
    var _length = 4;
    if (parameter == 2) {
        i = 4;
        _length = 8;
    }
    for (i; i < _length; i++) {
        newCellObj = cells[i].innerHTML;
        cells[i].innerHTML = upcells[i].innerHTML;
        upcells[i].innerHTML = newCellObj;
        newCellObj = null;
    }
    var getSource = cells[3].children[1].dataSource;
    cells[3].children[1].dataSource = upcells[3].children[1].dataSource;
    upcells[3].children[1].dataSource = getSource;
    if ((getSource == "" || getSource == undefined || getSource == "undefined") && upcells[4].children[0] != null) {
        upcells[3].children[1].value = "单行显示";
    } else {
        upcells[3].children[1].value = "取消单行";
    }
    if ((cells[3].children[1].dataSource == "" || cells[3].children[1].dataSource == undefined || cells[3].children[1].dataSource == "undefined") && cells[4].children[0] != null) {
        cells[3].children[1].value = "单行显示";
    } else {
        cells[3].children[1].value = "取消单行";
    }
    getSource = null;
    var leftMoving = document.getElementById("leftMoving");
    var upMoving = document.getElementById("upMoving");
    var rightMoving = document.getElementById("rightMoving");
    var downMoving = document.getElementById("downMoving");
    var tbRows = document.getElementById(tableId).rows;
    leftMoving.style.display = "none";
    upMoving.style.display = "none";
    rightMoving.style.display = "none";
    downMoving.style.display = "none";
    for (var i = 0; i < tbRows.length; i++) {
        if (tbRows[i].id == obj.id) {
            var backClass = $(".TDColor");
            if (backClass.length > 0) {
                for (var j = 0; j < backClass.length; j++) {
                    backClass[j].className = "";
                }
            }
            if (parameter == 2) {
                var newCells = tbRows[i + 1].cells;
                for (var j = 4; j < 7; j++) {
                    newCells[j].className = "TDColor";
                }
                newCells = null;
                leftMoving.style.display = "";
                leftMoving.onclick = function() { jsSystemSettings.alignedMoving(tbRows[i + 1], parameter, tableId); };
            } else {
                var newCells = tbRows[i + 1].cells;
                for (var j = 0; j < 3; j++) {
                    newCells[j].className = "TDColor";
                }
                newCells = null;
                rightMoving.style.display = "";
                rightMoving.onclick = function() { jsSystemSettings.alignedMoving(tbRows[i + 1], parameter, tableId); };
            }
            if (i != 0) {
                upMoving.style.display = "";
                upMoving.onclick = function() { jsSystemSettings.upMoving(tbRows[i + 1], tbRows[i], parameter, tableId); };
            }
            if (i != (tbRows.length - 2)) {
                downMoving.style.display = "";
            }
            downMoving.onclick = function() { jsSystemSettings.downMoving(tbRows[i + 1], tbRows[i + 2], parameter, tableId); };
            break;
        }
    }
    leftMoving = null;
    upMoving = null;
    rightMoving = null;
    downMoving = null;
    CollectGarbage();
}

/*上移*/
jsSystemSettings.upMoving = function(obj, Beloobjw, parameter, tableId) {

    var newCellObj = null;
    var cells = obj.cells;
    var downcells = Beloobjw.cells;
    var i = 0;
    var _length = 4;
    if (parameter == 2) {
        i = 4;
        _length = 8;
    }
    for (i; i < _length; i++) {
        newCellObj = cells[i].innerHTML;
        cells[i].innerHTML = downcells[i].innerHTML;
        downcells[i].innerHTML = newCellObj;
        newCellObj = null;
    }
    var getSource = cells[3].children[1].dataSource;
    cells[3].children[1].dataSource = downcells[3].children[1].dataSource;
    downcells[3].children[1].dataSource = getSource;
    if ((getSource == "" || getSource == undefined || getSource == "undefined") && downcells[4].children[0] != null) {
        downcells[3].children[1].value = "单行显示";
    } else {
        downcells[3].children[1].value = "取消单行";
    }
    if ((cells[3].children[1].dataSource == "" || cells[3].children[1].dataSource == undefined || cells[3].children[1].dataSource == "undefined") && cells[4].children[0] != null) {
        cells[3].children[1].value = "单行显示";
    } else {
        cells[3].children[1].value = "取消单行";
    }
    getSource = null;
    var leftMoving = document.getElementById("leftMoving");
    var upMoving = document.getElementById("upMoving");
    var rightMoving = document.getElementById("rightMoving");
    var downMoving = document.getElementById("downMoving");
    var tbRows = document.getElementById(tableId).rows;
    leftMoving.style.display = "none";
    upMoving.style.display = "none";
    rightMoving.style.display = "none";
    downMoving.style.display = "none";
    for (var i = 0; i < tbRows.length; i++) {
        if (tbRows[i].id == obj.id) {
            var backClass = $(".TDColor");
            if (backClass.length > 0) {
                for (var j = 0; j < backClass.length; j++) {
                    backClass[j].className = "";
                }
            }
            if (parameter == 2) {
                var newCells = tbRows[i - 1].cells;
                for (var j = 4; j < 7; j++) {
                    newCells[j].className = "TDColor";
                }
                newCells = null;
                leftMoving.style.display = "";
                leftMoving.onclick = function() { jsSystemSettings.alignedMoving(tbRows[i - 1], parameter, tableId); };
            } else {
                var newCells = tbRows[i - 1].cells;
                for (var j = 0; j < 3; j++) {
                    newCells[j].className = "TDColor";
                }
                newCells = null;
                rightMoving.style.display = "";
                rightMoving.onclick = function() { jsSystemSettings.alignedMoving(tbRows[i - 1], parameter, tableId); };
            }
            if (i != 2) {
                upMoving.style.display = "";
                upMoving.onclick = function() { jsSystemSettings.upMoving(tbRows[i - 1], tbRows[i - 2], parameter, tableId); };
            }
            //            if (i != (tbRows.length - 2)) {
            downMoving.style.display = "";
            downMoving.onclick = function() { jsSystemSettings.downMoving(tbRows[i - 1], tbRows[i], parameter, tableId); };
            //            }
            break;
        }
    }
    leftMoving = null;
    upMoving = null;
    rightMoving = null;
    downMoving = null;
    CollectGarbage();
}

/*保存表单设计内容*/
jsSystemSettings.SaveRows = function(fileName, functionName, tableId, trId) {
    var creJSFileResult = jsSystemSettings.CreatJSFileRelationInfo(fileName, functionName, tableId, trId); /*生成JS文件*/
    alert(creJSFileResult);
};

/*显示或隐藏保存表单内容设计按钮*/
jsSystemSettings.ShowFieldSaveBtn = function() {
    if (document.getElementById("tdContent") && document.getElementById("tdContent").style.display != "none") {
        if ($("#trSheetTitle").attr("ItemCount") > 0 && $("#txtLable").val() != "" && $("#txtTableName").val() != "") {
            $("#FieldSave,#s_FieldSave").show();
        }
        else {
            $("#FieldSave,#s_FieldSave").hide();
        }
    }
    else if (document.getElementById("tdUContent") && document.getElementById("tdUContent").style.display != "none") {
        if ($("#trUnitTitle").attr("ItemCount") > 0 && $("#txtLable").val() != "" && $("#txtTableName").val() != "") {
            $("#FieldSave,#s_FieldSave").show();
        }
        else {
            $("#FieldSave,#s_FieldSave").hide();
        }

    }
};

/*将模板设计存储为JS文件*/
jsSystemSettings.CreatJSFileRelationInfo = function(fileName, functionName, tbId, trId) {
    try {
        var jsFile = [];
        var findSame = [];
        var imgItem = document.getElementsByTagName("IMG");
        for (var i = 0; i < imgItem.length; i++) {
            if (imgItem[i].imageSrc != undefined) {
                imgItem[i].src = imgItem[i].imageSrc;
            }
        }
        imgItem = null;
        jsFile.push("function " + functionName + "()");
        jsFile.push("{};");
        var count = document.getElementById(trId).ItemCount;
        var strContent = "";
        strContent = document.getElementById(tbId).outerHTML;
        var trObj = "";
        var fieldOne = "";
        var fieldFive = "";
        var processOne = "";
        var processFive = "";
        var contorlSource = '[[';
        var trList = document.getElementById(tbId).getElementsByTagName("TR");
        for (var i = 0; i < trList.length; i++) {
            if (trList[i].ParentID == trId) {
                //trObj = document.getElementById(tbId + "ItemCondition_0_1_" + i); /*行对象*/
                trObj = trList[i];
                if (trObj.cells[1].children[0] != undefined) {
                    fieldOne = trObj.cells[1].children[0].Field;
                } else if (trObj.cells[1].children[0] == undefined) {
                    fieldOne = "null";
                } else if (trObj.cells[1].children[0].Field != undefined && trObj.cells[1].children[0].className == "Wdate") {
                    fieldOne = trObj.cells[1].children[0].Field + '" ,"timeBetween":"false';
                } else if (trObj.cells[1].children[0].Field == undefined) {
                    fieldOne = trObj.cells[1].children[0].Field + '" ,"timeBetween":"true';
                }
                if (trObj.cells[5].children[0] != undefined) {
                    fieldFive = trObj.cells[5].children[0].Field;
                } else if (trObj.cells[5].children[0] == undefined) {
                    fieldFive = "null";
                } else if (trObj.cells[5].children[0].Field != undefined && trObj.cells[5].children[0].className == "Wdate") {
                    fieldFive = trObj.cells[5].children[0].Field + '" ,"timeBetween":"false';
                } else if (trObj.cells[5].children[0].Field == undefined) {
                    fieldFive = trObj.cells[5].children[0].Field + '" ,"timeBetween":"true';
                }

                if (trObj.cells[1].children[0] != undefined && trObj.cells[1].children[0].process != undefined) {
                    processOne = '"process":' + '"' + trObj.cells[1].children[0].process + '",';
                }
                if (trObj.cells[5].children[0] != undefined && trObj.cells[5].children[0].process != undefined) {
                    processFive = '"process":' + '"' + trObj.cells[5].children[0].process + '",';
                }

                if (contorlSource.length > 2) {
                    contorlSource += ',[';
                }
                if (fieldOne != "null") {
                    findSame.push(trObj.cells[1].children[0].Field);
                }
                if (fieldFive != "null") {
                    findSame.push(trObj.cells[5].children[0].Field);
                }
                contorlSource += '{' + processOne + '"title":"' + trObj.cells[0].childNodes[0].value + '","content":"' + escape(trObj.cells[1].innerHTML) + '","Field":"' + fieldOne + '","IsOrNotSel":"' + (trObj.cells[2].childNodes[0].checked ? "true" : "false") + '"},';
                if (trObj.cells[4].childNodes[0] != null) {
                    contorlSource += '{' + processFive + '"title":"' + trObj.cells[4].childNodes[0].value + '","content":"' + escape(trObj.cells[5].innerHTML) + '","Field":"' + fieldFive + '","IsOrNotSel":"' + (trObj.cells[6].childNodes[0].checked ? "true" : "false") + '"}]';
                } else {
                    contorlSource = contorlSource.substring(0, contorlSource.length - 1) + "]";
                }
            }
        }
        /*查找是否有相同字段*/
        for (var i = 0; i < findSame.length; i++) {
            for (var j = i + 1; j < findSame.length; j++) {
                if (findSame[i] == findSame[j]) {
                    return "保存失败，不能有相同字段！";
                }
            }
        }
        if (contorlSource.length < 5) {
            contorlSource += "]";
        }
        contorlSource += "]";
        jsFile.push(functionName + ".dataJSON =");
        jsFile.push("'" + escape(contorlSource) + "';");
        jsFile.push(functionName + ".strContent= \"");
        jsFile.push(escape(strContent));
        jsFile.push("\";");
        jsFile.push(functionName + ".LoadDesignOnClickRow=function(){"); /*单击列表时加载设计内容方法*/
        jsFile.push("var strLoadOnClick='" + escape(strContent) + "';");
        jsFile.push("$('#" + tbId + "').replaceWith(unescape(strLoadOnClick));");
        jsFile.push("};");
        jsFile.push("function dataValidate(v, p){ jsCommonLogic.dataValidate(v, p); };");
        jsFile.push(functionName + ".initControl= function(){App.SetNullHref(0);");
        if (jsSystemSettings.strDateTime != "") {
            jsFile.push(jsSystemSettings.strDateTime);
        }
        if (jsSystemSettings.strTextEareInitAction != null) {
            jsFile.push(jsSystemSettings.strTextEareInitAction.join(''));
        }

        jsFile.push("App.SetNullHref(1);};");
        var jsSource = jsFile.join("");
        var JSFileInfoObj = jsCommonLogic.GetJSFileInfo($("#hideID").val());
        if (JSFileInfoObj != null) {
            if (JSFileInfoObj.Path != "" && JSFileInfoObj.Path != null) {
                App.FileDelete(App.ApplicationPath() + "Application/TeleSecretary/js/" + fileName);   /*删除原有的本地文件*/
            }
        }
        App.CreateFile(App.ApplicationPath() + "Application/TeleSecretary/js/", fileName, jsSource); /*创建JS文件*/
        fileName, functionName, count, strContent = null;
        jsFile, trObj, jsSource, JSFileInfoObj = null;
        return "保存成功！";
    } catch (e) {
        return "保存失败！" + e.message;
    }
    CollectGarbage();
};
/*当前表单内容选择设计的列*/
jsSystemSettings.CurContentDesignCell = null;
/*设计控件的选择*/
jsSystemSettings.designCondition = function(obj, i, tableId) {
    jsSystemSettings.settingCol = i;
    jsSystemSettings.CurContentDesignCell = obj;
    var showText = obj.parentElement.parentElement.cells[i - 3].children[0].value;
    var controlID = obj.parentElement.parentElement.id.replace("ItemCondition", "Control");
    var saveData = document.getElementById("transmission");
    saveData.dataSource = obj.insertSource;
    var FormIndex = ShowWindow.getFormIdx();
    if (tableId == "tdContent") {
        jsSystemSettings.typeMaterial = "personal";
        if (obj.insertSource != undefined) {
            ShowWindow.ShowMoledDialog("Application/TeleSecretary/eOA_EditControl/eOA_EditInputOrModifyControl.htm?formIdx=" + FormIndex + "&type=EditControl&sheetList=systemSettings&showText=" + showText + "&insertSource=" + escape('ShowWindow.opener.document(App.query("formIdx")).frames["tab_item_frame_tab-systemMan"].document.getElementById("transmission")') + "&controlName =" + controlID + "&tableName=T_EMPLOYEE&sqlType=access&action=jsIndexPage.freshItemPage('tab-systemMan','jsSystemSettings.getSource(\"@str\")')", "添加控件", 600, 650);
        } else {
            ShowWindow.ShowMoledDialog("Application/TeleSecretary/eOA_EditControl/eOA_EditInputOrModifyControl.htm?formIdx=" + FormIndex + "&type=AddControl&sheetList=systemSettings&showText=" + showText + "&controlName =" + controlID + "&tableName=T_EMPLOYEE&sqlType=access&action=jsIndexPage.freshItemPage('tab-systemMan','jsSystemSettings.getSource(\"@str\")')", "修改控件", 600, 650);
        }
    } else if (tableId == "tdUContent") {
        jsSystemSettings.typeMaterial = "unit";
        if (obj.insertSource != undefined) {
            ShowWindow.ShowMoledDialog("Application/TeleSecretary/eOA_EditControl/eOA_EditInputOrModifyControl.htm?formIdx=" + FormIndex + "&type=EditControl&sheetList=systemSettings&showText=" + showText + "&insertSource=" + escape('ShowWindow.opener.document(App.query("formIdx")).frames["tab_item_frame_tab-systemMan"].document.getElementById("transmission")') + "&controlName =" + controlID + "&tableName=T_COMPANY&sqlType=access&action=jsIndexPage.freshItemPage('tab-systemMan','jsSystemSettings.getSource(\"@str\")')", "添加控件", 600, 650);
        } else {
            ShowWindow.ShowMoledDialog("Application/TeleSecretary/eOA_EditControl/eOA_EditInputOrModifyControl.htm?formIdx=" + FormIndex + "&type=AddControl&sheetList=systemSettings&showText=" + showText + "&controlName =" + controlID + "&tableName=T_COMPANY&sqlType=access&action=jsIndexPage.freshItemPage('tab-systemMan','jsSystemSettings.getSource(\"@str\")')", "修改控件", 600, 650);
        }
    } else if (tableId == "tdRegistration") {
        jsSystemSettings.typeMaterial = "unit";
        if (obj.insertSource != undefined) {
            ShowWindow.ShowMoledDialog("Application/TeleSecretary/eOA_EditControl/eOA_EditInputOrModifyControl.htm?formIdx=" + FormIndex + "&type=EditControl&sheetList=systemSettings&showText=" + showText + "&insertSource=" + escape('ShowWindow.opener.document(App.query("formIdx")).frames["tab_item_frame_tab-systemMan"].frames["tdRegistration"].document.getElementById("transmission")') + "&controlName =" + controlID + "&tableName=T_COMPANY&sqlType=access&action=jsIndexPage.freshItemPage('tab-systemMan','jsSystemSettings.getSource(\"@str\")')", "添加控件", 600, 650);
        } else {
            ShowWindow.ShowMoledDialog("Application/TeleSecretary/eOA_EditControl/eOA_EditInputOrModifyControl.htm?formIdx=" + FormIndex + "&type=AddControl&sheetList=systemSettings&showText=" + showText + "&controlName =" + controlID + "&tableName=T_COMPANY&sqlType=access&action=jsIndexPage.freshItemPage('tab-systemMan','jsSystemSettings.getSource(\"@str\")')", "修改控件", 600, 650);
        }
    }
};

/*单行显示*/
jsSystemSettings.showSingleRow = function(obj, tabeId) {
    try {
        var leftMoving = document.getElementById("leftMoving");
        var rightMoving = document.getElementById("rightMoving");
        if (obj.dataSource == undefined || obj.dataSource == "") {
            var showText = "['" + escape(obj.parentElement.parentElement.cells[4].innerHTML) + "','" + escape(obj.parentElement.parentElement.cells[5].innerHTML) + "','" + escape(obj.parentElement.parentElement.cells[6].innerHTML) + "','" + escape(obj.parentElement.parentElement.cells[7].innerHTML) + "']";
            obj.parentElement.parentElement.cells[4].innerHTML = "";
            obj.parentElement.parentElement.cells[5].innerHTML = "";
            obj.parentElement.parentElement.cells[6].innerHTML = "";
            obj.parentElement.parentElement.cells[7].innerHTML = "";
            obj.dataSource = escape(showText);
            leftMoving.style.display = "none";
            rightMoving.style.display = "none";
            obj.value = "取消单行";
        } else {
            var showText = eval(unescape(obj.dataSource));
            obj.parentElement.parentElement.cells[4].innerHTML = unescape(showText[0]);
            obj.parentElement.parentElement.cells[5].innerHTML = unescape(showText[1]);
            obj.parentElement.parentElement.cells[6].innerHTML = unescape(showText[2]);
            obj.parentElement.parentElement.cells[7].innerHTML = unescape(showText[3]);
            obj.dataSource = "";
            leftMoving.style.display = "";
            rightMoving.style.display = "";
            obj.value = "单行显示";
        }
        rightMoving = null;
        leftMoving = null;
    } catch (e) {
        alert("ERROR FOR jsSystemSettings.showSingleRow" + e.message);
    }
    CollectGarbage();
}

/*清空*/
jsSystemSettings.cleanCondition = function(obj, i) {
    var rowObj = obj.parentElement.parentElement;
    rowObj.cells[i - 3].children[0].value = "";
    rowObj.cells[i - 2].innerHTML = "";
    rowObj.cells[i - 1].children[0].checked = false;
    rowObj = null;
    obj = null;
    i = null;
    CollectGarbage();
}

/*表单内容删除行*/
jsSystemSettings.deleteCondition = function(obj, tbId, trId) {
    var rowObj = obj.parentElement.parentElement;
    var itemCount = document.getElementById(trId).ItemCount;
    var currentIndex = rowObj.rowIndex;
    document.getElementById(tbId).deleteRow(currentIndex);
    document.getElementById(trId).ItemCount = itemCount - 1;
    var leftMoving = document.getElementById("leftMoving");
    var upMoving = document.getElementById("upMoving");
    var rightMoving = document.getElementById("rightMoving");
    var downMoving = document.getElementById("downMoving");
    leftMoving.style.display = "none";
    upMoving.style.display = "none";
    rightMoving.style.display = "none";
    downMoving.style.display = "none";
    leftMoving = null;
    upMoving = null;
    rightMoving = null;
    downMoving = null;
    rowObj = null;
    itemCount = null;
    currentIndex = null;
    CollectGarbage();
    //    jsSystemSettings.ShowFieldSaveBtn();
};

/*获取设计数据解析内容*/
jsSystemSettings.getSource = function(str) {
    var strJson = $.parseJSON(unescape(str));
    /*插入字段开始*/
    var findTableName = "";
    var isSame = false;
    if (jsSystemSettings.typeMaterial == "personal") {
        findTableName = "T_EMPLOYEE";
    } else if (jsSystemSettings.typeMaterial == "unit") {
        findTableName = "T_COMPANY";
    }
    try {
        findFieldObj = DBReader.selectSqlForJson("select * from " + findTableName + " where 1=2");
        findFieldObj = $.parseJSON("{" + findFieldObj + "}");
        if (findFieldObj != null) {
            var col = findFieldObj.col;
            var rowCount = col.length;
            if (rowCount > 0) {
                var i = rowCount - 1;
                for (var i = 0; i < rowCount; i++) {
                    if (strJson.identity == col[i].FieldName) {
                        isSame = true;
                        break;
                    }
                }
                i = null;
            }
            col = null;
            rowCount = null;
        }
        if (!(isSame)) {
            var fieldType = "Text(50)";
            if (strJson.format == "text") {
                fieldType = "varchar(50)";
                if (strJson.type == "textarea") {
                    fieldType = "Memo"; /*memo为access备注数据类型*/
                }
            } else if (strJson.format == "dateTime") {
                fieldType = "dateTime";
            } else if (strJson.format == "decimal") {
                if (strJson.type == "integer") {
                    fieldType = "Long";
                } else {
                    fieldType = "NUMERIC(8,4)";
                }
            }
            var accessStr = "ALTER TABLE [" + findTableName + "] ADD COLUMN [" + strJson.identity + "] " + fieldType + " null";
            DBReader.execSql(accessStr);
            accessStr = null;
        }
        isSame = null;
        findTableName = null;
        findFieldObj = null;
    } catch (e) {
        alert("操作错误，输入字段可能是关键字，请重新输入！");
    }
    /* 插入字段结束*/
    var rowObj = jsSystemSettings.CurContentDesignCell.parentElement.parentElement;
    rowObj.cells[jsSystemSettings.settingCol - 3].children[0].value = strJson.title;
    var controlType = strJson.type;
    var controlID = rowObj.id.replace("ItemCondition", "Control");
    var setControl = rowObj.cells[jsSystemSettings.settingCol - 2];
    setControl.innerHTML = unescape(strJson.content);
    switch (controlType) {
        case "text":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            //            setControl.children[0].style.width = "80%";
            break;

        case "textarea":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            setControl.children[0].style.width = setControl.clientWidth * 0.9;
            eval("setControl.children[0].onkeydown = function(){jsTextEare.setEnterKey(this);};");
            //            strInsertHtml = "<textarea id='" + controlID + jsSystemSettings.settingCol + "' type='textarea' cols='50' rows='5' Field='" + strJson.identity + "' format='varchar(500)' class='multxt'></textarea>";
            break;

        case "select":
            if (strJson.dataType == "sql")/*手动添加Item*/
            {
                setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            }
            else if (strJson.dataType == "process")/*根据SQL语句or存储过程添加Item*/
            {
                //                strInsertHtml = "<select id='" + controlID + jsSystemSettings.settingCol + "' type='select' Field='" + strJson.identity + "' format='varchar(50)' dataType='" + strJson.dataType + "' process='" + strJson.process + "' selSource='" + strSelSource + "' SelValueMode='Text'>";
                var strSql = unescape(strJson.process);
                var selectObj = $.parseJSON("{" + DBReader.selectSqlForJson(strSql) + "}");
                var strInsertHtml = "";
                if (selectObj.table != undefined && selectObj.table.length > 0) {
                    for (var i = 0; i < selectObj.table.length; i++) {
                        strInsertHtml += "<option value='" + (selectObj.table[i][strJson.selSource[0].value] == undefined ? "" : selectObj.table[i][strJson.selSource[0].value]) + "'>" + (selectObj.table[i][strJson.selSource[0].name] == undefined ? "" : selectObj.table[i][strJson.selSource[0].name]) + "</option>";
                    }
                }
                strInsertHtml = "<select id='" + controlID + jsSystemSettings.settingCol + "' processName='" + strJson.selSource[0].name + "' processValue='" + strJson.selSource[0].value + "'  type='select' Field='" + strJson.identity + "' format='varchar(50)' dataType='" + strJson.dataType + "' process='" + strJson.process + "' SelValueMode='Text'>" + strInsertHtml + "</select>";
                setControl.process = strJson.process;
                setControl.innerHTML = strInsertHtml;
                strInsertHtml = null;
                selectObj = null;
                strSql = null;
            }
            break;

        case "radio":
            if (strJson.dataType == "sql") {
                for (var i = 0; i < setControl.children.length; i++) {
                    if (setControl.children[i].tagName == "INPUT") {
                        setControl.children[i].id = controlID + jsSystemSettings.settingCol + i;
                    }
                }
            }
            else if (strJson.dataType == "process") {
                var strSql = unescape(strJson.process);
                var selectObj = $.parseJSON("{" + DBReader.selectSqlForJson(strSql) + "}");
                var strInsertHtml = "";
                strSql = null;
                if (selectObj.table != undefined && selectObj.table.length > 0) {
                    for (var i = 0; i < selectObj.table.length; i++) {
                        if (strInsertHtml == "") {
                            strInsertHtml += "<input id='" + controlID + jsSystemSettings.settingCol + "' name='r_" + controlID + "' Field='" + strJson.identity + "' format='varchar(50)' checked='checked' type='radio' value='" + (selectObj.table[i][strJson.selSource[0].value] == undefined ? "" : selectObj.table[i][strJson.selSource[0].value]) + "' dataType='" + strJson.dataType + "' process='" + strJson.process + "' processName='" + strJson.selSource[0].name + "' processValue='" + strJson.selSource[0].value + "'  SelValueMode='Text'/><span>" + (selectObj.table[i][strJson.selSource[0].name] == undefined ? "" : selectObj.table[i][strJson.selSource[0].name]) + "</span>";
                        }
                        else {
                            strInsertHtml += "<input id='" + controlID + jsSystemSettings.settingCol + "_" + i + "' name='r_" + controlID + "' Field='" + strJson.identity + "' type='radio' value='" + (selectObj.table[i][strJson.selSource[0].value] == undefined ? "" : selectObj.table[i][strJson.selSource[0].value]) + "' SelValueMode='Text'/><span>" + (selectObj.table[i][strJson.selSource[0].name] == undefined ? "" : selectObj.table[i][strJson.selSource[0].name]) + "</span>";
                        }
                    }
                    setControl.process = strJson.process;
                    setControl.innerHTML = strInsertHtml;
                    strInsertHtml = null;
                    selectObj = null;
                    strSql = null;
                }
            }
            break;

        case "checkbox":
            if (strJson.dataType == "sql") {
                for (var i = 0; i < setControl.children.length; i++) {
                    if (setControl.children[i].tagName == "INPUT") {
                        setControl.children[0].id = controlID + jsSystemSettings.settingCol + i;
                        setControl.children[0].name = controlType + controlID;
                    }
                }
            }
            else if (strJson.dataType == "process") {
                var strSql = unescape(strJson.process);
                var selectObj = $.parseJSON("{" + DBReader.selectSqlForJson(strSql) + "}");
                var strInsertHtml = "";
                strSql = null;
                if (selectObj.table != undefined && selectObj.table.length > 0) {
                    for (var i = 0; i < selectObj.table.length; i++) {
                        if (strInsertHtml == "") {
                            strInsertHtml += "<input id='" + controlID + jsSystemSettings.settingCol + "' name='chk_" + controlID + "' checked='checked' Field='" + strJson.identity + "' format='varchar(50)' type='checkbox'  value='" + (selectObj.table[i][strJson.selSource[0].value] == undefined ? "" : selectObj.table[i][strJson.selSource[0].value]) + "' dataType='" + strJson.dataType + "' process='" + strJson.process + "' processName='" + strJson.selSource[0].name + "' processValue='" + strJson.selSource[0].value + "' SelValueMode='Text'/><span>" + (selectObj.table[i][strJson.selSource[0].name] == undefined ? "" : selectObj.table[i][strJson.selSource[0].name]) + "</span>";
                        }
                        else {
                            strInsertHtml += "<input id='" + controlID + jsSystemSettings.settingCol + "_" + i + "' name='chk_" + controlID + "' Field='" + strJson.identity + "'  type='checkbox'  value='" + (selectObj.table[i][strJson.selSource[0].value] == undefined ? "" : selectObj.table[i][strJson.selSource[0].value]) + "' SelValueMode='Text'/><span>" + (selectObj.table[i][strJson.selSource[0].name] == undefined ? "" : selectObj.table[i][strJson.selSource[0].name]) + "</span>";
                        }
                    }
                    setControl.process = strJson.process;
                    setControl.innerHTML = strInsertHtml;
                    strInsertHtml = null;
                    selectObj = null;
                    strSql = null;
                }
            }
            break;

        //        case "yyyy-MM-dd": case "yyyy-MM-dd hh:mm:ss":             
        //            setControl.parentElement.parentElement.parentElement.parentElement.style.position = "relative";             
        //            if (strJson.isEndTime) {             
        //                setControl.children[0].id = controlID + jsSystemSettings.settingCol + "startTime";             
        //                setControl.children[1].id = controlID + jsSystemSettings.settingCol + "endTime";             
        //                getTable.innHTML = tableDom.innerHTML;             
        //                if (controlType == "yyyy-MM-dd") {             
        //                    jsSystemSettings.strDateTime += "showTime('" + controlID + jsSystemSettings.settingCol + "startTime','" + controlID + jsSystemSettings.settingCol + "endTime', false, 80);";             
        //                    showTime(controlID + jsSystemSettings.settingCol + "startTime", controlID + jsSystemSettings.settingCol + "endTime", false, 80);             
        //                }             
        //                else if (controlType == "yyyy-MM-dd hh:mm:ss") {             
        //                    jsSystemSettings.strDateTime += "showTime('" + controlID + jsSystemSettings.settingCol + "startTime','" + controlID + jsSystemSettings.settingCol + "endTime', true, 80);";             
        //                    showTime(controlID + jsSystemSettings.settingCol + "startTime", controlID + jsSystemSettings.settingCol + "endTime", true, 80);             
        //                }             

        //            } else {             
        //                setControl.children[0].id = controlID + jsSystemSettings.settingCol;             
        //                getTable.innHTML = tableDom.innerHTML;             
        //                if (controlType == "yyyy-MM-dd") {             
        //                    jsSystemSettings.strDateTime += "showRemindTime(\"" + controlID + jsSystemSettings.settingCol + "\",false,80);";             
        //                    showRemindTime(controlID + jsSystemSettings.settingCol, false, 80);             
        //                }             
        //                else if (controlType == "yyyy-MM-dd hh:mm:ss") {             
        //                    jsSystemSettings.strDateTime += "showRemindTime('" + controlID + jsSystemSettings.settingCol + "');$('#" + controlID + jsSystemSettings.settingCol + "').val(DBReader.ServerTime().ServerFormat('yyyy-MM-dd hh:mm:ss'));";             
        //                    showRemindTime(controlID + jsSystemSettings.settingCol);             
        //                    $("#" + controlID + jsSystemSettings.settingCol).val(DBReader.ServerTime().ServerFormat('yyyy-MM-dd hh:mm:ss'));             
        //                }             
        //            }             
        //            break;             

        case "yyyy":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "MM":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "dd":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "yyyy-MM":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "MM-dd":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "dd hh:mm:ss":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "hh:mm:ss":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "hh:mm":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "hh":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "mm":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "integer":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;

        case "decimal":
            setControl.children[0].id = controlID + jsSystemSettings.settingCol;
            break;
        case "telphone":
            if (jsSystemSettings.typeMaterial == "personal") {
                setControl.children[0].isClick = "per" + controlID + jsSystemSettings.settingCol;
                setControl.children[1].isClick = "per" + controlID + jsSystemSettings.settingCol;

            } else if (jsSystemSettings.typeMaterial == "unit") {
                setControl.children[0].isClick = "com" + controlID + jsSystemSettings.settingCol;
                setControl.children[1].isClick = "com" + controlID + jsSystemSettings.settingCol;
            }
            break;
        case "web":
            if (jsSystemSettings.typeMaterial == "personal") {
                setControl.children[0].isClick = "per" + controlID + jsSystemSettings.settingCol;
                setControl.children[1].isClick = "per" + controlID + jsSystemSettings.settingCol;

            } else if (jsSystemSettings.typeMaterial == "unit") {
                setControl.children[0].isClick = "com" + controlID + jsSystemSettings.settingCol;
                setControl.children[1].isClick = "com" + controlID + jsSystemSettings.settingCol;
            }
            break;

    }
    jsSystemSettings.CurContentDesignCell.insertSource = str;
}

/*验证*/
function dataValidate(v, p) {
    jsCommonLogic.dataValidate(v, p);
};

/*加载表数据*/
jsSystemSettings.settingTableContent = function(tableId) {
    var inputJs = document.createElement("script");
    var _head = document.getElementsByTagName("head");
    var tbContent = document.getElementById("tbSheetContentContainer");
    var isTrue = true;
    App.SetNullHref(0);
    try {
        if (tableId == "tdContent") {
            if (!(document.getElementById("T_EMPLOYEE"))) {
                inputJs.src = "../js/jsPersonalInformation.js";
                inputJs.type = "text/javascript";
                inputJs.id = "T_EMPLOYEE";
                _head[0].appendChild(inputJs);
                tbContent.innerHTML += unescape(jsPersonalInformation.strContent);
                isTrue = false;
            }
        } else if (tableId == "tdUContent") {
            if (!(document.getElementById("T_COMPANY"))) {
                inputJs.src = "../js/jsDepartmentInformation.js";
                inputJs.type = "text/javascript";
                inputJs.id = "T_COMPANY";
                _head[0].appendChild(inputJs);
                tbContent.innerHTML += unescape(jsDepartmentInformation.strContent);
                isTrue = false;
            }
        } else if (tableId == "tdRegistration") {
            if (!(document.getElementById("T_Registration"))) {
                inputJs.src = "../js/jsRegistrationInformation.js";
                inputJs.type = "text/javascript";
                inputJs.id = "T_Registration";
                _head[0].appendChild(inputJs);
                tbContent.innerHTML += unescape(jsRegistrationInformation.strContent);
                isTrue = false;
            }
        }
        if (!isTrue) {
            var controlItem = document.getElementsByTagName("TEXTAREA");
            for (var i = 0; i < controlItem.length; i++) {
                eval("controlItem[i].onkeydown = function(){jsTextEare.setEnterKey(this);};");
            }
        }
    } catch (e) {
    }
    inputJs = null;
    _head = null;
    tbContent = null;
    CollectGarbage();
    return isTrue;
};

/*增加点击*/
jsSystemSettings.AddOnmouseDownEvent = function(tableId) {
    var tbRows = document.getElementById(tableId).rows;
    for (var i = 1; i < tbRows.length; i++) {
        var cellObj = tbRows[i].cells;
        for (var j = 0; j < cellObj.length; j++) {
            if ((j < 7) && j != 3) {
                var position = 2;
                if (j < 3) {
                    position = 1;
                }
                eval('cellObj[j].onmousedown = function() { jsSystemSettings.newRowEvent("' + tbRows[i].id + '", tableId, ' + position + '); }');
                position = null;

            } else {
                if (j != 3) {
                    break;
                }
            }
        }
    }
    tbRows = null;
}
/*服务登记传递设计控件字符串*/
jsSystemSettings.getMessage = function(str) {
    window.frames['tdRegistration'].execScript('jsCallInputSheetManage.getMessage("' + str + '")');
}
/*服务登记传递选择所属类型*/
jsSystemSettings.SetValue = function(str, str2) {
    window.frames['tdRegistration'].execScript('jsCallInputSheetManage.SetValue("' + str + '","' + str2 + '")');
}
/*服务登记树修改*/
jsSystemSettings.sheetManageLoadData = function() {
    window.frames['tdRegistration'].execScript('jsCallInputSheetManage.LoadData()');
}
/*产品资料修改*/
jsSystemSettings.getProductData = function(str1, str2) {
window.frames['tdRegistration'].execScript('jsProductData.getSource("' + str1 + '","' + str2 + '")');
}