jQuery(document).ready(function($){

	//add hover box to show calendar events
	$('td.has-event a').mouseover(function(e){
		var x = e.pageX - this.offsetLeft;
		var y = e.pageY - this.offsetTop;
		$(this).children('div.calendar-event-summaries').show().css({'left':x,'top':y});

		$(this).mousemove(function(e){
			var x = e.pageX - this.offsetLeft + 15;
			var y = e.pageY - this.offsetTop ;
			$(this).children('div.calendar-event-summaries').css({'left':x,'top':y});
		});	

	});

	//hide hover box when mouse leaves event cell
	$('td.has-event a').mouseout(function(){
		$(this).children('div.calendar-event-summaries').hide();
	});

	//change calendar type automatically
	$('form#edge_calendar_switcher input[type=submit]').hide();
	$('form#edge_calendar_switcher select').change(function(){
		 $(this).parent('form').submit();
	});

	//There's no current css class created for authors
	//so We'll check for any matching author links and make them current
	url = window.location;
	$('.widget_authors a[href='+url+']').parent('li').addClass('current');

});
