function check_dates(book){

var today = new Date;
var start = new Date;
var end = new Date;

start.setDate(document.book.aday.value);
start.setMonth(document.book.amonth.value-1);
start.setFullYear(document.book.ayear.value);

end.setDate(document.book.dday.value);
end.setMonth(document.book.dmonth.value-1);
end.setFullYear(document.book.dyear.value);
 

		if((today>=start) || (today>=end))
		{
		alert ("The selected dates are not correct! Please try again!");
		return false;
		}
			else
		{
		if(document.book.ayear.value < document.book.dyear.value)
			{
			sendme();
			return true;
			}
				else
			{
				if(document.book.ayear.value==document.book.dyear.value)
				{
					if(document.book.amonth.value<document.book.dmonth.value)
						{
						sendme();
						return true;
						}
							else
						{
							if(document.book.amonth.value==document.book.dmonth.value)
							{
								if(document.book.aday.value<document.book.dday.value)
								{
								sendme();
								return true;
								}
									else
								{
								alert ("The selected dates are not correct! Please try again!");
								return false;
								}
							}
								else
							{
							alert ("The selected dates are not correct! Please try again!");
							return false;
							}
						}
				}
					else
				{
				alert ("The selected dates are not correct! Please try again!");
				return false;
				}
			}
			}
}

<!--
function sendme() 
{
	window.open("","myNewWin","width=615,height=485,scrollbars=1,resizable=1,toolbar=0"); 
    var a = window.setTimeout("document.book.submit();",500); 
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
