$(document).ready(function() {
	$('div.calendar-wrapper div.calendar-header select').livequery(function() {
		$(this).change(function(event) {
			monthValue = $(this).parent().find("select[name='monthSelector']").val();
			yearValue = $(this).parent().find("select[name='yearSelector']").val();
			calLocation = $(this).closest('div.calendar-wrapper').attr('rel').split('location:')[1].split(']')[0];
			$(this).closest('div.calendar-wrapper').find('div.calendar-body').load('/_cfcs/calendar.cfc?method=changeMonthRemote', {day: 1, month: monthValue, year: yearValue, location: calLocation}, function() {
			});
		});
	});
	
	$('div.calendar-wrapper').livequery(function() {
		var calendarWidth = 0;
		$('div.calendar-header div.day', this).each(function() {
			if(navigator.appName == 'Netscape')
				var borderWidth = 0;
			else
				var borderWidth = parseInt($(this).css('border-left')) + parseInt($(this).css('border-right'));
			
			calendarWidth += parseInt($(this).width()) + borderWidth;
		});
		
		if(navigator.appName == 'Netscape')
			calendarWidth += 8;
			
		$(this).width(calendarWidth);
	});
});
