
function daysInMonth(month,year)
{return 32-new Date(year,month,32).getDate();}
function getValidDate(date,earliestPossibleDate,latestPossibleDate)
{if(date<earliestPossibleDate)
{date=earliestPossibleDate;}
else if(date>latestPossibleDate)
{date=latestPossibleDate;}
return date;}
