function jsSMSSendTo() {

};
/*条件人员列表*/
jsSMSSendTo.SMSGridList = null;
/*短信策略表*/
jsSMSSendTo.SMSPoliciesGrid = null;
/*短信策略表选中行*/
jsSMSSendTo.SMSPoliciesGridSelectRow = null;
/*查询条件文件名*/
jsSMSSendTo.searchFileName = "";


$(function() {
    $(document.body).mask("页面加载中,请稍后...");
    jsSMSSendTo.LoadSMSGridList();
    jsSMSSendTo.LoadSMSPoliciesGridList();
    App.SetNullHref(0);
    
     var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    if (window.ActiveXObject) {
        Sys.ie = ua.match(/msie ([\d.]+)/)[1]
    }
    if (Sys.ie != "6.0") {
        $("#txtAreaMessage").ikeEditor({ width: 410, height: 160, HiddentToolBar: true, ValueMode: 'Text' });
    }else{
        $("#txtAreaMessage").ikeEditor({ width: 420, height: 130, HiddentToolBar: true, ValueMode: 'Text' });
    }
    App.SetNullHref(1);
    var condition = document.getElementById("btnCondition");
    condition.style.width = 250;
    condition.style.marginLeft = condition.parentElement.offsetWidth - 390;
    condition = null;
    $("#txtStartDate").click(function() {
        App.SetNullHref(0);
        WdatePicker({ maxDate: '#F{$dp.$D(\\\'txtEndDate\\\')}' });
    });
    $("#txtEndDate").click(function() {
        App.SetNullHref(0);
        WdatePicker({ minDate: '#F{$dp.$D(\\\'txtStartDate\\\')}' });
    });
//    $("#btnAdd").click(function() {

//    });
    $(document.body).unmask();
});


/*新增*/
jsSMSSendTo.OnclickAddBtn=function(){
        $("#policiesID").val("");
        $("#txtPoliciesName").val("");
        $("#txtRemark").val("");
        $("#txtStartDate").val("");
        $("#txtEndDate").val("");
        $("#chkSign").removeAttr("checked");
        $("#txtSign").val("");
        $("#txtAreaMessage").value("");
        $("#chkSend").removeAttr("checked");
        $("#spResult").text("");
        if (jsSMSSendTo.SMSPoliciesGridSelectRow != null) {
            $("tr", jsSMSSendTo.SMSPoliciesGridSelectRow.parentElement.parentElement).each(function() {
                $(this).removeClass("trSelected");
            });
            jsSMSSendTo.SMSPoliciesGridSelectRow = null;
        }
        var sendTimeObj = document.getElementById("RowSourceInput");
        sendTimeObj.SendTermin = "";
        sendTimeObj.SendOpportunity = "";
        sendTimeObj.SendTime = "";
        sendTimeObj.SendTypeSign = "";
        $("#btnSaveSMS").removeAttr("disabled");
        $("#btnSaveSMS").attr("saveMode", "added");
        jsSMSSendTo.searchFileName = ("js" + new Date().getTime() + parseInt(Math.random() * 10)).replace(/0/g, "a").replace(/1/g, "b").replace(/2/g, "c").replace(/3/g, "d").replace(/4/g, "e").replace(/5/g, "f").replace(/6/g, "g").replace(/7/g, "h").replace(/8/g, "i").replace(/9/g, "j");
        jsSMSSendTo.SMSGridList.DoSearch();
        sendTimeObj = null;
        CollectGarbage();
}

