// JavaScript Document
var j = jQuery.noConflict();

j(document).ready(function()
{
	var d = new Date();
	var y = d.getFullYear();
	var m = d.getMonth();
	
	var mycal = j('#calendar').fullCalendar({
		editable: false,
		header: {
			left: 'prev,next today',
			center: 'title',
			right: ''
		},
		events: function(start, end, callback) {
		
			// do some asynchronous ajax
			// bmb
			j.getJSON("/wp-content/plugins/kino-event-calendar-plugin/ke-rpc.php",
			{
				action: "ke_get_events",
				start: start.getTime(),
				end: end.getTime()			},
			function(result)
			{
				// format the result into an array of CalEvents
				calevents = result;
				
				// then, pass the CalEvent array to the callback
				callback(calevents);
			
			});
		
		}

	});
	
	j(".event-link").live("click", function()
	{
		var event_id = j(this).attr('class').split(' ').slice(-1);
		
		// ON THE FRONT-END THIS WOULD BE THE TIME TO REDIRECT THE USER TO THE PAGE WITH THE EVENT
		
	});
	
	
	j("body").append("<div id='event-tooltip'></div>");
	
	// EQUALISE THE CALENDAR CELL WIDTHS
	j(".fc td,.fc th").width("14%");
	
});
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
