var OfficeEBaseUrl = "/";window.status = "办公易 | Office E";/* 通用函数 */
function Kenfor_Trim(str){return str.replace(/(^\s*)|(\s*$)/g ,"");}
function Kenfor_EnterToTab(){if(event.keyCode == 13){event.keyCode = 9;}}
function Kenfor_Download_File(str){if (top.dialogHeight){if (document.getElementById("IFRAME_Kenfor_Download_File") == null){document.body.insertAdjacentHTML("beforeEnd" , "");}IFRAME_Kenfor_Download_File.location.href = str;}else{window.open(str);}}
function Kenfor_OnlyIntBiggerThanZero(txt){if(Kenfor_Trim(txt.value).length > 0){if (isNaN(parseInt(Kenfor_Trim(txt.value) , 10)) || parseInt(Kenfor_Trim(txt.value) , 10) <= 0){txt.value = '';}}}
function ResizeDialogToContent(frameName){if (frameName.length > 0){var dh = parent.window.dialogHeight;while (isNaN(dh)){dh = dh.substr(0,dh.length-1);}var dw = parent.window.dialogWidth;while (isNaN(dw)){dw = dw.substr(0,dw.length-1);}difh = dh - parent.document.body.clientHeight;difw = dw - parent.document.body.clientWidth;parent.window.document.getElementById(frameName).style.height = (document.body.scrollHeight) + 'px';parent.window.document.getElementById(frameName).style.width = (document.body.scrollWidth) + 'px';parent.window.dialogHeight = (document.body.scrollHeight + 0 + parseInt(difh , 10)) + 'px';parent.window.dialogWidth = (parent.document.body.scrollWidth + parseInt(difw , 10)) + 'px';}else{var dh = window.dialogHeight;while (isNaN(dh)){dh = dh.substr(0,dh.length-1);}var dw = window.dialogWidth;while (isNaN(dw)){dw = dw.substr(0,dw.length-1);}difh = dh - document.body.clientHeight;difw = dw - document.body.clientWidth;window.dialogHeight = (document.body.scrollHeight + 0 + parseInt(difh , 10)) + 'px';window.dialogWidth = (document.body.scrollWidth + parseInt(difw , 10)) + 'px';}}
function ResizeIframeToContentHeight(frameName , minHeight){try{if (minHeight > 0 && document.body.scrollHeight < minHeight){parent.document.getElementById(frameName).style.height = minHeight + "px";}else{parent.document.getElementById(frameName).style.height = document.body.scrollHeight + "px";}parent.document.getElementById(frameName).frameBorder = 0;parent.document.getElementById(frameName).scrolling = "no";}catch(e){}}
function ResizeIframeToContentWidth(frameName , minWidth){try{if (minWidth > 0 && document.body.scrollHeight < minWidth){parent.document.getElementById(frameName).style.width = minWidth + "px";}else{parent.document.getElementById(frameName).style.width = document.body.scrollWidth + "px";}parent.document.getElementById(frameName).frameBorder = 0;parent.document.getElementById(frameName).scrolling = "no";}catch(e){}}
function ResizeIframeToContentMaxHeight(frame , maxHeight){try{if (document.body.scrollHeight > maxHeight){parent.document.getElementById(frame).style.height = maxHeight + "px";}else{parent.document.getElementById(frame).style.height = document.body.scrollHeight + "px";}}catch(e){}}
function ResizeToContent(){try{window.resizeTo(document.body.scrollWidth + 10 , document.body.scrollHeight);window.resizeTo(document.body.scrollWidth * 2 - document.body.clientWidth + 10 , document.body.scrollHeight * 2 - document.body.clientHeight);}catch(e){}}/*Cookie类*/
function Cookie(document , name , hours , path , domain , secure){this.$document = document;this.$name = name;if (hours){this.$expiration = new Date((new Date()).getTime() + hours * 3600000);}else{this.$expiration = null;}if (path){this.$path = path;}else{this.$path = null;}if (domain){this.$domain = domain;}else{this.$domain = null;}if (secure){this.$secure = true;}else{this.$secure = false;}}
Cookie.prototype.store = function () {var cookieval = "";for (var prop in this){if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function')){continue;}if (cookieval != ""){cookieval += '&';}cookieval += prop + ':' + escape(this[prop]);}var cookie = this.$name + '=' + cookieval;if (this.$expiration){cookie += ';expires=' + this.$expiration.toGMTString();}if (this.$path){cookie += ';path=' + this.$path;}if (this.$domain){cookie += ';domain=' + this.$domain;}if (this.$secure){cookie += ';secure';}this.$document.cookie = cookie;}
Cookie.prototype.load = function (){var allcookies = this.$document.cookie;if (allcookies == ""){return false;}var start = allcookies.indexOf(this.$name + '=');if (start == -1){return false;}start += this.$name.length + 1;var end = allcookies.indexOf(';' , start);if (end == -1){end = allcookies.length;}var cookieval = allcookies.substring(start , end);var a = cookieval.split('&');for (var i = 0 ; i < a .length ; i ++){a[i] = a[i].split(':');}for (var i = 0 ; i < a.length ; i ++){this[a[i][0]] = unescape(a[i][1]);}return true;}
Cookie.prototype.remove = function () {var cookie;cookie = this.$name + '=';if (this.$path){cookie += ';path=' + this.$path;}if (this.$domain){cookie += ';domain=' + this.$domain;}cookie += ';expires=Fri, 02-Jan-1970 00:00:00 GMT';this.$document.cookie = cookie;}/*END Cookie类*/
function Kenfor_OnLoad(){Kenfor_ResetAllNewWindowAnchor();KStar_BindFormSubmit();}
function Kenfor_ResetAllNewWindowAnchor(){for (var i = 0 ; i < document.links.length ; i ++){var link = document.links[i];var href = link.href;var hrefLower = Kenfor_Trim(href.toLowerCase());var target = link.target;if (target == "_blank" &&hrefLower.indexOf("javascript:") < 0 &&hrefLower.indexOf("mailto:") < 0 &&hrefLower.indexOf("#") != 0){link.href = "javascript:Kenfor_OpenNewWindowHref(\"" + href + "\");";link.target = "_self";}}}
function Kenfor_OpenNewWindowHref(url){Kenfor_OpenNewWindow(url);}
function Kenfor_OpenNewWindow(url){return window.open(url , '_blank' , 'status=no,resizable=yes,location=no,menubar=yes,scrollbars=yes');}
function Kenfor_CheckRefresh(){if (event.keyCode == 116){top.IsRefresh = true;}}
function Kenfor_ResetRefresh(){if (event.keyCode == 116){top.IsRefresh = false;}}
function Kenfor_AllInputTextEnterToTab(){try{var inputs = document.all.tags("input");var iLength = inputs.length;for (var i = 0 ; i < iLength ; i ++){var e = inputs[i];if (e.type == "text" || e.type =="password"){e.detachEvent("onkeydown" , Kenfor_EnterToTab);e.attachEvent("onkeydown" , Kenfor_EnterToTab);}}}catch (e){}}
function Kenfor_SetAllInputStyle(className){try{var inputs = document.all.tags("input");var iLength = inputs.length;for (var i = 0 ; i < iLength ; i ++){var e = inputs[i];if (e.className == "" &&e.type == "text" ||e.type == "password" ||e.type == "file"){e.className = className;}}inputs = document.all.tags("textarea");iLength = inputs.length;for (var i = 0 ; i < iLength ; i ++){var e = inputs[i];if (e.className == ""){e.className = className;}}inputs = document.all.tags("select");iLength = inputs.length;for (var i = 0 ; i < iLength ; i ++){var e = inputs[i];if (e.className == ""){e.className = className;}}}catch (e){}}
function Kenfor_KStar_Web_SearchTextInListBox(searchStr , listBox){if (listBox.options.length == 0){return false;}searchStr = Kenfor_Trim(searchStr);var selected = listBox.selectedIndex;var i = 0;for (i = selected + 1 ; i < listBox.options.length ; i ++){if (listBox.options[i].text.indexOf(searchStr) != -1){listBox.selectedIndex = i;break;}}if (i == listBox.options.length){for (i = 0 ; i < selected ; i ++){if (listBox.options[i].text.indexOf(searchStr) != -1){listBox.selectedIndex = i;break;}}}}
function CheckToSearchPanel_OnClick(){var chk = event.srcElement;var panel = document.getElementById(event.srcElement.checkPanel);if (chk.checked){panel.style.display = "";}else{panel.style.display = "none";}var checkedData = new Cookie(document , "KStar_CheckBox_Panel_Status" , null , "/");if (chk.checked){if (!checkedData.load() || !checkedData.checked){checkedData.checked = chk.cookieName;}else if (checkedData.checked.indexOf(chk.cookieName) == -1){checkedData.checked += chk.cookieName + "true";}else if (checkedData.checked.indexOf(chk.cookieName + "true") == -1){checkedData.checked = checkedData.checked.replace(chk.cookieName , chk.cookieName + "true");}}else{if (!checkedData.load() || !checkedData.checked){checkedData.checked = chk.cookieName;}else if (checkedData.checked.indexOf(chk.cookieName) == -1){checkedData.checked += chk.cookieName;}else{checkedData.checked = checkedData.checked.replace(chk.cookieName + "true" , chk.cookieName);}}checkedData.store();}
function BindCheckBoxToSearchPanelAction(checkboxId , searchPanelId){var chk = document.getElementById(checkboxId);chk.cookieName = location.pathname + "_" + checkboxId + "|";chk.checkPanel = searchPanelId;if (arguments.length > 2){chk.cookieName = location.pathname + "_" + arguments[2] + "_" + checkboxId + "|";}var checkedData = new Cookie(document , "KStar_CheckBox_Panel_Status" , null , "/");if (!checkedData.load() || !checkedData.checked){checkedData.checked = chk.checked ? chk.cookieName + "true" : chk.cookieName;}else if (checkedData.checked.indexOf(chk.cookieName) == -1){checkedData.checked += chk.checked ? chk.cookieName + "true" : chk.cookieName;}if (checkedData.checked.indexOf(chk.cookieName + "true") == -1){chk.checked = false;}else{chk.checked = true;}checkedData.store();chk.detachEvent("onclick" , CheckToSearchPanel_OnClick);chk.attachEvent("onclick" , CheckToSearchPanel_OnClick);chk.checked = !chk.checked;chk.click();}/* END 通用函数 *//*自定义表单中控件使用函数*/
function Kenfor_KStar_Web_Form_CheckBoxList_Disabled_Reset(itemId){var tbl = document.getElementById(itemId);tbl.disabled = false;for (var i = 0 ; i < tbl.all.length ; i ++){if (tbl.all.item(i).disabled){tbl.all.item(i).disabled = false;}if (tbl.all.item(i).type == "checkbox"){tbl.all.item(i).style.backgroundColor = "transparent";tbl.all.item(i).onclick = function (){event.returnValue = false;return false;};}}}/*END 自定义表单中控件使用函数*//*权限选择控件部份js*/
function Kenfor_KStar_Web_InputPower_SelectAll(baseobject , i){for (var j = 0 ; j < i ; j ++){document.all[baseobject + ':listPower:' + j].checked = document.all[baseobject + ':MenuTypeName'].checked;}}
function Kenfor_KStar_Web_InputPower_CheckUpdate(baseobject , i){var allNotChecked = true;for (var j = 0 ; j < i ; j ++){if (document.all[baseobject + ':listPower:' + j].checked == true){allNotChecked = false;}}if (allNotChecked == true){document.all[baseobject + ':MenuTypeName'].checked = false;}else{document.all[baseobject + ':MenuTypeName'].checked = true;}}
function Kenfor_KStar_Web_InputPower_Enable(baseobject , isEnable , i){if (!isEnable){document.all[baseobject + ':MenuTypeName'].disabled = true;for (var j = 0 ; j < i ; j ++){document.all[baseobject + ':listPower:' + j].disabled = true;}}}
function Kenfor_KStar_Web_InputPower_ResetTdWidth(baseobject){try{var tbl = document.getElementById(baseobject);for (var i = 0 ; i < tbl.cells.length ; i ++){tbl.cells[i].style.width = (100 / tbl.rows[0].cells.length) + '%';}}catch (e){}}/*END 权限选择控件部份js*//*微软树形菜单相关函数*/
function Kenfor_KStar_Web_TreeView_SetChecked(node , ischecked){try{node.setAttribute("checked" , ischecked);var nodes = node.getChildren();for (var i = 0 ; i < nodes.length ; i ++){Kenfor_KStar_Web_TreeView_SetChecked(nodes[i] , ischecked);}}catch (e){}}
function Kenfor_KStar_Web_TreeView_SetAllChecked(tree , ischecked , onlyTop){try{var nodes = tree.getChildren();for (var i = 0 ; i < nodes.length ; i ++){if (onlyTop){Kenfor_KStar_Web_TreeView_SetCheckBox(nodes[i] , !ischecked , false);if (ischecked){nodes[i].setAttribute("checkbox" , true);nodes[i].setAttribute("checked" , true);}}else{Kenfor_KStar_Web_TreeView_SetChecked(nodes[i] , ischecked);}}}catch (e){}}
function Kenfor_KStar_Web_TreeView_SetCheckBox(node , hasCheckBox , ischecked){try{if (hasCheckBox){if (node.getAttribute ("checkbox") == false){node.setAttribute("checkbox" , true);}}else if (!hasCheckBox){if (node.getAttribute ("checkbox") == true){node.setAttribute("checkbox" , false);}}if (hasCheckBox && ischecked){node.setAttribute("checked" , true);}else{node.setAttribute("checked" , false);}var nodes = node.getChildren();for (var i = 0 ; i < nodes.length ; i ++){Kenfor_KStar_Web_TreeView_SetCheckBox(nodes[i] , hasCheckBox , ischecked);}}catch (e){}}
function Kenfor_KStar_Web_TreeView_CheckTopOnly(tree){try{var nodeindex = tree.clickedNodeIndex;node = tree.getTreeNode(nodeindex);var isChecked = node.getAttribute("checked");if (isChecked){var pNode = node.getParent();var checkedPNode = node;while (pNode != null){if (pNode.getAttribute("checked") == true){checkedPNode = pNode;}pNode = pNode.getParent();}Kenfor_KStar_Web_TreeView_SetCheckBox(checkedPNode , false , false);checkedPNode.setAttribute("checkbox" , true);checkedPNode.setAttribute("checked" , true);}else{Kenfor_KStar_Web_TreeView_SetCheckBox(node , true , false);}}catch (e){}}
function Kenfor_KStar_Web_Department_TreeView_SetChecked(node , arr , onlyTop){try{var nodes = node.getChildren();for (var i = 0 ; i < nodes.length ; i ++){var hasChecked = false;for (var j = 0 ; j < arr.length ; j ++){if (nodes[i].getAttribute("ID") == arr[j]){nodes[i].setAttribute("checked" , true);hasChecked = true;break;}}if (onlyTop && hasChecked){Kenfor_KStar_Web_TreeView_SetCheckBox(nodes[i] , false , false);nodes[i].setAttribute("checkbox" , true);nodes[i].setAttribute("checked" , true);continue;}Kenfor_KStar_Web_Department_TreeView_SetChecked(nodes[i] , arr , onlyTop);}}catch (e){}}/*END 微软树形菜单相关函数*//*绑定表单提交代码*/
function KStar_Web_Form_OnSubmit(){for (var i = 0 ; i < document.forms.length ; i ++){document.forms[i].style.display = "none";}KStarWebBaseLoadingDiv.style.display = "";}
function KStar_Web_Form_Submit(theForm){KStar_Web_Form_OnSubmit();theForm._submit();}
function KStar_BindFormSubmit(){for (var i = 0 ; i < document.forms.length ; i ++){document.forms[i]._submit = document.forms[i].submit;document.forms[i].submit = function() {KStar_Web_Form_Submit(this);};if (document.forms[i].onsubmit != null){document.forms[i].__onsubmit = document.forms[i].onsubmit;document.forms[i].onsubmit = function (){var result = event.srcElement.__onsubmit();if (event.returnValue == false){return false;}if (result == false){return false;}KStar_Web_Form_OnSubmit();};}else{document.forms[i].onsubmit = function (){KStar_Web_Form_OnSubmit();};}}window.detachEvent("onunload" , KStar_Web_Form_OnSubmit);window.attachEvent("onunload" , KStar_Web_Form_OnSubmit);}/*END 绑定表单提交代码*/
function KStar_Web_ToolTips_Show(){var tip = "";if(typeof(event)=="undefined"){tip = e.target.getAttribute("tips");}else{e = event;tip = e.srcElement.tips;}if (typeof(tip) != "undefined" && tip.length>0){var _tips = document.getElementById("KStar_myTip");if (typeof(_tips) == "undefined" || _tips == null){_tips = document.createElement("div");_tips.id = "KStar_myTip";_tips.style.position = "absolute";_tips.style.borderWidth = "1px";_tips.style.borderStyle = "solid";_tips.style.borderColor = "black";_tips.style.fontSize = "9pt";_tips.style.backgroundColor = "#ffffff";_tips.style.color = "black";_tips.style.filter = "progid:DXImageTransform.Microsoft.Shadow(color=#999999,direction=135,strength=3)";_tips.style.padding = "5px 8px 3px 8px";document.body.appendChild(_tips);_tips.style.display = "none";_tips.attachEvent("onmouseover" , KStar_Web_ToolTips_Over);_tips.attachEvent('onmouseout' , KStar_Web_ToolTips_Out);}_tips.style.display = "";_tips.innerHTML = tip + "";_tips.style.left = document.body.scrollLeft + e.clientX;_tips.style.top = document.body.scrollTop + e.clientY;}}
function KStar_Web_ToolTips_Over(){var _tips = document.getElementById("KStar_myTip");if(_tips != null){_tips.style.display = "";}}
function KStar_Web_ToolTips_Out(){KStar_Web_ToolTips_Hide();}
function KStar_Web_ToolTips_Hide(){var _tips = document.getElementById("KStar_myTip");if(_tips != null){_tips.style.display = "none";}}
function KStar_Web_ToolTips(item){item.detachEvent("onmouseover" , KStar_Web_ToolTips_Show);item.detachEvent('onmouseout' , KStar_Web_ToolTips_Hide);item.attachEvent("onmouseover" , KStar_Web_ToolTips_Show);item.attachEvent('onmouseout' , KStar_Web_ToolTips_Hide);}
function CheckBoxToHtmlEditor_Change(chk , txt , htmlEditor , panelHTML){if (htmlEditor == null){alert("加载未完成,请稍候再试!");chk.checked = !chk.checked;return false;}if (!chk.checked){htmlEditor.UpdateLinkedField();if (document.getElementById(htmlEditor.Name).value.length == 0 ||confirm("此操作将丢失所有格式定义,你确认要继续吗?")){panelHTML.style.display = "none";txt.style.display = "";txt.value = htmlEditor.EditorDocument.body.innerText;return true;}else{chk.checked = true;return false;}}else{panelHTML.style.display = "";txt.style.display = "none";htmlEditor.EditorDocument.body.innerText = txt.value;return true;}}
function HtmlEditor_Content_GetLength(htmlEditor){htmlEditor.UpdateLinkedField();return document.getElementById(htmlEditor.Name).value.length;}
function KStar_Iframe_ResizeToContent(iframe){iframe.style.height = iframe.contentWindow.document.body.scrollHeight;}
function Kenfor_SendSystemMessage(){window.open(OfficeEBaseUrl + "Message/Send.aspx" , "_blank" , "status=no,help=no,resizable=no,scroll=no,height=300,width=500");}
function Kenfor_KStar_Web_Calendar_OpenAlerts(calendarId , startDate){var sUrl = OfficeEBaseUrl + "Calendar/Alert.aspx?calendarId=" + calendarId + "&startDate=" + startDate;var alertId = "calendarAlert_" + calendarId + "_" + startDate.replace(/-/g , "");var calAlert = window.open(sUrl , alertId , "status=no,help=no,resizable=no,scroll=no,height=200,width=360");calAlert.opener = window;}
function OpenPassword(){window.showModalDialog(OfficeEBaseUrl + "Personal/Password.aspx" , window , "status:no;help:no;resizable:no;scroll:no;dialogHeight:210px;dialogWidth:500px;");}var InstantMessage_OnlineUser_Showed = false;
function InstantMessage_OnlineUser_Show(){var sURL = OfficeEBaseUrl + "InstantMessage/UserListDialog.aspx";if (InstantMessage_OnlineUser_Showed == false){window.showModelessDialog(sURL , window , "status:no;help:no;resizable:no;scroll:no;dialogHeight:450px;dialogWidth:250px;dialogTop:" + (window.screen.availHeight - 500)/2 + "px;dialogLeft:" + (window.screen.availWidth - 250) + "px");}}/*打开聊天窗口的函数*/var InstantMessage_OpenedWindows_Cookie = new Cookie(document , "InstantMessage_Chat" , null , OfficeEBaseUrl);
function InstantMessage_OpenChat(id){var sURL = OfficeEBaseUrl + "InstantMessage/Message.aspx?id="+id;var cookieValue = "|" + id + "|";var cookieKey = "InstantMessage_Chat_" + id;if (!InstantMessage_OpenedWindows_Cookie.load() ||!InstantMessage_OpenedWindows_Cookie.openUsers ||InstantMessage_OpenedWindows_Cookie.openUsers.indexOf(cookieValue) == -1){var chatWindow = window.open(sURL , cookieKey , "status=no,help=no,resizable=no,scroll=no,height=420,width=360");if (chatWindow != null){chatWindow.opener = window;}else{var errorMsg = "不能正常打开即时信息发送窗口,可能原因如下:\r\n";errorMsg += "1.启用了弹出窗口拦截程序(如上网助手或其他一些带有此功能的浏览器),请关闭相关选项。\r\n";errorMsg += "2.网页运行权限不足,请到Internet选项中把此网站添加到受信任站点列表中。";alert(errorMsg);}}else{var chatWindow = window.open(sURL + "#1" , cookieKey , "status=no,help=no,resizable=no,scroll=no,height=420,width=360");chatWindow.focus();}}