/*加载短信策略列表*/
jsSMSSendTo.LoadSMSPoliciesGridList = function() {
    var w = $(document.documentElement).width();
    var gh = 80;
    var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    if (window.ActiveXObject) {
        Sys.ie = ua.match(/msie ([\d.]+)/)[1]
    }
    if (Sys.ie != "6.0") {
        gh = parseInt($(document.documentElement).height()) - parseInt(document.getElementById("divBottom").offsetHeight) - parseInt(document.getElementById("divCenten").offsetHeight) - parseInt(document.getElementById("div-title").offsetHeight)-60;
    }
    var tableGridOption =
    {
        height: gh,
        width: w,
        colModel: [
	        { display: '策略名称', name: 'PoliciesName', width: (w * 0.1), sortable: true, align: 'left' },
	        { display: '策略备注', name: 'Remark', width: (w * 0.1), sortable: true, align: 'left' },
	        { display: '开始日期', name: 'StartDate', width: (w * 0.18), sortable: true, align: 'left' },
	        { display: '结束日期', name: 'EndDate', width: (w * 0.18), sortable: true, align: 'left' },
            { display: '序号', name: 'ID', width: (w * 0.06), sortable: true, hide: true, align: 'left' },
            { display: '操作', name: 'Operate', width: (w * 0.06), sortable: true, align: 'center', process: jsSMSSendTo.sMSPoliciesGridoperate },
	        { display: '启用', name: 'EndElag', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '是否定时发送', name: 'IsSendTime', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '是否携带签名', name: 'IsSignatur', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '发送时间', name: 'SendTime', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '发送时机', name: 'SendOpportunity', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '发送期限', name: 'SendTermin', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '发送类型标志', name: 'SendTypeSign', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '携带签名', name: 'Sender', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '短信内容', name: 'MsgContent', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '查询路径', name: 'ConditionPath', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '查询文件名', name: 'FileName', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '保留字段1', name: 'RetentionField1', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '保留字段2', name: 'RetentionField2', width: (w * 0.18), hide: true, sortable: true, align: 'left' },
	        { display: '保留字段3', name: 'RetentionField3', width: (w * 0.18), hide: true, sortable: true, align: 'left' }
	    ],
        customFunction: jsSMSSendTo.ShowSMSPoliciesListPage,
        selectedonclick: true,
        rowhandler: jsSMSSendTo.doubleClickToSMSPolicies,
        rowbinddata: true,
        sortname: 'EMPLOYEE_ID',
        sortorder: 'asc',
        //        usepager: false,
        rp: 5
    };
    jsSMSSendTo.SMSPoliciesGrid = $("#policiesListGrid").ikegrid(tableGridOption);
    tableGridOption = null;
};

/*实现点击方法*/
jsSMSSendTo.doubleClickToSMSPolicies = function(target) {
    $(target).click(function() {
        $("#policiesID").val($(this).attr("ID"));
        $("#txtPoliciesName").val($(this).attr("PoliciesName"));
        $("#txtRemark").val($(this).attr("Remark"));
        $("#txtStartDate").val($(this).attr("StartDate"));
        $("#txtEndDate").val($(this).attr("EndDate"));
        $(this).attr("IsSignatur").toLowerCase() == "true" ? $("#chkSign").attr("checked", "checked") : $("#chkSign").removeAttr("checked");
        $("#txtSign").val($(this).attr("Sender"));
        $("#txtAreaMessage").value(unescape($(this).attr("MsgContent")));
        $(this).attr("IsSendTime").toLowerCase() == "true" ? $("#chkSend").attr("checked", "checked") : $("#chkSend").removeAttr("checked");
        if ($("#chkSend").attr("checked")) {
            $("#spResult").text("每" + $(this).attr("SendTermin") + ($(this).attr("SendOpportunity") == "0" ? "年" : $(this).attr("SendOpportunity") == "1" ? "个月" : $(this).attr("SendOpportunity") == "2" ? "日" : "周") + $(this).attr("SendTime") + "发送一次");
        } else {
            $("#spResult").text("");
        }
        jsSMSSendTo.SMSPoliciesGridSelectRow = target; /*保存选中行*/
        $("tr", target.parentElement.parentElement).each(function() {/*移除Grid行样式*/
            $(this).removeClass("trSelected");
        });
        $(target).addClass("trSelected"); /*选中行增加样式*/
        if ($(this).attr("EndElag").toLowerCase() == "true") {
            $("#btnSaveSMS").attr("disabled", "disabled");
        } else {
            $("#btnSaveSMS").removeAttr("disabled");
        }
        var sendTimeObj = document.getElementById("RowSourceInput");
        sendTimeObj.SendTermin = $(this).attr("SendTermin");
        sendTimeObj.SendOpportunity = $(this).attr("SendOpportunity");
        sendTimeObj.SendTime = $(this).attr("SendTime");
        sendTimeObj.SendTypeSign = $(this).attr("SendTypeSign");
        $("#btnSaveSMS").attr("saveMode", "modify");
        $("#btnAdd").removeAttr("disabled");
        jsSMSSendTo.searchFileName = $(this).attr("FileName");
        //        var searchPath = $("#searchConditionSource").attr("searchPara");
        //        if (searchPath != "" && searchPath != undefined) {
        //            jsSMSSendTo.SMSGridList.DoSearch(unescape(searchPath));
        //        } else {
        jsSMSSendTo.getsearchConditionForJS();
        //        }
    });
}

