
// Choix de l'utilisateur
choice_home = 1;
time_change_home = 5000;
time_move_background = 500;



function cacheTexte() {
	$('.text-home h1').css('display','none');
	$('.text-home p').css('display','none');
	$('.accroche').css('display','none');
}

function afficheTexte() {
		$('#text'+choice_home+'-home h1').fadeIn(200);
		$('#text'+choice_home+'-home p').fadeIn(200);
		$('#textacc'+choice_home).show();
}

function changeHome() {	
	cacheTexte();
	$('#little-image'+choice_home+' img').stop().animate({
		width: '67px',
		height: '50px',
		marginLeft: '0',
		marginTop: '0'
	}, time_move_background);
	choice_home++;
	if(choice_home>$('.little-image').length) {
		choice_home=1;
	}
	$('#font-home').stop().animate({
		 marginLeft:-(980*(choice_home-1))+'px'
	},time_move_background);
	setTimeout("afficheTexte()", 500);
	$('#little-image'+choice_home+' img').stop().animate({
		width: '90px',
		height: '67px',
		marginLeft: '-11.5px',
		marginTop: '-8.5px'
	}, time_move_background);
}

$(document).ready(function() {
	$('#font-home').css('marginLeft',-(980*(choice_home-1))+'px');
	setTimeout("afficheTexte()", 500);
	$('#little-image'+choice_home+' img').css('width','90px');
	$('#little-image'+choice_home+' img').css('height','67px');
	$('#little-image'+choice_home+' img').css('marginLeft','-11.5px');
	$('#little-image'+choice_home+' img').css('marginTop','-8.5px');
	
	timer_choice_home=setInterval('changeHome()', time_change_home);
	
	$('.little-image').click(function() {
		
		if(this.id.charAt(12)!=choice_home) {
			cacheTexte();
			$('#little-image'+choice_home+' img').stop().animate({
				width: '67px',
				height: '50px',
				marginLeft: '0',
				marginTop: '0'
			}, time_move_background);
			choice_home= this.id.charAt(12);
			if(this.id.charAt(12)>$('.little-image').length) {
				choice_home=1;
			}
			$('#font-home').stop().animate({
				 marginLeft:-(980*(choice_home-1))+'px'
			},time_move_background);
			
		afficheTexte();
			$('#little-image'+choice_home+' img').stop().animate({
				width: '90px',
				height: '67px',
				marginLeft: '-11.5px',
				marginTop: '-8.5px'
			}, time_move_background);
		}
	});
	
	
	$('.little-image').mouseenter(function() {
				clearInterval(timer_choice_home);
	});
	
	$('.little-image').mouseleave(function() {
		timer_choice_home=setInterval('changeHome()', time_change_home);
	});
	
	
	
	});
