
var Events = {
	
	// Changes to a relative calendar.
	change_calendar:function(year_change,month_change) {
		var year = Events.year + (year_change==undefined ? 0 : year_change);
		var month = Events.month + (month_change==undefined ? 0 : month_change);
		Events.load_calendar(year,month);
	},
	
	// Creates a new event.
	create:function() {
		Container.show_popup('event_editor');
	},
	
	// Loads a calendar for a specific month and year.
	load_calendar:function(year,month) {
		if(year==undefined) year = Events.year;
		if(month==undefined) month = Events.month;
		Container.refresh_container('calendar',year+'-'+(month<10 ? '0' : '')+month);
	},
	
	// Modifies an existing event.
	modify:function(event_id) {
		Container.show_popup('event_editor',event_id);
	},
	
	// Refreshes the current calendar.
	refresh_calendar:function() {
		Events.change_calendar(0,0);
	},
	
	// Shows the details for an event.
	show_details:function(event_id) {
		Container.show_popup('event_details',event_id);
	}
	
}