function isFuture(YYYY,MM,DD) {// returns true if the given date is in the future, false if it is not var sysYYYY = 2018; var sysMM = 01; var sysDD = 16; // alert("Date submitted - y:" + YYYY + " m:" + MM + " d:" + DD + "\n" + "System Dates y:" + sysYYYY + " m:" + sysMM + " d:" + sysDD); if (YYYY > sysYYYY) { return true; } else { if (YYYY == sysYYYY) { if (MM > sysMM) { return true; } else if (MM == sysMM) { if (DD > sysDD) { return true; } } } return false; } } function dateValidator(dateStr) {// validates CCYY/MM/DD CCYY-MM-DD and returns true if the date is valid, and an appropriate error message if it is not var datePat = /^(\d{4})(\/|-)(\d{1,2})\2(\d{1,2})$/; var matchArray = dateStr.match(datePat); // format ok? if (matchArray == null) { return "Dates must be numeric and in mm/dd/ccyy format."; } year = matchArray[1]; month = matchArray[3]; day = matchArray[4]; if (month < 1 || month > 12) {// check month range return "Month must be between 1 and 12."; } if (day < 1 || day > 31) { return "Day must be between 1 and 31."; } if ((month==4 || month==6 || month==9 || month==11) && day==31) { var theMonth = getMonthName(month); return theMonth + " doesn't have 31 days"; } if (month == 2) {// check for february 29th var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); if (day>29 || (day==29 && !isleap)) { return "February " + year + " doesn't have " + day + " days"; } } return true; function getMonthName(n) {// n is the month number var monthArray = new Array(); monthArray[1] = 'January'; monthArray[2] = 'February'; monthArray[3] = 'March'; monthArray[4] = 'April'; monthArray[5] = 'May'; monthArray[6] = 'June'; monthArray[7] = 'July'; monthArray[8] = 'August'; monthArray[9] = 'September'; monthArray[10] = 'October'; monthArray[11] = 'November'; monthArray[12] = 'December'; for (var i = 0; i < monthArray.length; i++) { if (i==n) { return monthArray[i] } } } } function clearForm(fName) {// fName is the @name of the form if (confirmClear()) { var f = document.forms[fName]; for(i=0;i