rem: if (! weekStartsOn) { weekStartsOn = 0; } if (! calendarYear) { calendarYear = date.getFullYear(); }  var weekNum = -1;  var jan1 = this.getJan1(calendarYear); 
add: var jan1 = new Date(nearestThurs.getFullYear(),0,1); var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / this.ONE_DAY_MS) - 1; 
context: 	this.getWeekNumber = function(date, calendarYear, weekStartsOn) {		date.setHours(12,0,0,0);		if (! weekStartsOn) {			weekStartsOn = 0;		}		if (! calendarYear) {			calendarYear = date.getFullYear();		}				var weekNum = -1;				var jan1 = this.getJan1(calendarYear);		var jan1Offset = jan1.getDay() - weekStartsOn;		var jan1DayOfWeek = (jan1Offset >= 0 ? jan1Offset : (7 + jan1Offset));		var endOfWeek1 = this.add(jan1, this.DAY, (6 - jan1DayOfWeek));		endOfWeek1.setHours(23,59,59,999);		var month = date.getMonth();		var day = date.getDate();		var year = date.getFullYear();				var dayOffset = this.getDayOffset(date, calendarYear); // Days since Jan 1, Calendar Year					if (dayOffset < 0 || this.before(date, endOfWeek1)) {			weekNum = 1;		} else {			weekNum = 2;			var weekBegin = new Date(endOfWeek1.getTime() + 1);			var weekEnd = this.add(weekBegin, this.WEEK, 1);			while (! this.between(date, weekBegin, weekEnd)) {				weekBegin = this.add(weekBegin, this.WEEK, 1);				weekEnd = this.add(weekEnd, this.WEEK, 1);				weekNum += 1;			}		}				return weekNum;	};
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