	//Function IsDate 
	function IsDate(strpDate)
	{
		
		var strDate,strSep,intPos1,intPos2,strYear,intYear
		var goodChars="0123456789";
		var i;
		
		//---Find out separator character
		if (strpDate.indexOf("/")>0)
		{
			strSep="/";
		}
		else if(strpDate.indexOf("-")>0)
		{
			strSep="-";
		}
		else
		{
			return false;
		}	
		
		//---find out positions of separators
		intPos1=strpDate.indexOf(strSep)+1;
		if(intPos1==0)
		{
			return false;
		}
		
		intPos2=strpDate.indexOf(strSep,intPos1)+1;
		if(intPos2==0)
		{
			return false;
		}
		
		
		//---find out year
		strYear=strpDate.substring(intPos2);
		if(strYear=="")
		{
			return false;
		}
		

		//---check for year to be numeric		
		for(i=0;i<strYear.length;i++)
		{
			if(goodChars.indexOf(strYear.charAt(i),0) == -1)	
			{
				return false;
			}
		}
		
		intYear=parseInt(strYear);
		
		//---check for range of the year
		if(intYear<1800 || intYear>9999)
		{
			return false;
		}
				
		//---check for leap year
		if((intYear % 4)== 0)
		{
			if(intYear % 100 == 0)
			{
				if(intYear % 400 == 0)
				{
					IsLeapYear=true;
				}
				else
				{
					IsLeapYear=false;
				}
			}
			else
			{
				IsLeapYear=true;
			}
		}
		else
		{
			IsLeapYear=false;
		}
		
		//////////////////////////////////////////////////////////////////////////////////////////////
		
		//---find out month
		strMonth=strpDate.substring(intPos1,intPos2-1);
		if(strMonth=="")
		{
			return false;
		}
		
		//---check for month to be numeric		
		for(i=0;i<strMonth.length;i++)
		{
			if(goodChars.indexOf(strMonth.charAt(i),0) == -1)	
			{
				return false;
			}
		}
		var chkM
		chkM=strMonth.substring(0,1);
		if (chkM==0)
			{
			intMonth=parseInt(strMonth.substring(1,2));
			}
		else
			{
			intMonth=parseInt(strMonth);
			}
			
		//---check for range of the month
		if(intMonth < 1 || intMonth > 12)
		{
			return false;
		}
		
		///////////////////////////////////////////////////////////////////////////////////////////////

		//---find out day
		strDay=strpDate.substring(0,intPos1-1);
		if(strDay=="")
		{
			return false;
		}
		
		//---check for day to be numeric		
		for(i=0;i<strDay.length;i++)
		{
			if(goodChars.indexOf(strDay.charAt(i),0) == -1)	
			{
				return false;
			}
		}
		
		var chkD
		chkD=strDay.substring(0,1);
		if (chkD==0)
			{
			intDay=parseInt(strDay.substring(1,2));
			}
		else
			{
			intDay=parseInt(strDay);
			}

		//---Check for day range
		if(intMonth==1 || intMonth==3 || intMonth==5 || intMonth==7 || intMonth==8 || intMonth==10 || intMonth==12)
		{
			if(intDay<1 || intDay>31)
			{
				return false;
			}
		}
		else if(intMonth==4 || intMonth==6 || intMonth==9 || intMonth==11)
		{
			if(intDay<1 || intDay>30)
			{
				return false;
			}
		}
		else if(intMonth==2)
		{
			if(IsLeapYear==true)
			{
				if(intDay<1 || intDay>29)
				{
					return false;
				}
			}
			else
			{
				if(intDay<1 || intDay>28)
				{
					return false;
				}
			}
		}

	return true;	
	}//end of isdate function
		
