function setRunStartDate(d, divID){ for (var i=0; i <= 31; i++){ if (document.getElementById("div_" + i)){ if (document.getElementById("div_" + i).className == "selected") document.getElementById("div_" + i).className = "pubDate"; } } document.getElementById(divID).className = "selected"; document.thisForm.startDate.value = d; } function setTimeToMidnight(d) { var tempDate = new Date(d); tempDate.setHours(0) tempDate.setMinutes(0) tempDate.setSeconds(0) tempDate.setMilliseconds(0) return tempDate; }; Date.prototype.getMonthName = function() { return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][this.getMonth()]; } Date.prototype.daysInMonth = function () { return new Date(this.getFullYear(), this.getMonth()+1, 0).getDate() } function drawCalendar(dateSent, pubDatesOnly, showEvents) { calendar.innerHTML = ""; var strThisDay = ""; var pubDate = new Date(2012, 1, 8); var viewDate = new Date(); var todaysDate = new Date(); todaysDate = setTimeToMidnight(todaysDate); var strClass; if(dateSent != ""){ var thisMonth; var thisDate; var thisYear; dateParams = dateSent.split("/"); thisYear = dateParams[2]; thisMonth = dateParams[0] - 1; thisDate = dateParams[1]; viewDate.setDate(thisDate); viewDate.setMonth(thisMonth); viewDate.setYear(thisYear); } viewDate = setTimeToMidnight(viewDate); var d_names = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); // The number of days in the month. var numDays = viewDate.daysInMonth(); // Get the starting day of this calendar, mon, tue, wed, etc. var startDay= new Date(viewDate.getFullYear(), viewDate.getMonth(), 1).getDay(); // We'll build our table in the buildStr variable then pass what we build back. // This will be a HTML table -- Build the header rows... var buildStr ='