// JavaScript Document
function validdate(d,m,y)
{
	if ((m == 3 || m == 5 || m == 8 || m == 10)&&d>=31)
	{
		alert('April-June-Sep-Nov months can not have 31 days'); 
		return false;
	} /////////////////////////DATE FOR APRIL, JUNE, SEP, NOV
	else
	{
		if(m==1)			///////////////////////FEBRUARY FOR LEAP AND NON LEAP YEAR
		{
			if((  (y % 4 == 0&&y % 100 != 0)||(y % 400 == 0) )&&d > 29 )
			{
				alert('Feb in Leap year can not have more than 29 days'); 
				return false;
			}					//alert('This leap february can not have date more than 29');
			else if(((y % 4 != 0||y % 100 == 0)&&(y % 400 != 0) )&&d > 28)
			{
				alert('February in Non Leap year can not be more than 28 days!'); 
				return false;
			} //Non Leap year but date > 28
		}
	 }
	return true;
}

function daysInMon(year, mon)
{
	var days = 31;
    if (mon == 3 || mon == 5 || mon == 8 || mon == 10)
		days = 30;					//if Apr, Jun, Sep or Nov
    else
	{	
		if (mon == 1)
		{
			if( year % 4 != 0 )days = 28;										//odd year 1997
            else days = ( year % 100 == 0 && year % 400 != 0 ) ? 28 : 29;		//even but only 1800, 1900 ... not 1600
        }
     }
    return days;
}