jQuery.fn.loadEventCalendar = function()
{
	/*	cargamos por ajax el html	*/
	$(this).click(function(){
		thisHref = $(this).attr('href');
		overLopNow();
		$('#eventCont').load(thisHref,'html');
		$('#eventCont #evento-actual').focus();
		return false;
	});
	
	/*	formateamos y damos efecto al div overLop	*/
	function overLopNow()
	{
		var alto = $('.calendario').height();
		var ancho = $('.calendario').width();	
		
		$('#overlop').css({
			opacity: 0,
			'z-index': 1
		});
		$('#overlop').height(alto);
		$('#overlop').width(ancho);
		$('#overlop').fadeTo("slow", 0.7);						
	};
};

function cleanAndClose()
{
	$('#overlop').fadeTo("slow", 0, function(){ $('#overlop').height('1px'); });		
	$('#eventCont .event').hide();
	return false;
};

function imprimir()
{
	window.print();
	return false;
};

$(document).ready(function(){
	/* cambiamos el valor de href para cargar la data	*/
	
	
	$('a.event').each(function(){
		var elHref = $(this).attr('href');
		var niuHref = elHref.split('detalles').join('event');
		$(this).attr({
			href: niuHref
		});	
	});
	
	
	/* llamamos al calendario	*/
	$('a.event').loadEventCalendar();
});