/*短信策略表读取数据*/
jsSMSSendTo.ShowSMSPoliciesListPage = function(pageSize, pageIndex, searchStr, extpara, order) {
    var countTop = pageSize * (pageIndex - 1);
    var strSql = "";
    if (searchStr != "" && searchStr != undefined) {

    }
    /*分页代码*/
    if (countTop > 0) {
        strSql = "select TOP " + pageSize + " (select count(*) from T_SMSPolicies) as AllCount, * from T_SMSPolicies where ID NOT IN (SELECT TOP " + countTop + " ID from T_SMSPolicies)";
    }
    else {
        strSql = "select TOP " + pageSize + " (select count(*) from T_SMSPolicies) as AllCount, * from T_SMSPolicies";
    }
 //window.clipboardData.setData("text",strSql);
    var strResult = DBReader.selectSqlForJson(strSql);
    var result;
    if (strResult != null) {
        result = eval("[{" + strResult + "}]");
        result[0].pageIndex = pageIndex;
    }
    countTop = null; strSql = null;
    strWhere = null; strOrderBy = null;
    CollectGarbage();
    return strResult == null ? null : result[0];
}

/*实现操作方法*/
jsSMSSendTo.sMSPoliciesGridoperate = function(value, pid, rows) {
    var strContent = '<a  title="删除" onclick="jsSMSSendTo.deletePolicies(' + rows.ID + ')">删除</a>&nbsp;&nbsp;<a title="' + (rows.EndElag.toLowerCase() == "true" ? "停用" : "启用") + '" onclick="jsSMSSendTo.endElagPolicies(\'' + pid + '\',this,\'' + (rows.EndElag.toLowerCase() == "true" ? "false" : "true") + '\')">' + (rows.EndElag.toLowerCase() == "true" ? "停用" : "启用") + '</a>';
    return strContent;
}

/*修改启用*/
jsSMSSendTo.endElagPolicies = function(rowId, obj, endElag) {
    var rowObj = jsSMSSendTo.SMSPoliciesGrid.getRowByID(rowId);
    var rowData = "";
    if (endElag.toLowerCase() == "false") {
        obj.innerHTML = "启用";
        obj.onclick = function() { jsSMSSendTo.endElagPolicies(rowId, obj, "true"); };
        rowData = [{ "EndElag": "false"}];
        rowObj.EndElag = "false";
        $("#btnSaveSMS").removeAttr("disabled");
    } else {
        obj.innerHTML = "停用";
        obj.onclick = function() { jsSMSSendTo.endElagPolicies(rowId, obj, "false"); };
        rowData = [{ "EndElag": "true"}];
        rowObj.EndElag = "true";
        $("#btnSaveSMS").attr("disabled", "disabled");
    }
    jsSMSSendTo.SMSPoliciesGrid.setRowData(rowObj, rowData);
}

/*加载条件人员列表*/
jsSMSSendTo.LoadSMSGridList = function() {
    var w = $(document.documentElement).width() * 0.5;
    var gh = 159;
    var tableGridOption =
    {
        height: gh,
        width: w,
        colModel: [
            { display: '联系人ID', name: 'EMPLOYEE_ID', width: (w * 0.06), hide: true, sortable: true, align: 'left' },
	        { display: '姓名', name: 'NAME', width: (w * 0.1), sortable: true, align: 'left' },
	        { display: '昵称', name: 'NICKNAME', width: (w * 0.1), sortable: true, align: 'left' },
	        { display: '性别', name: 'MANORWOMAN', width: (w * 0.1), sortable: true, align: 'left' },
	        { display: '部门', name: 'DEPARTMENT', width: (w * 0.1), sortable: true, align: 'left' },
	        { display: '职务', name: 'BUSINESS', width: (w * 0.18), sortable: true, align: 'left' },
	        { display: '号码', name: 'MOBILE', width: (w * 0.18), sortable: true, align: 'left' }
	    ],
        customFunction: jsSMSSendTo.ShowSMSListPage,
        rowbinddata: true,
        sortname: 'EMPLOYEE_ID',
        sortorder: 'asc',
        //        usepager:false,
        rp: 5
    };
    jsSMSSendTo.SMSGridList = $("#tdTelNumList").ikegrid(tableGridOption);
    tableGridOption = null;
};

