function isValidDate(dateStr) {
// Checks for the following valid date formats:
// MM/YYYY
// Also separates date into month, day, and year variables

var datePat = /^(\d{1,2})(\/|-)(\d{2}|\d{4})$/;

// To require a 4 digit year entry, use this line instead:
 //var datePat = /^(\d{1,2})(\/)\2(\d{4})$/;

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
//alert(datePat);
alert("Date is not in a valid format.")
return false;
}
month = matchArray[1]; // parse date into variables
year = matchArray[4];
if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return false;
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));

}
return true;  // date is valid
}
//********************************************************
