function caluMonthNum(startD,endD){ var endDate = new Date(endD); var startDate = new Date(startD); var number = 0; yearToMonth = (endDate.getFullYear() - startDate.getFullYear()) * 12; number += yearToMonth; monthToMonth = endDate.getMonth() - startDate.getMonth()+1; number += monthToMonth; return number; } function forbidBackSpace() { if (((event.keyCode == 8) && //BackSpace ((event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") || event.srcElement.readOnly == true)) || ((event.ctrlKey) && ((event.keyCode == 78) || (event.keyCode == 82)) ) || //CtrlN,CtrlR (event.keyCode == 116) ) { //F5 event.keyCode = 0; event.returnValue = false; } } function relocation(url){ self.location.href=url; } function DelCookie(sName){ document.cookie = sName + "=;expires=Fri, 31 Dec 1989 23:59:59 GMT;"; } function openModalDialog(url){ returVal=window.showModalDialog(url,'','dialogWidth=540px;dialogHeight=300px;center:yes;help:no;resizable:no;status:no'); } function showDialog(url,width,height){ returVal=window.showModalDialog(url,'','dialogWidth='+width+'px;dialogHeight='+height+'px;center:yes;help:no;resizable:no;status:no;scrollbars:no'); return returVal; } function showResizeDialog(url,width,height){ returVal=window.showModalDialog(url,'','dialogWidth='+width+'px;dialogHeight='+height+'px;center:yes;help:yes;resizable:yes;scroll:yes;status:no'); return returVal; } function openFullWindow(url){ returVal=window.open(url,'','width='+(screen.availWidth-10)+',height='+(screen.availHeight - 50)+',left=0,top=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=yes'); } function openWindow(url){ returVal=window.open(url,'','width=540,height=300,left='+screen.width/2-270+',top='+screen.height/2-150+',toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no'); } function showResizeWindow(url,width,height){ returVal=window.open(url,'','width='+width+',height ='+height+',left='+screen.width/2-width/2+',top='+screen.height/2-height/2+',toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no'); } function openPrintWindow(url){ returVal=window.open(url,'','width=1024,height =768,left='+screen.width/2-512+',top='+screen.height/2-384+',toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no'); } function isCurrency(fData){ var reg = new RegExp("^[0-9]+(.[0-9]{2})?$"); return (reg.test(fData)); } function isInteger(fData){ if (fData=='' || fData==null) return false; var reg = new RegExp("^[0-9]*$"); return (reg.test(fData)); } function isDouble(fData){ var reg = new RegExp("^[0-9]+(.[0-9]{1,6})?$"); return (reg.test(fData)); } function closewindow(){ if(confirm("确认关闭窗口?")){ window.close() } } function setSubMainFrameTreeVisibility(){ try{ setVisibility(treePane, false); viewPane.style.width=document.body.clientWidth; viewPane.style.left=0; }catch(ex){ } } function setSubMainFrameTreeVisibility2(){ var visible=isObjVisible(treePane); if (visible){ setVisibility(treePane,true); viewPane.style.width=document.body.clientWidth-201; viewPane.style.left=201; }else{ setVisibility(treePane,false); viewPane.style.width=document.body.clientWidth; viewPane.style.left=0; } } function isObjVisible(obj){ if (obj!=null){ return obj.style.display=="none"; } return false; } function setVisibility(obj, blnVisible){ if (obj!=null){ if (blnVisible){ obj.style.display="block"; }else{ obj.style.display="none"; } } } function selectAllOption(objects,checked){ if (objects!=null){ var num=objects.length; if (num==null){ objects.checked=checked; }else{ for (var i = 0 ; i < num ; i++) { objects[i].checked=checked; } } } } function selectReverseOption(objects){ if (objects!=null){ var num=objects.length; if (num==null){ objects.checked=!objects.checked; }else{ for (var i = 0 ; i < num ; i++) { objects[i].checked=!objects[i].checked; } } } } function haveSelected(objects){ var haveSel=false; if (objects!=null){ var num=objects.length; if (num==null){ if (objects.checked){ haveSel=true; } }else{ for (var i = 0; i < num; i++) { if (objects[i].checked) { haveSel=true; break; } } } } return haveSel; } function getRangeSelect(id, min, max, defaultSelected){ var vSelCtl = ""; return vSelCtl; } function isNumeric(value){ return value.search(/^(-|\+)?\d+(\.\d+)?$/) != -1; } /************ menu tree ************/ //get object of document function getTreeObject(obj){ var retuObj=document.getElementById(obj)?document.getElementById(obj):obj; return retuObj; } //hide object function Hide(obj) { getTreeObject(obj).style.display="none"; } //show object function Show(obj) { getTreeObject(obj).style.display=""; } /* * replace current object's parent's style class * parameter obj-current object * cls1: class of style 1 * cls2: class of style 2 * num: parent's level */ function ExCls(obj,cls1,cls2,num){ var theObj=getTreeObject(obj); for(i=0;i"; this.ImgBlankB =""; for (i=0;i length){ item.nodeValue = item.nodeValue.substr(0,length - curLength) + "......"; curLength = -1; doDeleteId = i + 1; break; }else{ curLength = l; } }else{ curLength = StringFormat(item,length,curLength); if(curLength ==-1) { doDeleteId = i+1; break; } } } while(doDeleteId