var imageCourante=1;
var bgPosition = imageCourante*86;
var stop = 0;




function animePapillon(){
    setTimeout(function() {
        $('#papillon').css('left', '-'+ bgPosition +'px');
		imageCourante = (imageCourante+1) % 7;
		if (imageCourante == 7) imageCourante = 3;
		bgPosition = imageCourante*86;
		if (stop == 0) animePapillon();
    }, 100);
}
function changePosition(){
	// mouvement ailes du papillon
	animePapillon();
	//afficher le papillon
		setTimeout(function() {$('#actor').show(); }, 1000);
	// afficher le titre 
	setTimeout(function() { $('#title').animate({opacity: 'show' }, 2000); }, 2000);
	// deplacer le papillon
	$('#actor').animate({left: '300px', top: '338px'}, 3500);
	// redeplacer le papillon
	setTimeout(function() { $('#actor').animate({left: '0px', top: '650px'}, 3000); }, 6500);
	// masquer le titre
	setTimeout(function() { $('#title').animate({opacity: 'hide' }, 1000); }, 9000);
	//masquer le papillon
	setTimeout(function() { $('#actor').hide();
                           $('#mainPapillon').hide(); }, 9000);
	//arretez le papillon
	setTimeout(function() { stop = 1; $('#menu').fadeIn('slow')}, 9700);

}

