/**
 * Bureau 347 - Nicolas Ronsmans
 */


var newEventFade		=	600,
	newEventDelay		=	2000,
	tooltipTimer		=	undefined;

function newEventInit()
{
	var yPos = 265;//(352-($('#new-event').height()>>1));
	//$('#new-event').height() sometimes returns wrong value, probably because of cufon rendering
	
	$('#new-event').css({'top':yPos+'px', 'opacity':0}).hide();

	setTimeout(addNewEventListener, newEventDelay);
	setTimeout(showNewEvent, newEventDelay);
	tooltipTimer		=	setTimeout(hideNewEvent, 7000);
}

function showNewEvent(delay)
{
	delay = delay || 0;
	$('#new-event').stop(true).delay(delay).css('display', 'block').animate({'opacity':1},{queue:true,duration:newEventFade});
}

function hideNewEvent(delay)
{
	delay = delay || 0;
	$('#new-event').stop(true).delay(delay).animate({'opacity':0},{queue:true,duration:newEventFade,complete:function(){$('#new-event').hide(0);}});
}

function addNewEventListener()
{
	$('#new-event').hover(function()
	{
		showNewEvent();
	},function()
	{
		hideNewEvent();
	});

	$('a#lk-agenda-hover').hover(function()
	{
		showNewEvent(250);
	},function()
	{
		hideNewEvent(250);
	});
}

$(document).ready(function()
{

});

$(window).resize(function()
{
	
});

$(window).load(function()
{
	newEventInit();
});
