context: YAHOO.widget.Calendar_Core.prototype.renderBody = function(workingDate) {	this.logger.log("Rendering body", "info");	this.preMonthDays = workingDate.getDay();	if (this.Options.START_WEEKDAY > 0) {		this.preMonthDays -= this.Options.START_WEEKDAY;	}	if (this.preMonthDays < 0) {		this.preMonthDays += 7;	}		this.logger.log(this.preMonthDays + " preciding out-of-month days", "info");	this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();	this.logger.log(this.monthDays + " month days", "info");	this.postMonthDays = YAHOO.widget.Calendar_Core.DISPLAY_DAYS-this.preMonthDays-this.monthDays;	this.logger.log(this.postMonthDays + " post-month days", "info");		workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);	this.logger.log("Calendar page starts on " + workingDate, "info");		var weekRowIndex = 0;		for (var c=0;c<this.cells.length;++c) {		var cellRenderers = new Array();				var cell = this.cells[c];		this.clearElement(cell);		cell.index = c;		cell.id = this.id + "_cell" + c;				this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]; // Add this date to cellDates		if (workingDate.getDay() == this.Options.START_WEEKDAY) {			var rowHeaderCell = null;			var rowFooterCell = null;						if (this.Options.SHOW_WEEK_HEADER) {				rowHeaderCell = this.weekHeaderCells[weekRowIndex];				this.clearElement(rowHeaderCell);			}						if (this.Options.SHOW_WEEK_FOOTER) {				rowFooterCell = this.weekFooterCells[weekRowIndex];				this.clearElement(rowFooterCell);			}									if (this.Options.HIDE_BLANK_WEEKS && this.isDateOOM(workingDate) && ! YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)) {				// The first day of the week is not in this month, and it's not an overlap week				continue;			} else {				if (rowHeaderCell) {					this.renderRowHeader(workingDate, rowHeaderCell);				}				if (rowFooterCell) {					this.renderRowFooter(workingDate, rowFooterCell);				}				}		}		this.logger.log("Rendering cell " + cell.id + " (" + workingDate.getFullYear() + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + ")", "cellrender");		var renderer = null;				if (workingDate.getFullYear()	== this.today.getFullYear() &&			workingDate.getMonth()		== this.today.getMonth() &&			workingDate.getDate()		== this.today.getDate()) {			cellRenderers[cellRenderers.length]=this.renderCellStyleToday;		}				if (this.isDateOOM(workingDate)) {			cellRenderers[cellRenderers.length]=this.renderCellNotThisMonth;		} else {			for (var r=0;r<this.renderStack.length;++r) {				var rArray = this.renderStack[r];				var type = rArray[0];								var month;				var day;				var year;				switch (type) {					case YAHOO.widget.Calendar_Core.DATE:						month = rArray[1][1];						day = rArray[1][2];						year = rArray[1][0];						if (workingDate.getMonth()+1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {							renderer = rArray[2];							this.renderStack.splice(r,1);						}						break;					case YAHOO.widget.Calendar_Core.MONTH_DAY:						month = rArray[1][0];						day = rArray[1][1];												if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {							renderer = rArray[2];							this.renderStack.splice(r,1);						}						break;					case YAHOO.widget.Calendar_Core.RANGE:						var date1 = rArray[1][0];						var date2 = rArray[1][1];						var d1month = date1[1];						var d1day = date1[2];						var d1year = date1[0];												var d1 = new Date(d1year, d1month-1, d1day);						var d2month = date2[1];						var d2day = date2[2];						var d2year = date2[0];						var d2 = new Date(d2year, d2month-1, d2day);						if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {							renderer = rArray[2];							if (workingDate.getTime()==d2.getTime()) { 								this.renderStack.splice(r,1);							}						}						break;					case YAHOO.widget.Calendar_Core.WEEKDAY:												var weekday = rArray[1][0];						if (workingDate.getDay()+1 == weekday) {							renderer = rArray[2];						}						break;					case YAHOO.widget.Calendar_Core.MONTH:												month = rArray[1][0];						if (workingDate.getMonth()+1 == month) {							renderer = rArray[2];						}						break;				}								if (renderer) {					cellRenderers[cellRenderers.length]=renderer;				}			}		}		if (this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]) > -1) {			cellRenderers[cellRenderers.length]=this.renderCellStyleSelected; 		}		if (this.minDate) {			this.minDate = YAHOO.widget.DateMath.clearTime(this.minDate);		}		if (this.maxDate) {			this.maxDate = YAHOO.widget.DateMath.clearTime(this.maxDate);		}		if (			(this.minDate && (workingDate.getTime() < this.minDate.getTime())) ||			(this.maxDate && (workingDate.getTime() > this.maxDate.getTime()))		) {			cellRenderers[cellRenderers.length]=this.renderOutOfBoundsDate;		} else {			cellRenderers[cellRenderers.length]=this.renderCellDefault;			}				for (var x=0;x<cellRenderers.length;++x) {			var ren = cellRenderers[x];			this.logger.log("renderer[" + x + "] for (" + workingDate.getFullYear() + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + ")", "cellrender");			if (ren.call(this,workingDate,cell) == YAHOO.widget.Calendar_Core.STOP_RENDER) {				break;			}		}				workingDate = YAHOO.widget.DateMath.add(workingDate, YAHOO.widget.DateMath.DAY, 1); // Go to the next day		if (workingDate.getDay() == this.Options.START_WEEKDAY) {			weekRowIndex += 1;		}		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);		if (c >= 0 && c <= 6) {			YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);		}		if ((c % 7) == 0) {			YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);		}		if (((c+1) % 7) == 0) {			YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);		}				var postDays = this.postMonthDays; 		if (postDays >= 7 && this.Options.HIDE_BLANK_WEEKS) {			var blankWeeks = Math.floor(postDays/7);			for (var p=0;p<blankWeeks;++p) {				postDays -= 7;			}		}				if (c >= ((this.preMonthDays+postDays+this.monthDays)-7)) {			YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);		}			this.logger.log("Final styles for (" + workingDate.getFullYear() + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + "): " + cell.className, "cellrender");	}		};
meta: 4707	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/4707/50c3492c4c3c825dbd3401e134a19ed46799c456/calendar-debug.js/buggy/www/resources/yui/calendar/calendar-debug.js