$.fn.betterTooltip = function(options){

	var defaults = {
		speed: 250,
		delay: 250,
		load: '../wp-content/themes/default/calendar-tooltips.php'
	};
	var tt = this;

	tt.options = $.extend(defaults, options);

	$(tt).each(function(){
		$(this).hover(function(e){
			$tip = $('<div id="tip"></div>').prependTo('body');
			var date = $(this).attr('name');
			var loading = '<span class="tt_header">Loading...</span>';
			var tipWidth = $tip.outerWidth(true);			
			$tip.css({'top':e.pageY-75,'left':e.pageX-tipWidth-25});
			tt.showTipTimer = setInterval('showTip()', tt.options.delay);
			$tip.html(loading).load(tt.options.load, 'date='+date);
		}, function() {
			clearInterval(tt.showTipTimer);
			$tip.remove();
		});		   
	
		showTip = function(){
			clearInterval(tt.showTipTimer);
			$tip.animate({'top':'+=20px','opacity':'toggle'}, tt.options.speed);
		}
	});
};
