/*
jquery hover script for jinies calendar
-d.meehan (5/2010)
*/
$(function () {
	// hide all mouseover boxes by default
	$(".hidden-hover").each( function() {
		$(this).hide(); 
	} );
	
	// delegate all .hidden-hover w/ click evt		
	$('.calnk').delegate(".hidden-hover", "click", function() {
		window.location = 'http://' + window.location.hostname + $(this).prev().attr("href"); // append the href from the sibling of the hidden-hover element to the current browser location
	});
	
	// register rollover show evt
	$(".calnk").mouseenter(function (e) {		
		if ( $(this).find(".hidden-hover").is(":visible") ) {
			return; //already showing it
		}
		// position the box in relation to the current x/y of the .event-title class
		$(this).find(".hidden-hover").css({  
			"position": "absolute",  
			"top": $(this).offset().top - 50,
			"left": $(this).offset().left + ( $(this).find(".event-title").text().length - 315 ) 				
		});						
		$(this).find(".hidden-hover").show();
	});		
	
	// register rollout hide evt w/ a slight delay
	$(".calnk").mouseleave(function () {
		$(this).find(".hidden-hover").delay(1600).hide();
	});
});