function Trim(str){ if(str.charAt(0) == ' '){  str = str.slice(1);  str = Trim(str);  } return str;}

function isEmpty(pObj,errMsg){ var obj = eval(pObj); if( obj == null || obj.value == '' || obj.value == ' ' || obj.value == ''){  if (errMsg == null || errMsg =='')alert('输入不能为空'); else alert(errMsg); obj.focus(); return false; }return true;}function checklen(pobj,errMsg,maxv,checkemail,mixv){var obj=eval(pobj);if (obj.value.length > maxv){ if (errMsg == null || errMsg =='')alert('您输入的文字不能超过' + maxv);else alert(errMsg); obj.focus();return false; }

if (obj.value.length < mixv){ if (errMsg == null || errMsg =='')alert('您输入的文字不能少于' + mixv);else alert(errMsg); obj.focus();return false; }

if (checkemail !=null && checkemail!=''){if (obj.value !=null && obj.value !=''){if(obj.value.length<6||obj.value.indexOf('@',0)<0 ||obj.value.indexOf('.',0)<0){alert(checkemail + '必须是合法的电子邮件');obj.focus();return false;}}}return true;}

function isNumber(pObj,errMsg){ var obj = eval(pObj); strRef = '1234567890'; if(!isEmpty(pObj,errMsg))return false; for (i=0;i<obj.value.length;i++) {  tempChar= obj.value.substring(i,i+1);  if (strRef.indexOf(tempChar,0)==-1) { if (errMsg == null || errMsg =='')  alert('请输入合法的数字'); else  alert(errMsg); if(obj.type=='text') obj.focus();  return false; } } return true;}

function isNegative(pObj,errMsg){ var obj = eval(pObj); strRef = '1234567890-'; if(!isEmpty(pObj,errMsg))return false; for (i=0;i<obj.value.length;i++) {  tempChar= obj.value.substring(i,i+1);  if (strRef.indexOf(tempChar,0)==-1) { if (errMsg == null || errMsg =='')  alert('请输入合法的数字,可以是负数'); else  alert(errMsg); if(obj.type=='text') obj.focus();  return false; }else{ if(i>0){  if(obj.value.substring(i,i+1)=='-'){ if (errMsg == null || errMsg =='')  alert('请输入合法的数字,可以是负数'); else  alert(errMsg);  if(obj.type=='text')  obj.focus();  return false; } }  } } return true;}

function isMoney(pObj,errMsg,numtype){var obj = eval(pObj); strRef = '-1234567890.';if(obj.value=='' || obj.value==null){return true;}if(!isEmpty(pObj,errMsg))return false; var tmpstring=obj.value.substring(1,obj.value.length);if (tmpstring.indexOf('-',0)>-1){alert (errMsg);obj.focus();return false;}for (i=0;i<obj.value.length;i++) {tempChar= obj.value.substring(i,i+1); if (strRef.indexOf(tempChar,0)==-1){alert(errMsg); if(obj.type=='text') obj.focus(); return false; }else{tempLen=obj.value.indexOf('.'); if(tempLen!=-1){strLen=obj.value.substring(tempLen+1,obj.value.length); if(strLen.length>numtype){ alert(errMsg); if(obj.type=='text') obj.focus(); return false; }}}}return true;}

function isLeapYear(year) {  if((year%4==0&&year%100!=0)||(year%400==0))  {  return true;  } return false; } 

function isDate(checktext,ermsg){if (checktext.value=='' || checktext.value==null){return true;}dStr = new Date(checktext.value.replace(/-/g,'/'));if(isNaN(dStr.getTime())){alert(ermsg);checktext.focus();return false;}else{return true;}}
/*
<script language=javascript event=onclick() 

for=document>var obj = event.srcElement;

if(document.getElementById('VicPopCal')){fHideCalendar();}

if(document.getElementById('dtablejsqc')){while(obj!=null && typeof(obj.tagName) != 'undefind'){
	
	if(obj.id=='dtablejsqc')return;

obj = obj.parentElement;}dtablejsqc.style.visibility='hidden';}
*/