function isMail(str)
{
/*********************************************
*PURPORSE: CHECK EMAIL ILLEGAL OR NOT
*INPUT:    str,EMAIL STRING
*OUTPUT:   FALSE,HAVE INVALID;TRUE OK
*AUTHOR:   LST
*DATE:     19/6/2000
********************************************/	
	count = 0;
	flag = true;

	for (var i = 0; i < str.length; i++) {
		var ch = str.substr(i, 1);
		var ch1 = str.substr(i + 1, 1);
		if (((ch < 'a' || 'z' < ch) && (ch < 'A' || 'Z' < ch)) && (ch < '0' || '9' < ch) && (ch != '@') && (ch != '.') && (ch != '_') && (ch != '-')) return false;
		if ((i == 0) && ((ch == '@') || (ch == '.'))) return false;
		if ((i == str.length - 1) && ((ch == '@') || (ch == '.'))) return false;
		if (ch == '@') count++;
		if ((ch == '@') && (ch1 == '.')) return false;
		if ((ch == '.') && (ch1 == '.') && (count == 1)) return false;
		if ((ch == '.') && (count == 1)) flag = false;
	}

	if (flag) return false;
	if (count != 1) return false;

	return true;
}

function BASEalert(theText,notice){  
//不合法字段出错提示
	  alert(notice);
	  theText.focus();
	  theText.select();
	  return false;
}

function BASEisNotNum(theNum){

/*********************************************
*PURPORSE: CHECK NUMBER OR NOT
*INPUT:    theNum,NUMBER STRING
*OUTPUT:   FALSE,INVALID;TRUE OK
*AUTHOR:   LST
*DATE:     19/6/2000
********************************************/

	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 BASEisNotInt(theInt){

/*********************************************
*PURPORSE: CHECK iNTERGER OR NOT
*INPUT:    theNum,NUMBER STRING
*OUTPUT:   FALSE,INVALID;TRUE OK
*AUTHOR:   LST
*DATE:     19/6/2000
********************************************/
	theInt=BASEtrim(theInt);
	if ((theInt.length>1 && theInt.substring(0,1)=="0") || BASEisNotNum(theInt)){
		return true;
	}
	return false;
}
function BASEisNotFloat(theFloat){
//判断是否为浮点数
	len=theFloat.length;
	dotNum=0;
	if (len==0)
		return true;
	for(var i=0;i<len;i++){
	    oneNum=theFloat.substring(i,i+1);
		if (oneNum==".")
			dotNum++;
        if ( ((oneNum<"0" || oneNum>"9") && oneNum!=".") || dotNum>1)
          return true;
    }
	if (len>1 && theFloat.substring(0,1)=="0"){
		if (theFloat.substring(1,2)!=".")
			return true;
	}
	return false;
}

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 BASEisNotID(strID){
//判断userid,corpid,staffid是否只有字母和数字、下划线和横线

	strID = BASEtrim(strID)
	
	for(var i=0;i<strID.length;i++){
		var ch = strID.substring(i,i+1);
		if(((ch<'a'||ch>'z')&&(ch<'A'||ch>'Z'))&&(ch<'0'||ch>'9') && (ch != '_') && ch !='-') return true;
	}
}

function js_openpage(url) {
  var 
newwin=window.open(url,"NewWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=400");
 // newwin.focus();
  return false;
}