	$(document).ready(function() {
		$('.menu>li').hover(function() {
			$(this).children('ul').show();
			$(this).children('a').toggleClass('actif');
			
		}, function(){
			$(this).children('ul').hide();
			$(this).children('a').toggleClass('actif');
		});

		if($('#accueil').length) {
			accueil();
		}
	});
	

	
	function accueil() {	
		var intlargslider = 0;
		var intlargslide = 0;
		var intpos = 0;
		var intitmpos = 0;
		
		$('ul.slider>li>img').each(function() {
			intlargslider+= $(this).width();
			intlargslide = $(this).width();
		});
		$('ul.slider').width(intlargslider);
		$('#accueil>span>a:first').addClass('actif');
		
		$('#accueil>span>a').click(function() {
			var intpositm = $('#accueil a').index(this);
			var intsliderpos = -(intlargslide * intpositm);
			$(this).siblings().removeClass('actif');
			$(this).addClass('actif');
			$('ul.slider').animate({
				'margin-left': intsliderpos
			}, 1000 );	
			$(document).stopTime();
			$(document).everyTime(5000,slider);
			
			
			return false;
		});
		$(document).everyTime(5000,slider);
	}
	
	function slider() {
		var intlargslider = 0;
		var intlargslide = 0;
		$('ul.slider>li>img').each(function() {
			intlargslider+= $(this).width();
			intlargslide = $(this).width();
		});
		
		var intpos = parseInt($('ul.slider').css('margin-left'));
		intpos-= intlargslide;
		
		$('#accueil>span>a').removeClass('actif');
		if(intpos <= -intlargslider) {
			intpos =0;
		}
		intitmpos = (-intpos / intlargslide);
		$('#accueil>span>a:eq(' + intitmpos + ')').addClass('actif');
		$('ul.slider').animate({
			'margin-left': intpos	
		}, 1000 );
	}
