

dojo.require( "dojo.fx" );
dojo.require("dojo.fx.easing");



// Fait disparaître les éléments.
function anim_0()
{

	var my_duration = 500;

	var my_anim = new Array();

	my_anim[ 0 ] = dojo.fadeOut
	({
		node: "banner_logo_ihs",
		duration: my_duration
	});

	my_anim[ 1 ] = dojo.fadeOut
	({
		node: "banner_femme",
		duration: my_duration
	});

	my_anim[ 2 ] = dojo.fadeOut
	({
		node: "banner_url_ihs",
		duration: my_duration
	});

	return dojo.fx.combine( my_anim );

}



// Déplace les élément à la position d'origine du mouvement final.
function anim_1()
{

	console.log( "this.banner_femme_pos.x = ", this.banner_femme_pos.x );
	console.log( "this.banner_femme_pos.y = ", this.banner_femme_pos.y );

	var my_duration = 1000;

	var my_anim = new Array();

	my_anim[ 0 ] = dojo.fx.slideTo
	({
		node: "banner_femme",
		duration: my_duration,
		left: 0,
		top: this.banner_femme_pos.y,
		unit: "px"
	});

	my_anim[ 1 ] = dojo.fx.slideTo
	({
		node: "banner_url_ihs",
		duration: my_duration,
		left: 0,
		top: this.banner_url_ihs_pos.y,
		unit: "px"
	});

	return dojo.fx.combine( my_anim );

}


// Fait apparaître les éléments.
function anim_2()
{

	var my_duration = 1000;

	var my_anim = new Array();

	my_anim[ 0 ] = dojo.fadeIn
	({
		node: "banner_logo_ihs",
		duration: my_duration
	});

	my_anim[ 1 ] = dojo.fadeIn
	({
		node: "banner_femme",
		duration: my_duration
	});

	my_anim[ 2 ] = dojo.fadeIn
	({
		node: "banner_url_ihs",
		duration: my_duration
	});

	return dojo.fx.combine( my_anim );

}


// Déplacement final
function anim_3()
{

	console.log( "this.banner_femme_pos.x = ", this.banner_femme_pos.x );
	console.log( "this.banner_femme_pos.y = ", this.banner_femme_pos.y );

	var my_duration = 1000;
	var delta_x = 0;

	var my_anim = new Array();

	my_anim[ 0 ] = dojo.fx.slideTo
	({
		node: "banner_femme",
		duration: my_duration,
		left: 700,
		top: this.banner_femme_pos.y,
		unit: "px"
	});

	my_anim[ 1 ] = dojo.fx.slideTo
	({
		node: "banner_url_ihs",
		duration: my_duration * 2,
		left: 600,
		top: this.banner_url_ihs_pos.y,
		unit: "px"
	});

	return dojo.fx.combine( my_anim );

}


function playSequence()
{

	this.banner_femme_pos   = dojo.position( 'banner_femme',   false );
	this.banner_url_ihs_pos = dojo.position( 'banner_url_ihs', false );

	var my_seq = new Array();
	my_seq[ 0 ] = anim_0();
	my_seq[ 1 ] = anim_1();
	my_seq[ 2 ] = dojo.fx.combine( [ anim_2(), anim_3() ]);

	var my_sequence = dojo.fx.chain( my_seq );
	my_sequence.play();
}


dojo.addOnLoad( function()
{
	playSequence();
});

