function BASEtrim(str){
	  lIdx=0;rIdx=str.length;
	  if (BASEtrim.arguments.length==2)
	    act=BASEtrim.arguments[1].toLowerCase()
	  else
	    act="all"
      for(var i=0;i<str.length;i++){
	  	thelStr=str.substring(lIdx,lIdx+1)
		therStr=str.substring(rIdx,rIdx-1)
        if ((act=="all" || act=="left") && thelStr==" "){
			lIdx++
        }
        if ((act=="all" || act=="right") && therStr==" "){
			rIdx--
        }
      }
	  str=str.slice(lIdx,rIdx)
      return str
}

function BASEalert(theText,notice){  
	  alert(notice)
	  theText.focus()
	  theText.select()
	  return false
}
function BASEisNotNum(theNum){
	if (BASEtrim(theNum)=="")
		return true
	for(var i=0;i<theNum.length;i++){
	    oneNum=theNum.substring(i,i+1)
        if (oneNum<"0" || oneNum>"9")
          return true
    }
	return false
}
function BASEreal_len(theText){ 
	  var real_len=0;
	  text_val=theText.value;
	  text_len=theText.value.length;
	  for(i=0;i<text_len;i++){
	    if (text_val.charCodeAt(i)>127){
		  real_len=real_len+2;
		}
	    else{
		  real_len++;
		}
  	  }
	  return(real_len);
}
function Check_Email(string){ 
	var str_len = string.length;
	if (str_len<=5){
	   return true
    	}  
	for(i=0;i<str_len;i++){
	    if (string.charCodeAt(i)>127){
		return true 	
		}
	}
	if (string.indexOf("@")<2){
	    return true
    	}  
        if (string.indexOf(".")==1){
	    return true
    	}  
	if (string.indexOf(":")!=-1){
	    return true
	}
}


function isNumber(Theinput)
 {
   var temp
   temp=BASEtrim(Theinput.value);
    if (temp!="") 
    {
      if (isNaN(temp))
      {
       BASEalert(Theinput,"请输入数字")
       return false
      }
    }
 return true
 }


 function  Isempty(inobj,errstr,flagnull)
 {
 var regexp=/\'/
 var instr=BASEtrim(inobj.value)
 inobj.value=instr.replace(regexp,"\'\'")
 if (((instr=="")||(instr==null))&&(flagnull==1))
   {
     if (errstr!="")
     BASEalert(inobj,errstr)
     return true;
   }
 else
 {
  return false
 }
 }
 
 function checknum(docobject,errstr)
  {
    if(parseInt(docobject.value)<0)
     {
         alert(errstr+"不能为负数!");
         docobject.focus();
         return false;
     }
   return true;
  }