/*绑定数据*/
jsSMSSendTo.ShowSMSListPage = function(pageSize, pageIndex, searchStr, extpara, order) {
    var result;
    var countTop = pageSize * (pageIndex - 1);
    var strSql = "SELECT *  FROM T_EMPLOYEE";
    var strWhere = " where iif(IsNull(MOBILE),S1, MOBILE ) is not NULL ";
    if (searchStr != "" && searchStr != "undefined" && searchStr != undefined) {
        strWhere += " and " + searchStr;
    } else {
        strWhere += " and 1=2 ";
        result = $.parseJSON('[{"result" :"0","returnval" :"暂时没有结果"}]');
    }
    var strOrderBy = "";
    if (order != "" && order != null) {
        var str = order.toUpperCase().replace(/ASC/i, "").replace(/DESC/i, "").replace(/\s/g, "");
        if (str != "T_EMPLOYEE.EMPLOYEE_ID") {
            strOrderBy = order + ",T_EMPLOYEE.EMPLOYEE_ID DESC";
        }
        else {
            strOrderBy = order;
        }
    }
    strSql = strSql + strWhere + " Order By " + strOrderBy;     //window.clipboardData.setData("text",strSql);
    /*分页代码*/
    if (countTop > 0) {
        strSql = "select TOP " + pageSize + " (select count(*) from ( " + strSql + ")) as AllCount, * from (" + strSql + ") where T_EMPLOYEE.EMPLOYEE_ID NOT IN (SELECT TOP " + countTop + " T_EMPLOYEE.EMPLOYEE_ID from (" + strSql + "))";
    }
    else {
        strSql = "select TOP " + pageSize + " (select count(*) from ( " + strSql + ")) as AllCount, * from (" + strSql + ") ";
    }

    var strResult = DBReader.selectSqlForJson(strSql);

    if (strResult != null) {
        result = eval("[{" + strResult + "}]");
        result[0].pageIndex = pageIndex;
    }
    countTop = null; strSql = null;
    strWhere = null; strOrderBy = null;
    CollectGarbage();
    return strResult == null ? null : result[0];
};

/*携带签名*/
jsSMSSendTo.changesSignatur = function(obj) {
    if (obj.checked) {
        document.getElementById("txtSign").disabled = false;
    } else {
        document.getElementById("txtSign").disabled = true;
    }
}
/*设置定时发送*/
jsSMSSendTo.sendTime = function(obj) {
    if (obj.checked) {
        document.getElementById("spResult").style.display = "";
        document.getElementById("RowSourceInput").dataSource = "";
        var rowType = $("#btnSaveSMS").attr("saveMode");
        var formIndex = ShowWindow.getFormIdx();
        ShowWindow.ShowMoledDialog("Application/TeleSecretary/frmSendTime/frmSendTime.htm?formIdx=" + formIndex + "&insertSource=" + (rowType == "added" ? "" : escape('ShowWindow.opener.document(App.query("formIdx")).frames["tab_item_frame_tab-messageSend"].frames["ifrMainContent"].document.getElementById("RowSourceInput")')) + "&action=jsIndexPage.freshItemItemPage('tab-messageSend','jsSMSSendTo.setSendTime(\"@str\")')", "定时发送", 450, 250);
        rowType = null;
        formIndex = null;
    } else {
        document.getElementById("spResult").style.display = "none";
    }
    CollectGarbage();
}

/*返回定时发送数据*/
jsSMSSendTo.setSendTime = function(str) {
    var sendTimeStr = eval("["+unescape(str)+"]");
    var sendTimeObj = document.getElementById("RowSourceInput");
    sendTimeObj.SendTermin = sendTimeStr[0].SendTermin;
    sendTimeObj.SendOpportunity = sendTimeStr[0].SendOpportunity;
    sendTimeObj.SendTime = sendTimeStr[0].SendTime;
    sendTimeObj.SendTypeSign = sendTimeStr[0].SendTypeSign;
    var sendstr = "每" + (sendTimeStr.SendOpportunity) + "月发送一次"
    $("#spResult").text("每" + sendTimeStr[0].SendTermin + (sendTimeStr[0].SendOpportunity == "0" ? "年" : sendTimeStr[0].SendOpportunity == "1" ? "个月" : sendTimeStr[0].SendOpportunity == "2" ? "日" : "周") + sendTimeStr[0].SendTime + "发送一次");
    sendTimeStr = null;
    sendTimeObj = null; 
    CollectGarbage();  
}

