function animateAccueil()
{
	$("#accueil_anim_1").animate({opacity:0}, 0);
	$("#accueil_anim_2").animate({opacity:0}, 0);
	$("#accueil_anim_3").animate({opacity:0}, 0);
	$("#accueil_anim_4").animate({opacity:0}, 0);
	$("#accueil_anim_5").animate({opacity:0}, 0);
	//$("#accueil_anim_logo").animate({opacity:0}, 0);

	AnimateRight("#accueil_anim_1", function() {
		AnimateLeft("#accueil_anim_2", function () {
			AnimateLeft("#accueil_anim_3", function () {
				AnimateRight("#accueil_anim_4", function () {
					AnimateLeft("#accueil_anim_5", function () {
						//StaccatoVisibility(true, function () {
							animateAccueil();
						//});
					});
				});
			});
		});
	});
}

function AnimateRight(id, ondone) {
	$(id).animate({
		opacity:1,
		right: '+=50'
	}, 2000, function() {
		$(id).animate({
			opacity:0,
			right: '+=50'
		}, 2000, function() {
			$(id).animate({right:'-=100'}, 0);

			if(ondone != null) {
				ondone();
			}
		});
	});
}
function AnimateLeft(id, ondone) {
	$(id).animate({
		opacity:1,
		left: '+=50'
	}, 2000, function() {
		$(id).animate({
			opacity:0,
			left: '+=50'
		}, 2000, function() {
			$(id).animate({left:'-=100'}, 0);

			if(ondone != null) {
				ondone();
			}
		});
	});
}

var _i = 0;
function StaccatoVisibility(show, ondone) {
	if(show) {
		$("#accueil_anim_logo").animate({opacity:1, width:"+=4", height:"+=4", left:"-=2", top:"-=2"}, 0);
	}
	else {
		$("#accueil_anim_logo").animate({opacity:0, width:"+=4", height:"+=4", left:"-=2", top:"-=2"}, 0);
	}

	setTimeout(function () {
		if(_i < 50) {
			_i++;
			StaccatoVisibility(!show, ondone);
		}
		else {
			_i = 0;
			$("#accueil_anim_logo").animate({width:"+=100", height:"+=100", left:"-=50", top:"-=50", opacity:0}, 2000, function ()
			{
				$("#accueil_anim_logo").animate({width:"-=300", height:"-=300", left:"+=150", top:"+=150"}, 0);

				if(ondone != null) {
					ondone();
				}
			});
		}
	}, 40);
}
