/**********************************************************Copyright (c) 2004-2008 成都依能科技有限公司软件开发部www.yineng.com.cn    FileName: common.js   Revision: 1.0  CreatDate: 2007-01-06  EmendDate: 2007-01-06     Author: LuoMaoLin    Description: Common Class***********************************************************/var targetBrowser = navigator.appVersion.substring(navigator.appVersion.indexOf("IE") + 2, navigator.appVersion.indexOf("IE") + 6);var defaultSelectValue = "点击选择...";var teachClassName = "YNedut依能网络教学平台";var otherBroswerError = "对不起，由于使用了与DHTML相关的一些功能，此功能只能在IE上使用！";var isBindFormEvents = true;function isEven(iNumber){    var returnValue = false;if(iNumber % 2 == 0){returnValue = true;}return returnValue;}function gotoURL(URL){self.location.href = URL;}function setUrlToFrame(){var isExist = top.location.href.indexOf("?url");var mainFrame = top.document.getElementById("mainFrame");if (isExist > 0){mainFrame.src = self.location.href.substr(isExist + 5);}}function getIFrame(sFrameID){    var frameObj,NNFrameObj;if (getBrowserType() == "NN"){    NNFrameObj = getElement(document,sFrameID);frameObj = NNFrameObj.contentWindow;}else{frameObj = document.frames(sFrameID);}return frameObj;}function getInIFrameObject(sFrameID,sElementID){    var returnObject;var iframeObj = getIFrame(sFrameID);if(iframeObj){returnObject = iframeObj.document.getElementById(sElementID);}return returnObject;}function openNormalWin(URL, winName){var newWin = window.open(URL, winName);newWin.focus();}function openWin(URL, winName, features){var left, top, newWin;left = document.body.offsetWidth / 2 / 2;top = document.body.offsetHeight / 2 / 2;if(trimSpacer(features) == ""){    opwnScreenWin(URL, winName);}else{if (getBrowserType() == "IE"){newWin = window.open(URL, winName, features + ",top=" + top + ",left=" + left + ",fullscreen=no,location=no,scrollbars=yes,resizable=yes");}else{newWin = window.open(URL, winName, features + ",top=" + top + ",left=" + left + ",fullscreen=no,location=no,scrollbars=yes,resizable=yes");}newWin.focus();}}function opwnScreenWin(sURL,sWinName){    var screenWidth = screen.width;var screenHeight = screen.height;var sWindowName = sWinName || "screenWin";var newWin = window.open(sURL,sWindowName,"resizable=yes,top=0,left=0,scrollbars=yes");newWin.focus();newWin.resizeTo(screenWidth,screenHeight);newWin.moveTo(0,0);}function detectParameter(funcName,iArgsCount){    var args = funcName.arguments;if(args.length < iArgsCount){alert("错误：未传递必须的参数！");return;}}function closeWin(){if (typeof (window.opener) == "undefined"){if(getBrowserType() == "IE" && targetBrowser > 6){top.window.opener = top;top.window.open('','_self','');top.window.close();}else{window.opener = null;window.close();}}else{if(getBrowserType() == "NN"){top.window.opener = top;top.window.open('','_parent','');top.window.close();}else{self.close();}}}function resetParrentDocumentPath(){var theURL = window.parent.document.URL;window.parent.location.href = theURL;}function resetTopWinDocumentPath(sURL){window.top.location.href = sURL;}function reFreshParrentWin(){    var theURL = window.opener.document.URL;window.opener.location.href = theURL;}function resetParrentWindow(sPath){window.opener.location.href = sPath;}function confirmWin(sMessage){var conWin = window.confirm(sMessage);return conWin;}function getBrowserType(){var uAgent = navigator.userAgent;if (uAgent.indexOf("Opera") >= 0){return "Opera";}if (navigator.appName == "Microsoft Internet Explorer"){return "IE";}else{return "NN";}}function isObject(theObj){    var returnValue = false;if(typeof(theObj) == "function" || typeof(theObj) == "object"){returnValue = true;}return returnValue;}function getInnerText(sEleID){    var e = getElement(document,sEleID);var re = /<[^>]*>/g;var retrunValue = "";if(e){retrunValue = e.innerHTML.replace(re,"");}return retrunValue;}function trimSpacer(sStr){return sStr.replace(/(^\s*)|(\s*$)/g, "");}function scrollTo(elementID){var elementID = getElement(document,elementID);var x = element.x ? element.x : element.offsetLeft,y = element.y ? element.y : element.offsetTop;window.scrollTo(x, y);}function getStyle(elementID,styleName){    var returnValue;var element = document.getElementById(elementID);    var value;if (document.defaultView && document.defaultView.getComputedStyle){var css = document.defaultView.getComputedStyle(element, null);value = css ? css.getPropertyValue(styleName) : null;}else if (element.currentStyle){value = element.currentStyle[styleName];}returnValue = value == "auto" ? null : value;    return returnValue;}function padLeft(sStr,iTotalCount,sFillCharacter){    var iLength = sStr.length;var returnValue = "";var iTCount;for(var i = iLength; i < iTotalCount; i++){    returnValue += sFillCharacter + sStr;}if(returnValue == ""){returnValue = sStr;}return returnValue;}String.prototype.trimEnd = function(){var returnValue;var iLength = this.length;var tStr = this.substr(0,(iLength-1));returnValue = tStr;return returnValue;};String.prototype.trimEndCharacter = function(sValue){var returnValue = this;var iLehgth = this.length-1;var sEndCharacter = this.slice(iLehgth, this.length);if(sValue == sEndCharacter){returnValue = this.substring(0,iLehgth);}return returnValue;};String.prototype.trimStartCharacter = function(sValue){var returnValue = this;if(returnValue != ""){var sStartCharacter = this.slice(0, 1);if(sValue == sStartCharacter){returnValue = this.substring(1,this.length);}}return returnValue;};String.prototype.trimFirst = function(){var returnValue;var iLength = this.length;var tStr = this.substr(1,(iLength));returnValue = tStr;return returnValue;};String.prototype.characterToUnicode = function(){var len = this.length;var returnValue = "";for(var i = 0; i < len; i++){returnValue += this.charCodeAt(i) + ",";}return returnValue.trimEnd();};String.prototype.unicodeToCharacter = function(){var arrStr = this.split(",");var len = arrStr.length;var returnValue = "";for(var i = 0; i < len; i++){returnValue += String.fromCharCode(arrStr[i]);}return returnValue;};Array.prototype.remove=function(iIndex){if(isNaN(iIndex)||iIndex>this.length){return false;}for(var i=0,n=0;i<this.length;i++){if(this[i]!=this[iIndex]){this[n++]=this[i];}}this.length -= 1;};var iTimeoutHandle = window.setTimeout;window.setTimeout = function(fRef, mDelay) { if(typeof fRef == "function"){  var argu = Array.prototype.slice.call(arguments,2);  var f = (function(){ fRef.apply(null, argu); });return iTimeoutHandle(f, mDelay);  } return iTimeoutHandle(fRef,mDelay);};var iIntervalHandle = window.setInterval;window.setInterval = function(fRef, mDelay) { if(typeof fRef == "function"){  var argu = Array.prototype.slice.call(arguments,2);  var f = (function(){ fRef.apply(null, argu); });return iIntervalHandle(f, mDelay);  } return iIntervalHandle(fRef,mDelay);};Function.prototype.bind = function(obj){var method = this;var temp = function() {return method.apply(obj, arguments);};return temp;};window.onerror = PageErrorProcess;function PageErrorProcess(msg,url,line) {var str = "当前页的脚本发生错误：\n\n";var newStr;str += "页面地址：" + url +" \n错误消息：" + msg + " \n所在行：" + line;alert(str);return true;}Date.prototype.dateAdd = function(interval,number){var date = this;    switch(interval)    {        case "y" :             date.setFullYear(date.getFullYear()+number);            return date;        case "q" :             date.setMonth(date.getMonth()+number*3);            return date;        case "m" :             date.setMonth(date.getMonth()+number);            return date;        case "w" :             date.setDate(date.getDate()+number*7);            return date;                case "d" :             date.setDate(date.getDate()+number);            return date;        case "h" :             date.setHours(date.getHours()+number);            return date;case "m" :             date.setMinutes(date.getMinutes()+number);            return date;case "s" :             date.setSeconds(date.getSeconds()+number);            return date;        default :             date.setDate(date.getDate()+number);            return date;    }};function SpecialQueryString(strURL){var name, value, i;var str = strURL;var num = str.indexOf("?");str = str.substr(num + 1);var arrtmp = str.split("&");for (i = 0; i < arrtmp.length; i++){num = arrtmp[i].indexOf("=");if (num > 0){name = arrtmp[i].substring(0, num);value = arrtmp[i].substr(num + 1);this[name] = value;}}}function QueryString(){var name, value, i;var str = location.href;var num = str.indexOf("?");str = str.substr(num + 1);var arrtmp = str.split("&");for (i = 0; i < arrtmp.length; i++){num = arrtmp[i].indexOf("=");if (num > 0){name = arrtmp[i].substring(0, num);value = arrtmp[i].substr(num + 1);this[name] = value;}}}function getURLQuery(queryName){var RequestObj=new QueryString();var returnValue = RequestObj[queryName];return returnValue;}function addQueryString(sURL,sQueryName,sQueryValue){    var returnValue = "";if(searchString(sURL,"?")){returnValue = sURL + "&" + sQueryName + "=" + sQueryValue;}else{returnValue = sURL + "?" + sQueryName + "=" + sQueryValue;}return returnValue;}function removeQueryString(sParName){var RequestObj = new QueryString();var returnValue = "";for(var i in RequestObj){    if(i.toString() != sParName){returnValue += "&" + i.toString() + "=" + RequestObj[i];}}return returnValue.trimFirst();}function GetoffsetLeft(theObject){var eleAbsLeft = 0;var elePosition = "";var eleObject = theObject;while (eleObject != null){thePosition = eleObject.position;eleObject.position = "static";eleAbsLeft += eleObject.offsetLeft;eleObject.position = elePosition;eleObject = eleObject.offsetParent;}return eleAbsLeft;}function GetoffsetTop(theObject){var eleAbsTop = 0;var elePosition = "";var eleObject = theObject;while (eleObject != null){elePosition = eleObject.position;eleObject.position = "static";eleAbsTop += eleObject.offsetTop;eleObject.position = elePosition;eleObject = eleObject.offsetParent;}return eleAbsTop;}function getElement(parentobj, id){var obj;if (!parentobj){return null;}if (parentobj.getElementById){obj = parentobj.getElementById(id);}else if (parentobj.all){obj = parentobj.all[id];}else if (parentobj.layers){obj = parentobj.layers[id];}return obj;}document.getElementsByClassName = function(className){  var returnValue = new Array();  var theClassName,isMatch,chLength,reg;  var children = document.body.getElementsByTagName("*");  chLength = children.length;  for(var i = 0; i < chLength; i++)  {  theClassName = children[i].className;  if(theClassName != null)  {reg = new RegExp("(^|\\s)" + className + "(\\s|$)");isMatch = theClassName.match(reg);if(isMatch){returnValue.push(children[i]);}  }  }  return returnValue;};document.getElementsByIDs = function(sID){  var returnValue = new Array();  var children = document.getElementsByTagName("*");  var iLength = children.length;  var sChildrenID;  for(var i = 0; i < iLength; i++)  {      sChildrenID = children[i].id;  if(searchString(sChildrenID,sID))  {returnValue.push(sChildrenID);  }  }  return returnValue;};function downloadFile(sFilePath){var curFilePath = document.URL;if(searchString(curFilePath,"program_file")){document.write("<iframe id=\"down_file\" frameborder=\"0\" src=\"downloadFile.htm?filePath="+ sFilePath +"\" width=\"100%\" height=\"52\" scrolling=\"no\" class=\"hiddenObject\"></iframe>");}else{document.write("<iframe id=\"down_file\" frameborder=\"0\" src=\"program_file/downloadFile.htm?filePath="+ sFilePath +"\" width=\"100%\" height=\"52\" scrolling=\"no\" class=\"hiddenObject\"></iframe>");}}function checkAllGroupItem(chkObj, sGroupKey){var chkCollection = getObjectListArray(sGroupKey,"checkbox");var chkSubObj;for(var i = 0; i < chkCollection.length; i++){    chkSubObj = getElement(document,chkCollection[i]);if(chkSubObj != null && chkSubObj.disabled == false){chkSubObj.checked = chkObj.checked;}}}function clearListBoxAllSelected(LstBoxID){var LstBoxObj = getElement(document, LstBoxID);if (LstBoxObj){for (var i = 0; i < LstBoxObj.options.length; i++){if (LstBoxObj.options[i].selected){LstBoxObj.options[i].selected = false;}}}else{alert("指定的下拉列表框对象不存在！");}}function listBoxToHidden(listBoxID,hiddenID){var listBoxObj = getElement(document, listBoxID);var hiddenObj = getElement(document, hiddenID);var returnValue = "";for (var i = 0; i < listBoxObj.options.length; i++){if (typeof(listBoxObj) != "undefined" && typeof(hiddenObj) != "undefined"){returnValue += listBoxObj.options[i].value + ",";}}hiddenObj.value = returnValue.trimEnd();}function listBoxChooseValueToHidden(listBoxID,hiddenID){var listBoxObj = getElement(document, listBoxID);var hiddenObj = getElement(document, hiddenID);var returnValue = "",lstLength;if(listBoxObj){lstLength = listBoxObj.options.length;for (var i = 0; i < lstLength; i++){if (listBoxObj.options[i].selected == true){returnValue += listBoxObj.options[i].value + ",";}}}hiddenObj.value = returnValue.trimEnd();}function removeListBoxAll(listObjID){var listObj = getElement(document, listObjID);var HidMemberList = getElement(document, "HidMemberList");var hidDelMemberList = getElement(document, "HidDelMemberList");if (listObj){if (listObj.options.length > 0){for (var i = listObj.options.length -1; i >= 0; i--){hidDelMemberList.value += listObj.options[i].value + ",";listObj.options[i] = null;}HidMemberList = "";}else{alert("列表中没有待删除的项！");}}else{alert("下拉列表框对象不存在！");}}function itemIsAdded(itemText,lstBoxID){var targetLstBox = getElement(document, lstBoxID);var returnValue = false;if(targetLstBox){for (var i = 0; i < targetLstBox.options.length; i++){if (targetLstBox.options[i].value == itemText){returnValue = true;}}}else{alert("指定的下拉列表框对象不存在！");}return returnValue;}function addItemToListBox(sLstBoxObjID,sText,sValue){var lstBoxObj = getElement(document, sLstBoxObjID);if(lstBoxObj){var node = document.createElement("option");node.text = sText;node.value = sValue;if(!itemIsAdded(node.value,sLstBoxObjID)){if (getBrowserType() == "IE"){lstBoxObj.add(node);}else{lstBoxObj.options[lstBoxObj.options.length] = node;}}}}function removeItemFromListBox(sLstBoxObjID,iOPtionsIndex){var lstBoxObj = getElement(document, sLstBoxObjID);var oOption;if(lstBoxObj){lstBoxObj.options[iOPtionsIndex] = null;}}function removeSelectedListBoxItem(sListBoxID){var listObj = getElement(document, sListBoxID);var sourceStr, oldStr;if (listObj){if (listObj.selectedIndex != -1){for (var i = listObj.options.length -1; i >= 0; i--){if (listObj.options[i].selected){removeItemFromListBox(sListBoxID,i);}}}else{alert("请先选择待删除的项，再点击该按钮！");}}else{alert("下拉列表框对象不存在！");}}function removeAllItemFromListBox(sLstBoxObjID,bSelected){var lstBoxObj = getElement(document, sLstBoxObjID);    var isSelected = bSelected || false;if(lstBoxObj){for (var i = lstBoxObj.options.length -1; i >= 0; i--){if(lstBoxObj.options[i].selected == isSelected){removeItemFromListBox(sLstBoxObjID,i);}}}}function listBoxIsSelected(lstBoxObjID, errMsg){var lstBoxObj = getElement(document, lstBoxObjID);if (lstBoxObj){if (lstBoxObj.selectedIndex == -1 && lstBoxObj.options.length > 0){if (errMsg != null){}else{}return false;}return true;}else{alert("指定的下拉列表框对象不存在！");return;}}function listSingleBoxIsSelected(lstBoxObjID, errMsg){var lstBoxObj = getElement(document, lstBoxObjID);var optoinsValue;if (lstBoxObj){optoinsValue = lstBoxObj.options[lstBoxObj.selectedIndex].value;if (lstBoxObj.options.length > 0 && optoinsValue == ""){if (errMsg != null){}else{}return false;}return true;}else{alert("指定的下拉列表框对象不存在！");return;}}function listBoxSelectedCount(lstBoxObjID){var lstBoxObj = getElement(document, lstBoxObjID);var selectedCount = 0;if (lstBoxObj){for (var i = 0; i < lstBoxObj.options.length; i++){if (lstBoxObj.options[i].selected){selectedCount++;}}}else{alert("指定的下拉列表框对象不存在！");return;}return selectedCount;}function resetFormStatus(){var elAttribute, defauSelectAttribute;for (var i = 0; i < document.forms.length; i++){for (var j = 0; j < document.forms[i].elements.length; j++){var el = document.forms[i].elements[j];var elType = el.type.toUpperCase();if (elType == "TEXT" || elType == "PASSWORD" || elType == "TEXTAREA"){elType = "TEXT";}else if (elType == "CHECKBOX"){elType = "CHECKBOX";}else if (elType == "RADIO"){elType = "RADIO";}else if (elType == "SELECT-ONE"){elType = "SELECT";}switch (elType){case "TEXT" :elAttribute = el.getAttribute("format");defauSelectAttribute = el.getAttribute("defaultSelectValue");if (elAttribute != null || defauSelectAttribute != null){el.value = defaultSelectValue;}else{el.value = "";}break;case "CHECKBOX" :el.checked = false;break;case "RADIO" :var rdo = eval("document.forms[0]." + el.name);rdo[0].checked = true;break;case "SELECT" :var slt = eval("document.forms[0]." + el.id);slt.options[0].selected = true;break;}}}}function findAndReplace(rawStr, compareStr, replaceStr){var firstIndex = rawStr.indexOf(compareStr);if (firstIndex < 0){return rawStr;}while (firstIndex >= 0){rawStr = rawStr.substr(0, firstIndex) + replaceStr + rawStr.substr(firstIndex + compareStr.length);firstIndex = rawStr.indexOf(compareStr);}return rawStr;}function removeHTMLTag(str){    var returnValue = str.replace(/<\/?[^>]+>/gi, "");return returnValue;}function getRandom(iNum){    var returnValue;if(iNum){returnValue = iNum * Math.random();}else{returnValue = 1000000 * Math.random();}return returnValue;}function convertNumber(str){var re = /(\d+)/;var returnValue = re.exec(str);return RegExp.$1.toString();}function dynamicAddButton(tableObjID, buttonID){var tableRows = 0;var divElement;var newColSpan;var tableObj = getElement(document, tableObjID);var buttonObj = getElement(document, buttonID);if (tableObj != null && buttonObj != null){tableRows = tableObj.rows.length - 1;newColSpan = tableObj.rows[0].cells.length;tableObj.rows[tableRows].cells[0].colSpan = parseInt(newColSpan) - 1;tableObj.rows[tableRows].insertCell(-1);tableObj.rows[tableRows].cells[1].align = "center";tableObj.rows[tableRows].cells[1].appendChild(buttonObj);}}function sumitForm(sBtnName){    var submitButton = getElement(document,sBtnName);if(submitButton){submitButton.click();}}function creatImage(sPath){    var imgObj = new Image();var imgSrc = sPath;imgObj.src = imgSrc;imgObj.align = "absmiddle";return imgObj;}function insertObject(sourceElement,newElement,sLocation){    if(typeof(sourceElement) != "undefined" && typeof(newElement) != "undefined"){try{if(sLocation == "before"){sourceElement.parentNode.insertBefore(newElement,sourceElement);}else {sourceElement.parentNode.appendChild(newElement);}}catch(e){}}}function removeObject(oObject){    if(oObject.parentNode){oObject.parentNode.removeChild(oObject);}}function hiddenMenu(){return false;}function hiddenDrag(){return false;}function hiddenSelect(){return false;}function hiddenSelection(){document.selection.empty();}function hiddenCopy(){document.selection.empty();}function hiddenBeforeCopy(){return false;}function hiddenMouseUp(){return false;}function hiddenHandle(){document.oncontextmenu = hiddenMenu;document.ondragstart = hiddenDrag;document.onselectstart = hiddenSelect;document.onselect = hiddenSelection;document.oncopy = hiddenCopy;document.onbeforecopy = hiddenBeforeCopy;document.onmouseup = hiddenMouseUp;}function getAppRoot(){var returnValue = "", tmpReturnValue =  "";var hos = window.top.location.host;var pro = window.top.location.protocol;var pos = window.top.location.port == "" ? "" : ":" + window.top.location.port;var doMain = pro + "/" + "/" + hos + pos;var sPathName = window.top.location.pathname;var arrPathName = sPathName.split("/");var theIndex = (sPathName.indexOf(arrPathName[2]));var beforStr = sPathName.substring(0,theIndex);tmpReturnValue = doMain + beforStr;if(getCookie("currentApptionDir") != null){returnValue = getCookie("currentApptionDir");}else{    returnValue = tmpReturnValue;}return returnValue;}function stringRealLength(strValue){var len = strValue.length;var num = len;for (var i = 0; i < len; i++){if (strValue.charCodeAt(i) < 0 || strValue.charCodeAt(i) > 255){num++;}}return num;}function addLoadEvent(functionName){var oldonload = window.onload;if (typeof (window.onload) != "function"){window.onload = functionName;}else{window.onload = function(){oldonload();functionName();};}}function EventManager(){    this.listeners = [];}EventManager.prototype = new Object();EventManager.prototype.bindEvent = function(dispatcher,eventType,handler,handlerScope,args,isRemoveSameEvent){var removeSameEvent = isRemoveSameEvent || false;if(removeSameEvent){this.unbindEvent(dispatcher,eventType,handler);}var listenerObject = new Object();listenerObject.eventSource = dispatcher;listenerObject.eventType = eventType;listenerObject.handler = handler;listenerObject.handlerScope = handlerScope;listenerObject.args = args;listenerObject.toString = function(){return "ListenerObject";};listenerObject.exec = function(){if(listenerObject.args){listenerObject.handler.apply(listenerObject.handlerScope, listenerObject.args);}else{listenerObject.handler.call(listenerObject.handlerScope);}};this.listeners.push(listenerObject);this.bind(dispatcher, eventType, listenerObject.exec);};EventManager.prototype.unbindEvent = function(dispatcher,eventType,handler){var len = this.listeners.length;for(var i = 0; i < len; i++){var listenerObject = this.listeners[i];if(listenerObject.eventSource == dispatcher && listenerObject.eventType == eventType && listenerObject.handler == handler){this.unbind(dispatcher,eventType, listenerObject.exec);this.listeners.splice(i,1);i --;len --;}}};EventManager.prototype.unbindAllEvent = function(dispatcher,eventType){var len = this.listeners.length;for(var i = 0; i < len; i++){var listenerObject = this.listeners[i];if(null == eventType && listenerObject.eventSource == dispatcher){this.unbind(dispatcher,eventType, listenerObject.exec);this.listeners.splice(i,1);i --;len --;}else if ((null != eventType) && eventType == listenerObject.eventType){this.unbind(dispatcher,eventType, listenerObject.exec);this.listeners.splice(i,1);i --;len --;}}};EventManager.prototype.unbind = function(dispatcher, eventType, handler){if (document.all){dispatcher.detachEvent("on" + eventType, handler);}else {dispatcher.removeEventListener(eventType, handler, false);}};EventManager.prototype.bind = function(dispatcher, eventType, handler){if (document.all){dispatcher.attachEvent("on" + eventType, handler);}else {dispatcher.addEventListener(eventType, handler, false);}};function attachEvents(eventName,funcName){if(window.addEventListener){window.addEventListener(eventName, funcName, false)}else if(window.attachEvent){window.attachEvent("on" + eventName, funcName)}}function addWindowEvents(eventName, funcName){var oldEvent = eval("window." + eventName);if (typeof (oldEvent) != "function"){attachEvents(eventName,funcName);}else{var newEventO = eval("window.on" + eventName);newEventO = function(){oldEvent();functionName();};}}function checkIsLoadedScript(sFileName){var returnValue = false;var arrScripts = document.getElementsByTagName("SCRIPT");var sCurrentFileName;for(var i = 0; i < arrScripts.length; i++){    sCurrentFileName = trimSpacer(getFileName(arrScripts[i].src));if(sCurrentFileName != "" && sCurrentFileName.toLowerCase() == sFileName.toLowerCase()){    returnValue = true;break;}}return returnValue;}function searchString(sourceStr, findStr){var isFind = sourceStr.indexOf(findStr);if (isFind >= 0){return true;}return false;}function setControlValue(controlID,sValue){    var controlObj = getElement(document,controlID);if(controlObj){controlObj.value = sValue;}}function GetExtensionName(sFileName){var regEx = /^.*\\[^\\]*(\.[^\.\?]*).*$/;return sFileName.replace(regEx, "$1");}function getFileName(url){var regEx = /^.*\/([^\/\?]*).*$/;return url.replace(regEx,"$1");}function getLocalFileName(url){var fileName;fileName=url.replace(/(.*\\){0,}([^\.]+).*/ig,"$2");return fileName;}function showOrHidenObj(){var i, args = showOrHidenObj.arguments;if (args.length > 0){for (i = 0; i < (args.length - 1); i++){if (typeof (getElement(document, args[i])) == args[args.length - 1]){if (getElement(document, args[i]).style.display == "none"){getElement(document, args[i]).style.display = "";}}else if (args[args.length - 1] == "hidden"){getElement(document,args[i]).removeAttribute("class");getElement(document, args[i]).style.display = "none";}}}}function limitImage(sValue, limitWidth, limitHeight, limitFileSize, limitType){var curImgWidth, curImgHeight, curImgFileSize, imgObj, returnValue;var imgWidth = limitWidth;var imgHeight = limitHeight;var imgFileSize = limitFileSize;imgObj = getElement(document, "ImgTmpImage");if (sValue != "" && imgObj != null){imgObj.src = sValue;curImgWidth = imgObj.width;curImgHeight = imgObj.height;curImgFileSize = imgObj.fileSize;returnValue = limitImageType(sValue, limitType);if (curImgWidth > imgWidth || curImgHeight > imgHeight || curImgFileSize > imgFileSize || returnValue == false){alert("错误：上传图片的高宽或文件大小超过限制，上传图片失败！");return false;}else{return true;}}else{alert("错误：文件名不能为空！");return false;}}function getParrentFolderName(sPath){var returnValue = "";var newStr = new Array(1);if(sPath != "" && sPath.indexOf("/") >= 0){newStr = sPath.split("/");returnValue = newStr[newStr.length-2];}else if(sPath != "" && sPath.indexOf("\\") >= 0){newStr = sPath.Split("\\");returnValue = newStr[newStr.length-2];}return returnValue;}function insertTableRows(oTable,iRowIndex){var elRow;if (oTable){elRow = oTable.insertRow(iRowIndex);for (var i = 0; i < oTable.rows[0].cells.length; i++){var elCell = elRow.insertCell(-1);elCell.innerHTML = "&nbsp;";}}return elRow;}function setCookie(name, value){var argv = setCookie.arguments;var argc = setCookie.arguments.length;var expires = (argc > 2) ? argv[2] : null;var path = (argc > 3) ? argv[3] : null;var domain = (argc > 4) ? argv[4] : null;var secure = (argc > 5) ? argv[5] : false;document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");}function getCookieVal(offset){var endstr = document.cookie.indexOf (";", offset);if(endstr == -1){endstr = document.cookie.length;}return unescape(document.cookie.substring(offset, endstr));}function getCookie(name) {var arg = name + "=";var alen = arg.length;var clen = document.cookie.length;var i = 0;while(i < clen){var j = i + alen;if (document.cookie.substring(i, j) == arg)return getCookieVal(j);i = document.cookie.indexOf(" ", i) + 1;if(i == 0) break; }return null;}function importJudgment(sImportType,sRequireFilllField){var sltCount=0;var selectRequireFiledCount=0;var currentSelectItem,currentSelectItemText;var sltArrayNams=new Array();var requireFiled=sRequireFilllField;var requireCount=0;var formName="document."+document.forms[0].id+".";var sSelectedTextStr="";for(var i=0;i<document.forms.length;i++){for(var j=0;j<document.forms[i].elements.length;j++){var el=document.forms[i].elements[j];if(el.type=="select-one"){var elID=el.id;if(elID.indexOf("DdlGroup")!=-1){sltCount++;sltArrayNams.push(el.id);}}}}if(!sltArrayNams.length){}else {for(var i=0;i<sltCount;i++){try{currentSelectItem=eval(formName+sltArrayNams[i]);currentSelectItemText=currentSelectItem.options[currentSelectItem.selectedIndex].text;if(searchString(requireFiled,currentSelectItemText)){sSelectedTextStr+=currentSelectItemText+",";selectRequireFiledCount++;}}catch(e){}}}requireCount=requireFiled.split(",").length;if(selectRequireFiledCount>=requireCount){return true;}else {alert("错误：未选择必选的匹配字段！");return false;}}function instanceTypeof(objClass) {     if ( objClass != undefined && objClass.constructor )     {         var strFun = objClass.constructor.toString();         var className = strFun.substr(0, strFun.indexOf("("));         className = className.replace("function", "");         return className.replace(/(^\s*)|(\s*$)/ig, "");     }     return typeof(objClass); }function setButtonDisabled(sButtonID,bStatus){    var buttonObj = getElement(document,sButtonID);if(buttonObj){buttonObj.disabled = bStatus;}}function preloadImages(){var doc = document; if(doc.images){ if(!doc.arrImages){doc.arrImages = new Array();}var i, j = doc.arrImages.length, a = preloadImages.arguments; for(var i=0; i<a.length; i++)if (a[i].indexOf("#") != 0){ doc.arrImages[j] = new Image; doc.arrImages[j++].src = a[i];}}}function getDropDownListArray(groupKey){var sltCount = 0;var selectRequireFiledCount = 0;var currentSelectItem, currentSelectItemText, currentSelectItemValue;var sltArrayNams = new Array();var requireCount = 0;var formName = "document." + document.forms[0].id + ".";for (var i = 0; i < document.forms.length; i++){for (var j = 0; j < document.forms[i].elements.length; j++){var el = document.forms[i].elements[j];if (el.type == "select-one"){var elID = el.id;if(elID.indexOf(groupKey) != -1){sltCount++;sltArrayNams.push(el.id);}}}}return sltArrayNams;}function getPageObjects(tagName){var returnArray = document.getElementsByTagName(tagName);return returnArray;}function getObjectListArray(groupKey,objType){var sltCount = 0;var selectRequireFiledCount = 0;var currentSelectItem, currentSelectItemText, currentSelectItemValue;var sltArrayNams = new Array();var requireCount = 0;var formName = "document." + document.forms[0].id + ".";for (var i = 0; i < document.forms.length; i++){for (var j = 0; j < document.forms[i].elements.length; j++){var el = document.forms[i].elements[j];if (el.type == objType){var elID = el.id;if(elID.indexOf(groupKey) != -1){sltCount++;sltArrayNams.push(el.id);}}}}return sltArrayNams;}function getObjectByValue(sGroupKey,objType,sValue){    var returnValue = null;var arrObj = getObjectListArray(sGroupKey,objType);var iLength = arrObj.length;var sObjValue;for(var i = 0; i < iLength; i++){    sObjValue = getElement(document,arrObj[i]).value;if(sValue == sObjValue){returnValue = arrObj[i];break;}}return returnValue;}function getObjectIDByValue(sGroupKey,objType,sValue){var arrObj = getObjectsList(sGroupKey);var iLength = arrObj.length;var sType,returnValue = null;for(var i = 0; i < iLength; i++){    sObjValue = arrObj[i].value;sType = arrObj[i].type;if(sValue == sObjValue && sType == objType){returnValue = arrObj[i].id;break;}}return returnValue;}function getObjectsList(sGroupKey){    var arr = document.getElementsByName(sGroupKey);return arr;}function chooseRadioGroupByValue(sGroupKey,objType,sValue){    var sID = getObjectIDByValue(sGroupKey,objType,sValue);if(sID != null){getElement(document,sID).checked = true;}}function isChecked(groupKey,objType){    var returnValue = false;var selectCount = 0;var chkObj;var oType = objType || "checkbox";var chkCollection = getObjectListArray(groupKey,oType);for(var i = 0; i < chkCollection.length; i++){    chkObj = getElement(document,chkCollection[i]);if(chkObj.checked){selectCount++;}}if(selectCount > 0){returnValue = true;}return returnValue;}function checkedCount(groupKey){    var returnValue = false;var selectCount = 0;var chkObj;var chkCollection = getObjectListArray(groupKey,"checkbox");for(var i = 0; i < chkCollection.length; i++){    chkObj = getElement(document,chkCollection[i]);if(chkObj.checked){selectCount++;}}return selectCount;}function printWebPage(){    window.print();}function showOrHiddenObject(){var i, args = showOrHiddenObject.arguments;if (args.length > 0){for (i = 0; i < (args.length - 1); i++){if (new Boolean(args[args.length - 1]) == true){if (getElement(document, args[i]).className == "hiddenObject"){getElement(document, args[i]).className = "";}}else if (new Boolean(args[args.length - 1]) == false){getElement(document, args[i]).className = "hiddenObject";}}}}function setIFrameHeight(iFrameID){    if(window.parent){var IFrameObj = parent.document.getElementById(iFrameID);if(IFrameObj){IFrameObj.style.height = document.body.scrollHeight + 10 + "px";}}}function previewPicture(picID,uploadID){var imgObj = getElement(document,picID);var uploadObj = getElement(document,uploadID);if (uploadObj.value){imgObj.src = uploadObj.value;imgObj.style.display = "";}}function limitTextAreaLength(fieldObj, maxLimit){ if(fieldObj.value.length > maxLimit){fieldObj.value = fieldObj.value.substring(0, maxLimit); }} function getTableCellValueByRad(sTableName,sRadName,iCellIndex){var returnValue="",selectedCount=0,sRadID;var tbl=getElement(document,sTableName);var rad=getObjectListArray(sRadName,"radio");var radObj;if(rad){if(rad.length>0){for(var i=0;i<rad.length;i++){radObj = getElement(document,rad[i]);if(radObj.checked){selectedCount=i+1;sRadID=radObj.id;break;}}}}if(tbl){if(getElement(document,sRadID) != null){returnValue=tbl.rows[selectedCount].cells[iCellIndex].innerHTML+","+getElement(document,sRadID).value;}else{alert("错误：请先选择以后，再点击该按钮！");}}return returnValue;}function getRadioValue(sGroupName){    var returnValue = "";var rads=document.getElementsByName(sGroupName);var radLength = rads.length;if(radLength > 0){for(var i = 0; i < radLength; i++){    if(rads[i].checked){returnValue = rads[i].value;break;}}}return returnValue;}function getCheckBoxValue(sGroupName){    var returnValue = "";var rads=document.getElementsByName(sGroupName);var radLength = rads.length;if(radLength > 0){for(var i = 0; i < radLength; i++){    if(rads[i].checked){returnValue += rads[i].value + ",";}}}return returnValue.trimEnd();}function getDropdownlistText(sDropdownlistID){    var returnValue = "";var ddl=getElement(document,sDropdownlistID);var sValue;if(ddl){var ddlLength = ddl.options.length;for (var i = 0; i < ddlLength; i++){if (ddl.options[i].selected == true){returnValue += ddl.options[i].text + ",";}}}return returnValue.trimEnd();}function getDropdownlistValue(sDropdownlistID){    var returnValue = "";var ddl=getElement(document,sDropdownlistID);var sValue;if(ddl){var ddlLength = ddl.options.length;for (var i = 0; i < ddlLength; i++){if (ddl.options[i].selected == true){returnValue += ddl.options[i].value + ",";}}}return returnValue.trimEnd();}function addDropDownListItem(sKey,sValue,sDdlID){var oOption;var selObjEmp = getElement(document,sDdlID);if(!dropDownListItemIsExist(sDdlID,sKey)){var oOption = document.createElement("option");oOption.text = sKey;oOption.value = sValue;selObjEmp.options.add(oOption);}}function dropDownListItemIsExist(sDdlID,sText){    var returnValue = false;var selObjDel = getElement(document,sDdlID);var iCount = selObjDel.options.length;for(i = 0; i < iCount; i++)    {        if(selObjDel.options[i].text == sText){returnValue = true;break;}    }return returnValue;}function deleteDropDownListAllItem(sDdlID){var selObjDel = getElement(document,sDdlID);var iCount = selObjDel.options.length;if(selObjDel){for (var e = iCount-1; e >= 0; e--){selObjDel.options[e] = null;}}}function getTableDataByRad(sTableName,sRadName,iCellIndex){var returnValue="",selectedCount=0,sCurrentRowsIndex;var tbl=getElement(document,sTableName);var rad=getObjectListArray(sRadName,"radio");var radObj;if(rad){if(rad.length>0){for(var i=0;i<rad.length;i++){radObj = getElement(document,rad[i]);if(radObj.checked){sCurrentRowsIndex = convertNumber(radObj.id);selectedCount = parseInt(sCurrentRowsIndex)+1;if(tbl){returnValue += removeHTMLTag(tbl.rows[selectedCount].cells[iCellIndex].innerHTML)+"," + radObj.value + "," + sCurrentRowsIndex + "|";}}}}}if(returnValue.length > 0){returnValue = returnValue.trimEnd();}return returnValue;}function getTableCellValueByCHK(sTableName,sChkName,iCellIndex){var returnValue="",selectedCount=0,sCheckedID = "";var oArrayList = new arrayList();var oArrayKey = "", oArrayValue = "", returnStringKey = "", returnStringValue = "", returnString01 = "", returnString02 = "";var tbl=getElement(document,sTableName);var chk=getObjectListArray(sChkName,"checkbox");var chkObj;if(chk){if(chk.length>0){for(var i=0;i<chk.length;i++){chkObj = getElement(document,chk[i]);if(chkObj.checked){selectedCount=i+1;sCheckedID = chkObj.id;oArrayList.add(selectedCount,sCheckedID);}}}}if(tbl){for(var j = 0;j<oArrayList.getCount(); j++){oArrayKey = oArrayList.getItemKey(j);oArrayValue = oArrayList.getItemValue(j);returnString01 = tbl.rows[oArrayKey].cells[iCellIndex].innerHTML;returnString02 = getElement(document,oArrayValue).value;returnStringKey += returnString01 + ",";returnStringValue += returnString02 +  ",";}returnValue += returnStringKey.trimEnd() + "|" + returnStringValue.trimEnd();}return returnValue;}function getParrentWinObj(sControlID){var returnValue=opener.document.getElementById(sControlID);return returnValue;}function setElementClass(sElementID,sStyleName){    var obj = getElement(document,sElementID);if(obj){obj.className = sStyleName;}}function leftFillNumber(iNum,iDigit){    var returnValue = iNum;var sAddString = "";var theLength = iDigit - iNum.toString().length;for(var i = 0; i < theLength; i++){    sAddString += "0";}returnValue = sAddString + iNum.toString();return returnValue;}function verifyDate(intDay,intMonth,intYear){ if(isNaN(intYear) || isNaN(intMonth) || isNaN(intDay)) return false;   if(intMonth > 12 || intMonth<1) return false;  if (intDay < 1 || intDay > 31) return false;  if((intMonth == 4 || intMonth == 6 || intMonth == 9|| intMonth == 11) && (intDay > 30)) return false;  if(intMonth == 2){   if(intDay > 29) return false;   if((((intYear % 100 == 0) && (intYear % 400 != 0))||(intYear % 4 != 0)) && (intDay > 28)) return false;  }  return true;  }function getSexCode(sId) { var s = sId; return s ? (parseInt(s.substr(16,1)) % 2 ? "1" : "2") : "0"; }function isInteger(str){if (/[^\d]+$/.test(str)){return false;}return true;}function validate15IDCard(c15){var cId, pattern;if(c15.length==15){pattern = /^\d{15}$/;if(pattern.exec(c15)==null){return;}if(!verifyDate(c15.substring(10,12),c15.substring(8,10),"19"+c15.substring(6,8))){return;}cId=c15.substring(0,6)+"19"+c15.substring(6,15);var strJiaoYan  = [  "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];var intQuan = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];var intTemp = 0;for(var i = 0; i < cId.length - 1; i++){intTemp +=  cId.substring(i, i + 1)  * intQuan[i];  }intTemp %= 11;cId += +strJiaoYan[intTemp];return cId;}return;}function validate18IDCard(str){var StrNo = str;var a,b,c;if (!isInteger(StrNo.substr(0,17))) {return false}a=parseInt(StrNo.substr(0,1))*7+parseInt(StrNo.substr(1,1))*9+parseInt(StrNo.substr(2,1))*10;a=a+parseInt(StrNo.substr(3,1))*5+parseInt(StrNo.substr(4,1))*8+parseInt(StrNo.substr(5,1))*4;a=a+parseInt(StrNo.substr(6,1))*2+parseInt(StrNo.substr(7,1))*1+parseInt(StrNo.substr(8,1))*6; a=a+parseInt(StrNo.substr(9,1))*3+parseInt(StrNo.substr(10,1))*7+parseInt(StrNo.substr(11,1))*9; a=a+parseInt(StrNo.substr(12,1))*10+parseInt(StrNo.substr(13,1))*5+parseInt(StrNo.substr(14,1))*8; a=a+parseInt(StrNo.substr(15,1))*4+parseInt(StrNo.substr(16,1))*2;b=a % 11;if (b == 2){c = StrNo.substr(17,1).toUpperCase(); }else{c = parseInt(StrNo.substr(17,1));}var returnValue = StrNo.substr(0,17) + c;return returnValue;}function analyseID(sId) { var s = sId; if(s.length == 15){ if(isNaN(sId)) return false; if(verifyDate(s.substr(10,2),s.substr(8,2),s.substr(6,2))){return validate15IDCard(s); }else{return false; }} else if (s.length == 18){ if(isNaN(s.substr(0,17))) return false; if(verifyDate(s.substr(12,2),s.substr(10,2),s.substr(6,4))){ if (validate18IDCard(s) == s.toUpperCase()){return s; }else{return false; }} else{return false; }} return false; }function getIDcardBirthday(sIDcard){var returnString,returnValue01,returnValue = "";returnString = analyseID(sIDcard);if(returnString){returnValue01 = returnString.substr(6,8);var year = returnValue01.substr(0,4);var month = returnValue01.substr(4,2);var day = returnValue01.substr(6,2);returnValue = year + "-" + month + "-" + day;}    return returnValue;}function getApplyStyleTableID(){var tableObj = document.getElementsByTagName("table");var tableAttr, tableID;for(var i = 0; i < tableObj.length;i++){if(getBrowserType() == "IE"){tableAttr = tableObj[i].getAttribute("className");}else if(getBrowserType() == "Opera" || getBrowserType() == "NN"){tableAttr = tableObj[i].getAttribute("class");}if(tableAttr == "tableCollapse"){tableID = tableObj[i].id;break;}}return tableID;}function removeURlPar(sParName){var RequestObj = new QueryString();var returnValue = "";for(var i in RequestObj){    if(i.toString() != sParName){returnValue += "&" + i.toString() + "=" + RequestObj[i];}}return returnValue.trimFirst();}function autoAddBrowserButton(){var aHrefObj, sParrentDir, sParrentFolderName;var sParrentDirStr, sCurDirStr, curDirObj, sURLAndArg, sNewURL;var tableID, tableObj, tableRow,sRootObjID;var args = autoAddBrowserButton.arguments;var sPageArgs, sReplaceArgs,sTmpReplaceArgs, sSearchString;var courDocumentURL = window.location.pathname;var curFileName = getFileName(courDocumentURL);if(args.length > 0){sRootObjID = args[0];}else{sRootObjID = "HidRootFolder";}curDirObj = getElement(document,sRootObjID);if(!curDirObj){return;}sCurDirStr = curDirObj.value;sPageArgs = window.location.href;sSearchString = window.location.search;if(searchString(sPageArgs,"?")){sTmpReplaceArgs = removeURlPar("dir");sReplaceArgs = "?" + sTmpReplaceArgs;sURLAndArg = curFileName + sReplaceArgs;}else{sURLAndArg = curFileName + "?";}if(sCurDirStr.lastIndexOf("/")){sCurDirStr = sCurDirStr.substr(0,sCurDirStr.length - 1);}sParrentFolderName = getFileName(sCurDirStr);sParrentDirStr = sCurDirStr.substr(0,((sCurDirStr.length) - (sParrentFolderName.length)));sParrentDir = sParrentDirStr;tableID = getApplyStyleTableID();tableObj = getElement(document,tableID);if(sParrentDir != sCurDirStr){tableRow = insertTableRows(tableObj,1);if(tableRow){sNewURL = sURLAndArg + "&dir=" + sParrentDir;aHrefObj = "<a href=\"" + sNewURL +"\" title=\"上级目录\">"+"<img src=\"../images/parentFolder.gif\" hspace=\"3\" align=\"absmiddle\" border=\"0\">上级目录"+"</a>";tableRow.cells[0].innerHTML = aHrefObj;}}}function addValueToHidden(sValue,sHiddenID){    var oHidden = getElement(document,sHiddenID);var sHiddenValue,returnValue;if(oHidden){sHiddenValue = oHidden.value;if(!searchString(sHiddenValue,sValue)){returnValue = sHiddenValue + sValue + ",";oHidden.value = returnValue;}}}function deleteValueFromHidden(sValue,sHiddenID){    var oHidden = getElement(document,sHiddenID);var sHiddenValue,sReplaceString,returnValue;var arrHiddenValue,iLength;if(oHidden){sHiddenValue = oHidden.value;if(searchString(sHiddenValue,sValue)){arrHiddenValue = sHiddenValue.split(",");iLength = arrHiddenValue.length;for(var i = 0; i < iLength; i++){    if(arrHiddenValue[i] == sValue){arrHiddenValue.remove(i);}}returnValue = arrHiddenValue.join(",");oHidden.value = returnValue;}}}function addOrDeleteAllValue(sChkGroupName,sHiddenID,sAction){    var oHidden = getElement(document,sHiddenID);var chkCollection = getObjectListArray(sChkGroupName,"checkbox");var chkObj,sChkValue;if(oHidden){if(sAction == "add"){for(var i = 0; i < chkCollection.length; i++){chkObj = getElement(document,chkCollection[i]);if(chkObj != null && chkObj.disabled == false){sChkValue = chkObj.value;addValueToHidden(sChkValue,sHiddenID);}}}else{for(var i = 0; i < chkCollection.length; i++){chkObj = getElement(document,chkCollection[i]);if(chkObj != null && chkObj.disabled == false){sChkValue = chkObj.value;deleteValueFromHidden(sChkValue,sHiddenID);}}}}}function addOrUpdateKeyValue(sKey,sValue,sOldValue){var sTmpReturn,returnValue = "";var str = sOldValue;var iKeyIndex = str.indexOf(sKey);var iValueEnd,sFindStr;if(iKeyIndex >= 0){iValueEnd = str.indexOf(",",iKeyIndex);if(iValueEnd < 0){iValueEnd = str.length;}iKeyIndex = iKeyIndex + sKey.length + 1;sFindStr = str.slice(iKeyIndex,iValueEnd);sTmpReturn = str.replace(sFindStr,sValue);}else{sTmpReturn = sKey + ":" + sValue + ",";sTmpReturn = sTmpReturn + sOldValue;}returnValue = sTmpReturn.trimEndCharacter(",");return returnValue;}function controlValidate(bAction,sControledID,sValidateType,sErrmsg){    var obj = getElement(document,sControledID);if(obj && bAction){obj.setAttribute("dataType",sValidateType);obj.setAttribute("errmsg",sErrmsg);}else{obj.removeAttribute("dataType");obj.removeAttribute("errmsg");}}function pressCtrlAndEnter(functionName,oEvent){if(!oEvent) oEvent = window.event; var sKeyCode = oEvent.which || oEvent.keyCode;if( sKeyCode == "13" ){if( oEvent.ctrlKey){functionName();}}}function pressEnterKey(functionName,oEvent){if(!oEvent) oEvent = window.event; var sKeyCode = oEvent.which || oEvent.keyCode;if( sKeyCode == "13" ){functionName();}}