/*保存*/
jsSMSSendTo.SavePolicies = function(obj) {
    try {
        var policiesName = document.getElementById("txtPoliciesName");
        if ($.trim(policiesName.value) != "") {
            var EntityObj = jsEntity.CreateEntityByTableName_access("T_SMSPolicies", "", "", "", "ID");
            var policiesID = document.getElementById("policiesID");
            if (jsSMSSendTo.searchFileName == "") {
                jsSMSSendTo.searchFileName = ("js" + new Date().getTime() + parseInt(Math.random() * 10)).replace(/0/g, "a").replace(/1/g, "b").replace(/2/g, "c").replace(/3/g, "d").replace(/4/g, "e").replace(/5/g, "f").replace(/6/g, "g").replace(/7/g, "h").replace(/8/g, "i").replace(/9/g, "j");
            }
            var isSave = false;
            var sendTimeObj = document.getElementById("RowSourceInput");
            var searchObj = document.getElementById("searchConditionSource");
            var remark = document.getElementById("txtRemark");
            var startDate = document.getElementById("txtStartDate");
            var endDate = document.getElementById("txtEndDate");
            var isSendTime = $("#chkSend").attr("checked") ? 1 : 0;
            var isSignatur = $("#chkSign").attr("checked") ? 1 : 0;
            EntityObj.Fields.PoliciesName = policiesName.value;
            EntityObj.Fields.Remark = remark.value;
            EntityObj.Fields.StartDate = startDate.value;
            EntityObj.Fields.EndDate = endDate.value;
            EntityObj.Fields.EndElag = 0;
            EntityObj.Fields.IsSendTime = isSendTime;
            EntityObj.Fields.IsSignatur = isSignatur;
            EntityObj.Fields.SendTime = sendTimeObj.SendTime;
            EntityObj.Fields.SendOpportunity = sendTimeObj.SendOpportunity;
            EntityObj.Fields.SendTermin = sendTimeObj.SendTermin;
            EntityObj.Fields.SendTypeSign = sendTimeObj.SendTypeSign;
            EntityObj.Fields.Sender = $("#txtSign").val();
            EntityObj.Fields.MsgContent = escape($("#txtAreaMessage").value());
            EntityObj.Fields.ConditionPath = "Application/TeleSecretary/js/" + jsSMSSendTo.searchFileName + ".js";
            EntityObj.Fields.FileName = jsSMSSendTo.searchFileName;
            EntityObj.Fields.RetentionField1 = "";
            EntityObj.Fields.RetentionField2 = "";
            EntityObj.Fields.RetentionField3 = "";
//            if (obj.saveMode == "added") {
//                obj.saveMode = "modify";
            if(policiesID.value==""){
                isSave = EntityObj.Insert(EntityObj);
                policiesID.value = EntityObj.Fields.ID;
            } else {
                EntityObj.Fields.ID = policiesID.value;
                isSave = EntityObj.Update(EntityObj);
                jsSMSSendTo.unLoadJsFile();
            }
            if (isSave) {
                if (jsSMSSendTo.searchFileName != "") {
                    var jsSource = unescape($("#searchConditionSource").attr("searchSource"));
                    if (jsSource == "" || jsSource == "undefined") {
                        var jsFile = [];
                        jsFile.push("function " + jsSMSSendTo.searchFileName + "()");
                        jsFile.push("{};");
                        jsFile.push(jsSMSSendTo.searchFileName + ".tableContent =");
                        jsFile.push("'';");
                        jsFile.push(jsSMSSendTo.searchFileName + ".searchContent =");
                        jsFile.push("'';");
                        jsSource = jsFile.join("");
                    }
                    if (App.FileIsExist("Application/TeleSecretary/js/" + jsSMSSendTo.searchFileName + ".js")) {
                        App.FileDelete("Application/TeleSecretary/js/" + jsSMSSendTo.searchFileName + ".js");   /*删除原有的本地文件*/
                    }
                    App.CreateFile("Application/TeleSecretary/js/", jsSMSSendTo.searchFileName + ".js", jsSource); /*创建JS文件*/
                    jsSource = null;
                }
                alert("保存成功！");
            } else {
                alert("保存失败！");
            }
            jsSMSSendTo.SMSPoliciesGrid.DoSearch();
            remark = null;
            startDate = null;
            endDate = null;
            isSendTime = null;
            isSignatur = null;
            policiesID = null;
            isSave = null;
            sendTimeObj = null;
            searchObj = null;
            DBReader.DisposeEntity(EntityObj);
        } else {
            alert("保存失败，策略名称不能为空！");
            policiesName.focus();
        }
        obj = null;
        policiesName = null;
        CollectGarbage();
    } catch (e) {
        alert("ERROR FOR jsSMSSendTo.SavePolicies" + e.message);
    }
}
/*删除*/
jsSMSSendTo.deletePolicies = function(id) {
    try {
        if(window.confirm("确定要删除？")){
            var EntityObj = jsEntity.CreateEntityByTableName_access("T_SMSPolicies", "", "", "", "ID");
            EntityObj.Fields.ID = id;
            EntityObj.Delete(EntityObj);
            jsSMSSendTo.OnclickAddBtn();/*新增状态*/
            jsSMSSendTo.SMSPoliciesGrid.DoSearch();
            if (jsSMSSendTo.searchFileName != "" && App.FileIsExist(escape(App.ApplicationPath()+"Application\\TeleSecretary\\js\\" + jsSMSSendTo.searchFileName + ".js"))) {
                App.FileDelete(App.ApplicationPath()+"Application\\TeleSecretary\\js\\" + jsSMSSendTo.searchFileName + ".js");   /*删除原有的本地文件*/
            }
            saveBtn = null;
            DBReader.DisposeEntity(EntityObj);
        }
    } catch (e) {
        alert("ERROR FOR jsSMSSendTo.deletePolicies" + e.message);
    }
    CollectGarbage();
}

