CalendarViewLogoutHandler = Class.createWithSharedInstance('calendarLogoutHandler', true);
CalendarViewLogoutHandler.prototype = {
	initialize: function() {
		if (!$('module_calendars')) return invalidate;
		publisher().subscribe(this.handleLoggedOut, 'LOGGED_OUT');
		calendarViewController().previous_getAppointmentsFromServer = calendarViewController().getAppointmentsFromServer;
		calendarViewController().getAppointmentsFromServer = function() {
			if (this.mTimer) {
				clearTimeout(this.mTimer);
				delete this.mTimer;
			}
			var successCallback = function() {
				calendarViewController().previous_getAppointmentsFromServer();
			}
			this.mLastSessionRequest = new XMLRPCRequest(server(), 'checkSessionAuthorization', [successCallback, this.handleLoggedOut], 'read', uid().mBasePath);
		}
	},
	handleLoggedOut: function() {
		notifier().printAtPage('session_expired');
	}
}
