<!--

// Objective: Determines if a given string is a valid date using a regular expression.
// Arguments: sDate, string;
// Returns:   boolean.
function isValidDate(sDate)
{
	var oRegExp = new RegExp("^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19[0-9][0-9]|20[0-9][0-9])$", "gi")
	
	if (oRegExp.test(sDate))
	{
		var aParts = sDate.split("/");
		var nDay = parseInt(aParts[0]);
		var nMonth = parseInt(aParts[1]);
		var nYear = parseInt(aParts[2]);

		if ((nDay == 31) && (nMonth == 4 || nMonth == 6 || nMonth == 9 || nMonth == 11))
		{	return false; /* 31st of a month with 30 days */ }
		else if (nDay >= 30 && nMonth == 2)
		{	return false; /* February 30th or 31st */ }
		else if ((nMonth == 2 && nDay == 29) && !((nYear % 4 == 0) && ((nYear % 100 != 0) || (nYear % 400 == 0))))
		{	return false; /* February 29th outside a leap year */ }
		else
		{	return true; /* Valid date */ }
	}
	else
		return false
}

// Objective: Determines if a given string is a valid date using the Date.parse static method.
// Arguments: sDate, string;
// Returns:   boolean.
function isValidDate2(sDate)
{
	var dDate = new Date();
	dDate.setTime(Date.parse(sDate));
	return (!isNaN(dDate))
}

//-->
