$(document).ready(function() {
						   
	// RollOver liste prochains évènements 
	$(".listeEvenements > li").hover(function(){
  		$(this).css("background-color", "#f6f6f6");
		},function(){
  		$(this).css("background-color", "#ffffff");
	});
	
	// Rollover cases de l'agenda
	getTip();
	
});

function getTip(){	
	$('.agendaEvent').hover(
	function () {showTip(this)},
	function () {hideTip(this)});
}
	
function showTip(elem){	
	$("body").bind('mousemove',{thisObj: this},mouseIsMoving);
	if(msie==true){
		$(elem).find('.agendaTip').oneTime(500, "show", function() {
		$(elem).find('.agendaTip').width(divX);
		$(elem).find('.agendaTip').height(divY);
		$(elem).find('.agendaTip').css("display","block");
		});
	} else {
		$(elem).find('.agendaTip').oneTime(500, "show", function() {
		$(elem).find('.agendaTip').width(divX);
		$(elem).find('.agendaTip').height(divY);
		$(elem).find('.agendaTip').css("opacity",0);
		$(elem).find('.agendaTip').css("display","block");
		$(elem).find('.agendaTip').animate({opacity: 1}, 500);
		});
	}
}
	
function hideTip(elem){
	if(msie==true){
		$(elem).find('.agendaTip').stopTime("show");
		$(elem).find('.agendaTip').stop();
		$(elem).find('.agendaTip').css("display","none");
		
	} else {
		$(elem).find('.agendaTip').stopTime("show");
		$(elem).find('.agendaTip').stop();
		$(elem).find('.agendaTip').fadeOut("fast",function (){
		$(elem).find('.agendaTip').css("opacity",0);
		$(elem).find('.agendaTip').css("display","none");
		});
	}
	$("body").unbind('mousemove');
}
	
function mouseIsMoving(e){
	thisObj =e.data.thisObj;
	var Y=e.clientY+25;
	var X=e.clientX+15;
	calculPosition(X,Y,divY);
}
	
function calculPosition(X,Y,thisObj){
		var divY=$(thisObj).find('.agendaTip').height();
		var bodyY=$(window).height();
		var bodyX=$(window).width();
		var scrollY=$(window).scrollTop();
		var scrollX=$(window).scrollLeft();
		Y=Y+scrollY;
		X=X+scrollX;
		var margeY=8;
		var margeX=8;
		var testY=Y+divY+margeY;
		var testX=X+divX+margeX;
		bodyY=bodyY+scrollY;
		bodyX=bodyX+scrollX;
		var maxY=bodyY-divY-margeY;
		var maxX=bodyX-divX-margeX;
		if(testY>bodyY){Y=maxY;}
		if(testX>bodyX){X=X-divX-margeX-40;}
		$(thisObj).find('.agendaTip').css('top',Y);
		$(thisObj).find('.agendaTip').css('left',X);
}
	
	var divY;
	var divX=315;
	var msie = $.browser.msie();
