$(function(){
//Menu
	var colorOver='#f3f9f5';var colorOut='#93b7d8';
	var padLeft='20px';var padRight='20px';
	var defpadLeft=$('#menu li a').css('paddingLeft');var defpadRight=$('#menu li a').css('paddingRight');//Default Padding
	$('#menu li').click(function(){//Animate the LI on mouse over, mouse out
		window.location = $(this).find('a').attr('href');//Make LI clickable
	}).mouseover(function(){
		$(this).find('a')//mouse over LI and look for A element for transition
		.animate({paddingLeft:padLeft,paddingRight:padRight},{queue:false,duration:100})
		.animate({backgroundColor:colorOver},{queue:false,duration:200})
		.animate({color:colorOut},{queue:false,duration:200});
	}).mouseout(function(){
		$(this).find('a')//mouse out LI and look for A element and discard the mouse over transition
		.animate({paddingLeft:defpadLeft,paddingRight:defpadRight},{queue:false,duration:100})
		.animate({backgroundColor:colorOut},{queue:false,duration:200})
		.animate({color:colorOver},{queue:false,duration:200});
	});
	$('#nav').mousemove(function(e){//Scroll the menu on mouse move above the #nav layer
		var s_top = parseInt($('#nav').offset().top);//nav Offset, Top value
		var s_bottom = parseInt($('#nav').height()+s_top);//nav Offset, Bottom value
		var mheight = parseInt($('#menu li').height() * $('#menu li').length);//Roughly calculate the height of the menu
		$('#debugging_mouse_axis').html("X Axis : "+e.pageX +" | Y Axis "+e.pageY);//I used this coordinate and offset values for debuggin
		$('#debugging_status').html(Math.round(((s_top-e.pageY)/100)*mheight/2));
		//Calculate the top value
		var top_value=Math.round(((s_top-e.pageY)/100)*mheight/10)+10;//This equation is not the perfect, but it 's very close
		$('#menu').animate({top:top_value},{queue:false,duration:500});//Animate the #menu by chaging the top value
	});
//Tarifs Slider
	function formatText(index,panel){return index+"";}
	$('.anythingSlider').anythingSlider({
		easing: "easeInOutExpo",// Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: true,			// This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 5000,			// How long between slide transitions in AutoPlay mode
		startStopped: false,	// If autoPlay is on, this can force it to start stopped
		animationTime: 600,		// How long the slide transition takes
		hashTags: true,			// Should links change the hashtag in the URL?
		buildNavigation: true,	// If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,		// If true, and autoPlay is enabled, the show will pause on hover
		startText: "Go",
		stopText: "Stop",
		navigationFormatter: formatText// Details at the top of the file on this use (advanced use)
	});
	$('.anythingSliderAccueil').anythingSlider({
		easing: "easeInOutExpo",// Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: false,		// This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 5000,			// How long between slide transitions in AutoPlay mode
		startStopped: false,	// If autoPlay is on, this can force it to start stopped
		animationTime: 600,		// How long the slide transition takes
		hashTags: true,			// Should links change the hashtag in the URL?
		buildNavigation: true,	// If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,		// If true, and autoPlay is enabled, the show will pause on hover
		startText: "Go",
		stopText: "Stop",
		navigationFormatter: formatText// Details at the top of the file on this use (advanced use)
	});
	$('#slide-jump').click(function(){$('.anythingSlider').anythingSlider(4);});
	$('#slide-jump').click(function(){$('.anythingSliderAccueil').anythingSlider(4);});
	
//Disponibilité
	$('#MH4 span:gt(0):contains(1),#MH46 span:gt(0):contains(1),#MH4ss span:gt(0):contains(1),#MH4 span:gt(0):contains(2),#MH46 span:gt(0):contains(2),#MH4ss span:gt(0):contains(2)').css('backgroundColor','#ffcb3f');
	$('#MH4 span:gt(0):contains(0),#MH46 span:gt(0):contains(0),#MH4ss span:gt(0):contains(0)').css('backgroundColor','#cf1920');
//Map
	$("#map1").gMap({markers:[	{latitude:43.309066,longitude:3.541632,icon:{image:"http://www.campinglerieu.fr/wp-content/themes/camping/images/CampingLeRieu-icon.png", 
									iconsize: [100,61],iconanchor:[50,30],infowindowanchor:[15,18]},
									html:"Camping Le Rieu<br/>174 Chemin du Payrollet<br/>34340 Marseillan<br/>04 67 21 92 58<br/>",popup:true},
								{latitude:43.315066,longitude:3.565632,icon:{image:"http://www.campinglerieu.fr/wp-content/themes/camping/images/icon-plage.jpg",
									iconsize:[50,50],iconanchor:[0,0],infowindowanchor:[0,0]},
									html:"la plage est &agrave; 2 pas"},
								{latitude:43.354143,longitude:3.530208,icon:{image:"http://www.campinglerieu.fr/wp-content/themes/camping/images/icon-marseillan.jpg",
									iconsize:[50,50],iconanchor:[-35,35],infowindowanchor:[0,0]},
									html:"Marseillan"}],
		latitude:43.325066,longitude:3.541632,zoom:12,maptype:G_HYBRID_MAP});
});