	$(document).ready(function() {
	
		// MenuHaut2
		$.localScroll.defaults.axis = 'x';
		
		// Scroll initially if there's a hash (#something) in the url 
		$.localScroll.hash({
			target: '#content', // Could be a selector or a jQuery object too.
			queue:true,
			duration:1500
		});
			
		/* Récupére le hash en live  et scroll au click */
		$('#navigation').localScroll({
			target: '#content',
			duration: 500,
			event: 'click'
		});
		
		/* Récupére le hash en live  et scroll au mouseover */
		$('#navigation').localScroll({
			target: '#content',
			duration: 500,
			event: 'mouseover'
		});
	
		function selectNav() {
		  $(this)
			.parents('ul:first')
			  .find('a')
				.removeClass('selected')
			  .end()
			.end()
			.addClass('selected');
		}

		$('#slider #navigation').find('a').mouseover(selectNav);

		function trigger(data) {
		  var el = $('#slider #navigation').find('a[href$="' + data.id + '"]').get(0);
		  selectNav.call(el);
		}

		// Si il y a un hash
		if (window.location.hash) {
		  trigger({ id : window.location.hash.substr(1) });
		} else {
			var el = $('#slider #navigation').find('a[href$="#occasion"]').get(0);
			selectNav.call(el);
		}

	});
