Good Javascript date compare

<html>
<head>
<title>Compare Dates</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<Script Language=Javascript>
function CompareDates()
{
var str1  = document.getElementById(“Fromdate”).value;
var str2  = document.getElementById(“Todate”).value;
var dt1   = parseInt(str1.substring(0,2),10);
var mon1  = parseInt(str1.substring(3,5),10);
var yr1   = parseInt(str1.substring(6,10),10);
var dt2   = parseInt(str2.substring(0,2),10);
var mon2  = parseInt(str2.substring(3,5),10);
var yr2   = parseInt(str2.substring(6,10),10);
var date1 = new Date(yr1, mon1, dt1);
var date2 = new Date(yr2, mon2, dt2);

if(date2 < date1)
{
alert(“To date cannot be greater than from date“);
return false;
}
else
{
alert(“Submitting …”);
document.form1.submit();
}
}

</Script>
</head>

<body bgcolor=”#FFFFFF” text=”#000000″>
<form name=”form1″ method=”post” action=””>
<input type=”text” name=”fromdate” id=”fromdate” value=”20/10/2005″>
<input type=”text” name=”todate” id=”todate” value=”19/10/2005″>
<input type=”button” value=”compare dates” onclick=”CompareDates()”>
</form>
</body>
</html>