function Rebond (idElement, origine, amplitude, intervalle)
{
	// propriétés via paramètres
	this.idElement		= idElement;
	this.origine		= origine;
	this.amplitude		= amplitude;
	this.intervalle	= intervalle;

	// propriétés additionnelles
	this.style			= document.getElementById(this.idElement).style;
	this.trajectoire	= new Array ();
	this.curseur		= 0;
	this.tempo			= null;
	this.on				= false;

	// méthodes
	this.afficher 		= rebondir;
	this.masquer 		= cacher;
	this.cacher			= cacher;

	// modèle de trajectoire
	trajet = new Array (	1, 0.99, 0.96, 0.91, 0.84, 0.75, 0.64, 0.51, 0.36, 0.19, 0,
						 		0.11, 0.22, 0.31, 0.38, 0.45, 0.50, 0.55, 0.58, 0.59,
						 		0.58, 0.55, 0.50, 0.45, 0.38, 0.31, 0.22, 0.11, 0,
						 		0.07, 0.13, 0.18, 0.23, 0.27, 0.3, 0.33, 0.35, 0.36,
						  		0.35, 0.33, 0.3, 0.27, 0.23, 0.18, 0.13, 0.07, 0
						  		);
	
	// calcul de la trajectoire
	for (i=0; i<trajet.length; i++)
	{
		this.trajectoire[i] = parseInt(this.amplitude-(trajet[i]*this.amplitude));
	}
	
	function rebondir ()
	{

		if (!this.on)
		{
			this.style.display = "block";
			this.on = true;
		}		
		if (this.curseur != trajet.length)
		{
			this.style.top = this.trajectoire[this.curseur] + "px";
			this.curseur++;
			this.tempo = setTimeout (this.idElement + ".afficher ()", this.intervalle);
		}
		else
		{
			clearTimeout (this.tempo);
			this.curseur = 0;
		}
	}

	function cacher ()
	{
		this.on = false;
		this.style.display = "none";
		this.style.top = this.origine + "px";
		this.curseur = 0;
	}
}

function DpltLineaire (idElement, origineX, destinationX, decalageX, origineY, destinationY, decalageY, intervalle)
{
	// propriétés via paramètres
	this.idElement		= idElement;
	this.origineX		= origineX;
	this.destinationX	= destinationX;
	this.decalageX		= decalageX;
	this.origineY		= origineY;
	this.destinationY	= destinationY;
	this.decalageY		= decalageY;
	this.intervalle	= intervalle;

	// propriétés additionnelles
	this.style			= document.getElementById(this.idElement).style;
	this.tempo			= null;
	this.on				= false;
	this.curseurX		= 0;
	this.curseurY		= 0;

	// méthodes
	this.afficher		= afficher;
	this.masquer		= masquer;
	this.cacher			= cacher;

	// initialisation
	with (this)
	{
		style.left = origineX + "px";
		style.top  = origineY + "px";
		curseurX = origineX;
		curseurY = origineY;
	}	
	
	function afficher ()
	{
		if (!this.on)
		{
			this.style.display = "block";
			this.on = true;
		}

		if (this.destinationX != this.curseurX || this.destinationY != this.curseurY)
		{
			this.origineX < this.destinationX ? this.curseurX += this.decalageX : this.curseurX -= this.decalageX;
			this.origineY < this.destinationY ? this.curseurY += this.decalageY : this.curseurY -= this.decalageY;
			this.style.left = this.curseurX + "px";
			this.style.top  = this.curseurY + "px";
			this.tempo = setTimeout (this.idElement + ".afficher ()", this.intervalle);
		}
		else
		{
			clearTimeout (this.tempo);
		}
	}

	function masquer ()
	{
		if (this.origineX != this.curseurX || this.origineY != this.curseurY)
		{
			this.origineX > this.destinationX ? this.curseurX += this.decalageX : this.curseurX -= this.decalageX;
			this.origineY > this.destinationY ? this.curseurY += this.decalageY : this.curseurY -= this.decalageY;
			this.style.left = this.curseurX + "px";
			this.style.top  = this.curseurY + "px";
			this.tempo = setTimeout (this.idElement + ".masquer ()", this.intervalle);
		}
		else
		{
			clearTimeout (this.tempo);
			this.on = false;
			this.style.display = "none";
			this.curseurX = this.origineX;
			this.curseurY = this.origineY;
		}
	}

	function cacher ()
	{
		this.on = false;
		this.style.display = "none";
		this.curseurX = this.origineX;
		this.curseurY = this.origineY;
	}
}

