function fucCheckNUM(NUM)
{
 var i,j,strTemp;
 strTemp="0123456789";
 if ( NUM.length== 0)
  return 0
 for (i=0;i<NUM.length;i++)
 {
  j=strTemp.indexOf(NUM.charAt(i)); 
  if (j==-1)
  {
  //说明有字符不是数字
   return 0;
  }
 }
 //说明是数字
 return 1;
}




//判断是否两者之间的数 val大于lo小于返回true，否则返回false。
function isBetween(val,lo,hi)
{
	if((val<lo)||(val>hi))
	{
		return(false);
	}
	else
	{
		return(true);
	}
}
//判断输入是否是字母,是返回true,否则返回false
function isChar(chr)
{
	var themask="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-/";
	if ((chr==null)||(chr.length==0))
	{
		return(false);
	}
	else if(themask.indexOf(chr) == -1)
	{
		return(false);
	}
	return(true); 
}
//判断输入的内容是否包含非法字符(包括汉字),包含返回ture,否则false
function isChinese(str)
{
	var flag=false;
	if(isEmpty(str))
	{
		flag=false;
	}
	else
	{
		for(var i=0;i<str.length;i++)
		{
			if (isChar(str.substring(i,i+1))==false)
			{
				flag=true;
				break;
			}
		}
	}
	return(flag);
}
//判断是否为空 为空或长度为零 返回truen,否则返回false。
function isEmpty(str)
{
	if ((str==null)||(str.length==0))
	{
		return(true);
	}
	else
	{
		return(false);
	}
}
//如果是数字返回true，否则返回false。
function isDigit(theNum)
{
	var theMask = '0123456789';
	if (isEmpty(theNum))
	{
		return(false);
	}
	else if(theMask.indexOf(theNum) == -1)
	{
		return(false);
	}
	return(true);
}
//如果是整型数字返回true，否则返回false。
function isInt(thestr)
{
	var flag=true;
	if(isEmpty(thestr))
	{
		flag=false;
	}
	else
	{
		for(var i=0;i<thestr.length;i++)
		{
			if (isDigit(thestr.substring(i,i+1))==false)
			{
				flag=false;
				break;
			}
		}
	}
	return(flag);
}
//如果是正确的电子邮件格式（包含@和.）返回true，否则返回false。
function isEmail(thestr)
{
	var atindex = thestr.indexOf('@');
	var dotindex = thestr.indexOf('.',atindex);
	var flag = true;
	thesub = thestr.substring(0,dotindex+1);
	if ((atindex<1)||(atindex != thestr.lastIndexOf('@'))||(dotindex<atindex+2)||(thestr.length<=thesub.length))
	{
		flag=false;
	}
	return(flag);
}
//如果是正确的日期格式返回true，否则返回false。格式（月－日－年）
function isDate(thestr)
{
	var the1st = thestr.indexOf('/');
	var the2nd = thestr.lastIndexOf('/');
	if (the1st == the2nd)
	{
		return(false);
	}
	else
	{
		var m = thestr.substring(0,the1st);
		var d = thestr.substring(the1st+1,the2nd);
		var y = thestr.substring(the2nd+1,thestr.length);
		var maxdays = 31;
		if (isInt(m)==false || isInt(d) == false || isInt(y) == false)
		{
			return (false);
		}
		else if(y.length < 4)
		{
			return (false);
		}
		else if (!isBetween (m,1,12))
		{
			return(false);
		}
		else if (m ==4 || m == 6 || m==9 || m ==11)
		{
			maxdays=30;
		}
		else if (m == 2)
		{
			if ( y % 4>0)
			{
				maxdays = 28;
			}
			else if((y%100 == 0) && (y%400>0))
			{
				maxdays = 28;
			}
			else
			{
				maxdays = 29;
			}
		}
		if (isBetween(d,1,maxdays) == false)
		{
			return(false);
		}
		else
		{
			return(true);
		}
	}
}
//如果是正确的时间格式返回true，否则返回false。格式（小时：分钟）
function isTime(thestr)
{
	var colondex = thestr.indexOf(':');
	if ((colondex<1)||(colondex>2))
	{
		return(false);
	}
	else
	{
		var hh = thestr.substring(0,colondex);
		var ss = thestr.substring(colondex+1,thestr.length);
		if((hh.length<1)||(hh.length>2)||(!isInt(hh)))
		{
			return(false);
		}
		else if ((ss.length<1)||(ss.length>2)||(!isInt(ss)))
		{
			return(false);
		}
		else if ((!isBetween(hh,0,23))||(!isBetween(ss,0,59)))
		{
			return (false);
		}
		else
		{
			return(true);
		}
	}
}
//判断是否为实数类型，如果是返回true，否则返回false。
function isReal(thestr)
{
	var dot1st=thestr.indexOf('.');
	var dot2nd=thestr.lastIndexOf('.');
	var OK=true;
	if (isEmpty(thestr))
	{
		return(false);
	}
	if(dot1st==-1)
	{
		if(!isInt(thestr))
		{
			return(false);
		}
		else
		{
			return(true);
		}
	}
	else if(dot1st!=dot2nd)
	{
		return(false);
	}
	else if(dot1st==0)
	{
		return(false);
	}
	else
	{
		var intpart = thestr.substring(0,dot1st);
		var decpart = thestr.substring(dot2nd+1);
		if(!isInt(intpart)||!isInt(decpart))
		{
			return(false);
		}
		else
		{
			return(true);
		}
	}
}
function isReals(thestr)
{
	var dot1st=thestr.indexOf('.');
	var dot2nd=thestr.lastIndexOf('.');
	var OK=true;
	if (isEmpty(thestr))
	{
		return(false);
	}
	if(dot1st==-1)
	{
		if(!isInts(thestr))
		{
			return(false);
		}
		else
		{
			return(true);
		}
	}
	else if(dot1st!=dot2nd)
	{
		return(false);
	}
	else if(dot1st==0)
	{
		return(false);
	}
	else
	{
		var intpart = thestr.substring(0,dot1st);
		var decpart = thestr.substring(dot2nd+1);
		if(!isInts(intpart)||!isInts(decpart))
		{
			return(false);
		}
		else
		{
			return(true);
		}
	}
}

function isInts(thestr)
{
	var flag=true;
	if(isEmpty(thestr))
	{
		flag=false;
	}
	else
	{
	       var flag_;
	       var j;
	       flag_=thestr.substring(0,1);
	      
	       if(flag_=="-")	
                  j=1;
               else 
		  j=0;  
		
		     for(var i=j;i<thestr.length;i++)
		       {
			  if (isDigit(thestr.substring(i,i+1))==false)
			    {
				flag=false;
				break;
			    } 
		       }
   
	}
	return(flag);
}