///////////////////////////////////////////// // Control: Dialog Box functionality ///////////////////////////////////////////// qcodo.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); qcodo.monthNamesAbbreviated = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); qcodo.dayNames = new Array("Su","Mo","Tu","We","Th","Fr","Sa"); qcodo.registerCalendar = function(mixControl, strDtxControlId) { // Initialize the Event Handler qcodo.handleEvent(); // Get Control/Wrapper var objControl; if (!(objControl = qcodo.getControl(mixControl))) return; var objWrapper = objControl.wrapper; // Get Linked DateTimeTextbox objControl.dateTimeTextBox = qcodo.getControl(strDtxControlId); // Get CalendarPane and Hide it objControl.calendarPane = document.getElementById(objControl.id + "_cal"); objControl.calendarPane.style.display = "none"; objControl.showCalendar = function() { var strPositionArray = this.wrapper.getAbsolutePosition(); this.calendarPane.style.left = strPositionArray.x + "px"; this.calendarPane.style.top = strPositionArray.y + "px"; this.calendarPane.style.position = "absolute"; this.calendarPane.style.zIndex = 10; this.calendarPane.style.display = "block"; this.drawCalendar(0, 0); }; objControl.setDate = function(intYear, intMonth, intDay) { this.dateTimeTextBox.value = qcodo.monthNamesAbbreviated[intMonth] + " " + intDay + " " + intYear; this.hideCalendar(); }; objControl.setToToday = function() { var dttToday = new Date(); this.setDate(dttToday.getFullYear(), dttToday.getMonth(), dttToday.getDate()) }; objControl.drawCalendar = function(intYear, intMonth) { // Get the "selected" date and the "current" date var dttSelected; if (this.dateTimeTextBox.value) dttSelected = new Date(this.dateTimeTextBox.value); var dttToday = new Date(); // Get the month to view var dttMonthToView; // If viewing a specific month/year, use it if (intYear) dttMonthToView = new Date(intYear, intMonth, 1); // If no "selected date" use "today" else if (!dttSelected || dttSelected == "Invalid Date") dttMonthToView = new Date(); // Otherwise, use the "selected date" else dttMonthToView = new Date(dttSelected); dttMonthToView.setDate(1); var intViewMonth = dttMonthToView.getMonth(); var intViewYear = dttMonthToView.getFullYear(); // Render the month to view var strCalendar = '
" + qcodo.dayNames[intDay] + " | "; strCalendar += "
---|
' + dttMonthToView.getDate() + ' | '; dttMonthToView.setDate(dttMonthToView.getDate() + 1); }; strCalendar += '