
var Div_IMG = document.getElementById("ID_Animation").style;

var coord;
var coord_x = 0;
var coord_y = 0;
var delta   = 0;

var offsetx;

if (navigator.appName == "Microsoft Internet Explorer") {
	tailley = document.body.clientHeight;
	taillex = document.body.clientWidth;
	offsety = document.body.scrollTop;
	offsetx = document.body.scrollLeft;
} else {
	tailley = window.innerHeight;
	taillex = window.innerWidth;
	offsety = window.pageYOffset;
	offsetx = window.pageXOffset;
}

if (navigator.appName == "Microsoft Internet Explorer") {
	taillex = document.body.clientWidth;
} else {
	taillex = window.innerWidth;
}

if ( taillex > 820 ) {
	coord_x = 810 + (taillex-820) / 2 - document.getElementById("ID_Animation").offsetWidth /2;
} else {
	coord_x = 810 - document.getElementById("ID_Animation").offsetWidth /2 ;
}

var maxi;

maxi = 10 + document.getElementById("Div_Bottom").offsetTop;
maxi = maxi + document.getElementById("Div_Bottom").offsetHeight;
maxi = maxi - document.getElementById("ID_Animation").offsetHeight;
maxi = maxi - 70;

//Par defaut IdA
var name_img = document.getElementById("ID_Animation").getAttribute('name')

if ( name_img == "IdT") {
	coord_x = coord_x - 100;
	maxi    = maxi - 85;
} else if ( name_img == "IdA") {
	coord_x = coord_x - 100;
	maxi    = maxi - 62;
} else if ( name_img == "IdA_AAF") {
	coord_x = coord_x - 225;
	maxi    = maxi - 25;
} else if ( name_img == "IdA_ADS") {
	coord_x = coord_x - 150;
	maxi    = maxi - 85;
} else if ( name_img == "IdA_ADF") {
	coord_x = coord_x - 100;
	maxi    = maxi - 85;
}
coord_y = maxi;

var stop = 200;

var Vlr_Opa = 10; // @TL@HF28 was 0

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  alert( 'Width = ' + myWidth );
  alert( 'Height = ' + myHeight );
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if ( opacStart > opacEnd ) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
	var object = document.getElementById(id).style; 
	object.visibility = "visible";
	object.opacity = (opacity / 100); 
	object.MozOpacity = (opacity / 100); 
	object.KhtmlOpacity = (opacity / 100); 
	object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function Apparition_CallBack() {

	document.body.onresize = function () {
		if (navigator.appName == "Microsoft Internet Explorer") {
			taillex = document.body.clientWidth;
		} else {
			taillex = window.innerWidth;
		}

		if ( taillex > 820 ) {
			Div_IMG.pixelLeft = 810 + (taillex-820) / 2 - document.getElementById("ID_Animation").offsetWidth /2;
		} else {
			Div_IMG.pixelLeft = 810 - document.getElementById("ID_Animation").offsetWidth /2;
		}
		if ( name_img == "IdT") {
			Div_IMG.pixelLeft = Div_IMG.pixelLeft - 100;
		}
		if ( name_img == "IdA_DS") {
			Div_IMG.pixelLeft = Div_IMG.pixelLeft - 183;
		}
		if ( name_img == "IdA_DF") {
			Div_IMG.pixelLeft = Div_IMG.pixelLeft - 264;
		}
		Div_IMG.left = Div_IMG.pixelLeft + "px";
	}

	Vlr_Opa = Vlr_Opa + 1;
	if ( Vlr_Opa > 100 ) Vlr_Opa = 100;
	if ( Vlr_Opa > 0 ) {
		changeOpac( Vlr_Opa, "ID_Animation");
	}
	
	//coord_x = offsetx + 10;
	coord_y = coord_y + delta;

	if ( coord_y > maxi ) {
		coord_y = maxi;
		delta = -delta/1.75;
		if ( delta * delta < 2 ) stop = stop - 1;;
		delta = delta + 1;
	} else {
		delta = delta + 1;
	}

	Div_IMG.pixelLeft = coord_x;
	Div_IMG.pixelTop  = coord_y;

	Div_IMG.left = Div_IMG.pixelLeft + "px";
	Div_IMG.top  = Div_IMG.pixelTop  + "px";

		if ( stop > 1 ) {
		tempo = setTimeout("Apparition_CallBack()", 15);
	}
}

var Previous_Onload = (window.onload) ? window.onload : function(){};

window.onload = function() { 
	Previous_Onload();
	Apparition_CallBack();
}
