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 ='
'; buildStr+='\n
'; buildStr+='\n
'; buildStr+='\n
'; buildStr+='\n <'; buildStr+='\n       '+viewDate.getMonthName()+' '+viewDate.getFullYear(); buildStr+='\n       >'; buildStr+='\n
'; buildStr+='\n
'; buildStr+='\n
'; for(var i=0; i <= 6; i++){ buildStr+='\n
' + d_names[i].substr(0, 3) + '
'; } buildStr+='\n
'; buildStr+='\n
'; // Create blank boxes until we get to the day which actually starts the month for(var i=0; i= pubDate - 1 && thisDay == "Wednesday"){ strThisDay = (viewDate.getMonth() + 1) + "/" + i + "/" + viewDate.getFullYear(); clickStr = '' + i + ''; strClass = "pubDate" if(strThisDay == dateSent) strClass = "selected" }else{ if (String(viewDate) == String(todaysDate)){ strClass = "today" }else{ if (viewDate > todaysDate) strClass = "future" } } linkStr='\n
' + clickStr + '
'; //alert(linkStr); buildStr += linkStr; border++; if (((border%7)==0)&&(i