

$(document).ready(function() {	

	//Background color, mouseover and mouseout
	var colorOver ="#31b8da"
	//jolie couleur bleue 	var colorOver = '#31b8da';
	var colorOut = '#111';

	//Padding, mouseover
	var padLeft = '30px';
	var padRight = '30px';
	
	//Default Padding
	var defpadLeft = $('#menu3 li a').css('paddingLeft');
	var defpadRight = $('#menu3 li a').css('paddingRight');
		
	//Animate the LI on mouse over, mouse out
	$('#menu3 li').click(function () {	
		//Make LI clickable
		window.location = $(this).find('a').attr('href');
		
	}).mouseover(function (){
		
		//mouse over LI and look for A element for transition
		$(this).find('a')
		.animate( { paddingLeft: padLeft, paddingRight: padRight}, { queue:false, duration:200 } )
		.animate( { backgroundColor: colorOver }, { queue:false, duration:500 });
		//ligne du dessus gere la durée de l'effet

	}).mouseout(function () {
	
		//mouse oout LI and look for A element and discard the mouse over transition
		$(this).find('a')
		.animate( { paddingLeft: defpadLeft, paddingRight: defpadRight}, { queue:false, duration:200 } )
		.animate( { backgroundColor: colorOut }, { queue:false, duration:500 });
	});	
	
	//Scroll the menu3 on mouse move above the #sidebar_new_new layer
	$('#sidebar_new').mousemove(function(e) {

		//sidebar_new Offset, Top value
		var s_top = parseInt($('#sidebar_new').offset().top);		
		
		//sidebar_new Offset, Bottom value
		var s_bottom = parseInt($('#sidebar_new').height() + s_top);
	
		//Roughly calculate the height of the menu3 by multiply height of a single LI with the total of LIs
		var mheight = parseInt($('#menu3 li').height() * $('#menu3 li').length);
	
		//I used this coordinate and offset values for debuggin
		//$('#debugging_mouse_axis').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY);
		//$('#debugging_status').html(Math.round(((s_top - e.pageY)/100) * mheight / 2));
			
		//Calculate the top value
		//This equation is not the perfect, but it 's very close	
		var top_value = Math.round(( (s_top - e.pageY) /100) * mheight / 2);
		
		//Animate the #menu3 by chaging the top value
	});

	
});
	
