function DateValidation(format, inDate)
{
// window.onerror=null // for all other strange errors

	var err=0

	if (format == "1")
	{
		month = inDate.substring(0, 3)
		day = inDate.substring(3, 5)
		year = inDate.substring(5, 9)

		switch (true)
		{
			case (((month == "JAN") || (month == "MAR") || (month == "MAY") || (month == "JUL") || (month == "AUG") || (month == "OCT") || (month == "DEC")) && (day > 31)):
				alert("'Day' cannot be greater than 31")
				err = 1;
				break;
			case (((month == "APR") || (month == "JUN") || (month == "SEP") || (month == "NOV")) && (day > 30)):		
				alert("'Day' cannot be greater than 30")
				err = 1;
				break;
			case (month == "FEB"):
				if (year%4 == 0)
				{
					if (day > 29)
					{
						alert("'Day' cannot be greater than 29")
						err = 1;
						break;
					}
				}
				else
				{
					if (day > 28)
					{
						alert("'Day' cannot be greater than 28")
						err = 1;
						break;
					}
				}
		}
	}
	
	if (err == 1)
	{	return false;	}
	else
	{	return true;	}
}