/*条件*/
jsSMSSendTo.searchCondition = function() {
    var formIndex = ShowWindow.getFormIdx();
    if (jsSMSSendTo.searchFileName == "") {
        jsSMSSendTo.searchFileName = ("js" + new Date().getTime() + parseInt(Math.random() * 10)).replace(/0/g, "a").replace(/1/g, "b").replace(/2/g, "c").replace(/3/g, "d").replace(/4/g, "e").replace(/5/g, "f").replace(/6/g, "g").replace(/7/g, "h").replace(/8/g, "i").replace(/9/g, "j");
    }
    ShowWindow.ShowMoledDialog("Application/TeleSecretary/ConditionSetting/frmConditionSetting.htm?formIdx=" + formIndex + "&jsPath=" + jsSMSSendTo.searchFileName + "&insertSource=" + escape('ShowWindow.opener.document(App.query("formIdx")).frames["tab_item_frame_tab-messageSend"].frames["ifrMainContent"].document.getElementById("searchConditionSource")') + "&action=jsIndexPage.freshItemItemPage('tab-messageSend','jsSMSSendTo.getSource(\"@str\",\"@str1\",\"@str2\")')", "条件", 900, 600);
}

/*返回条件*/
jsSMSSendTo.getSource = function(para, searchStr, searchTable) {
    $("#searchConditionSource").attr("searchSource", searchStr); /*记录条件查询的所有信息*/
    $("#searchConditionSource").attr("searchPara", para); /*记录条件信息*/
    $("#searchConditionSource").attr("searchTable", searchTable); /*记录条件信息表*/
    jsSMSSendTo.SMSGridList.DoSearch(unescape(para)); /*根据条件查询*/
}

/*读取js文件里的搜索条件*/
jsSMSSendTo.getsearchConditionForJS = function() {
    try {
        if (jsSMSSendTo.searchFileName != "") {
            var inputJs = document.createElement("script");
            var _head = document.getElementsByTagName("head");
            if (!(document.getElementById(jsSMSSendTo.searchFileName))) {
                if (App.FileIsExist("Application/TeleSecretary/js/" + jsSMSSendTo.searchFileName + ".js")) {
                    inputJs.src = "../js/" + jsSMSSendTo.searchFileName + ".js";
                    inputJs.type = "text/javascript";
                    inputJs.id = jsSMSSendTo.searchFileName;
                    _head[0].appendChild(inputJs);
                }
            }
            $("#searchConditionSource").attr("searchTable", eval(jsSMSSendTo.searchFileName + ".tableContent"));
            jsSMSSendTo.SMSGridList.DoSearch(unescape(eval(jsSMSSendTo.searchFileName + ".searchContent")));
            inputJs = null;
            _head = null;
            CollectGarbage();
        }
    } catch (e) {
        alert("ERROE FOR jsSMSSendTo.getsearchConditionForJS" + e.message)
    }
}

/*撤消读取js文件*/
jsSMSSendTo.unLoadJsFile = function() {
    var _head = document.getElementsByTagName("head");
    var inputJs = document.getElementById(jsSMSSendTo.searchFileName)
    if (inputJs) {
        _head[0].removeChild(inputJs);
    }
    inputJs = null;
    _head = null;
    CollectGarbage();
}