function ltrim(string){var objstr=string;if((objstr=="")||(objstr==" ")||objstr==undefined){return""}var head;var exitw=true;while(exitw){if((objstr=="")||(objstr==" ")||objstr==undefined){return""}head=objstr.charAt(0);if(head==" "){objstr=objstr.substr(1)}else{exitw=false}}return objstr}function rtrim(string){var objstr=string;if((objstr=="")||(objstr==" ")||objstr==undefined){return""}var head;var exitw=true;while(exitw){if((objstr=="")||(objstr==" ")||objstr==undefined){return""}head=objstr.charAt(objstr.length-1);if(head==" "){objstr=objstr.substr(0,objstr.length-1)}else{exitw=false}}return objstr}function trim(string){var objstr=string;objstr=ltrim(objstr);objstr=rtrim(objstr);return objstr}function isemptyinput(itemid,warning){var obj=document.all.item(itemid);var warnstr=warning;if(obj==null){alert("您输入的id号不存在!");return}if(trim(obj.value)==""){if(!((warnstr=="")||(warnstr==null))){obj.focus();alert(warning)}return true}return false}function isempty(str){var objstr=str;if((objstr=="")||(objstr==null)){return true}return false}function isinteger(str){var objstr=str;var num=new Array("0","1","2","3","4","5","6","7","8","9");var i,j;if(isempty(str)){return false}for(i=0;i1){if(temp.substr(0,1)=="0"){temp=temp.substr(1,1)}}var month=parseInt(temp);if((month<1)||(month>12)){alert("月的范围是1--12!");obj.focus();return false}return true}function judgeDay(itemid,mon){var obj=document.all.item(itemid);var temp=obj.value;if(temp.length>1){if(temp.substr(0,1)=="0"){temp=temp.substr(1,1)}}var day=parseInt(temp);temp=document.all.item(mon).value;if(temp.length>1){if(temp.substr(0,1)=="0"){temp=temp.substr(1,1)}}var month=parseInt(temp);switch(month){case 1:case 3:case 5:case 7:case 8:case 10:case 12:if(day<1||day>31){alert(month+"月的范围是1--31天!");obj.focus();return false}break;case 4:case 6:case 9:case 11:if(day<1||day>30){alert(month+"月的范围是1--30天!");obj.focus();return false}break;case 2:if(day<1||day>29){alert(month+"月的范围是1--29天!");obj.focus();return false}break}return true}function trimZero(str){var objstr=str;var i;var symbol;for(i=0;i"9"){return false}}return true}function isNumberInput(itemid,warning){var obj=document.all.item(itemid);var warnstr=warning;if(obj==null){alert("您输入的id号不存在!");return}if(!isNumber(obj.value)==true){if(!((warnstr=="")||(warnstr==null))){obj.focus();alert(warning)}return true}return false}function check(keystr){var keyname=keystr;var obj=eval("document.forms[0]."+keyname);var flag=false;var i=0;if(obj==null){return false}if(obj.length==null){if(obj.disabled){return false}if(obj.checked){return true}}for(i=0;ilen1){return false}var i=0;for(i=0;i1)){event.returnValue=true;return}code=sel.text;tmp=sel.duplicate();tmp.moveToPoint(r.getBoundingClientRect().left,sel.getClientRects()[0].top);sel.setEndPoint("startToStart",tmp);sel.text=sel.text.replace(/^\t/g,"");code=code.replace(/^\t/g,"").replace(/\r\n/g,"\r");r.findText(code);r.select();break;case (9):if(sel.getClientRects().length>1){code=sel.text;tmp=sel.duplicate();tmp.moveToPoint(r.getBoundingClientRect().left,sel.getClientRects()[0].top);sel.setEndPoint("startToStart",tmp);sel.text="\t"+sel.text.replace(/\r\n/g,"\r\t");code=code.replace(/\r\n/g,"\r\t");r.findText(code);r.select()}else{sel.text="\t";sel.select()}break;case (13):tmp=sel.duplicate();tmp.moveToPoint(r.getBoundingClientRect().left,sel.getClientRects()[0].top);tmp.setEndPoint("endToEnd",sel);for(var i=0;tmp.text.match(/^[\t]+/g)&&i