/*
$Log: menu.js,v $
Revision 1.1.1.1  2006/01/29 13:44:55  francois
v2 - nouveau graphisme
*/

function afficher (menu)
{
	if (!menu.on)
	{
		if (sousMenuCompagnie.on) sousMenuCompagnie.cacher ();
		if (sousMenuToutPublic.on) sousMenuToutPublic.cacher ();
		if (sousMenuJeunePublic.on) sousMenuJeunePublic.cacher ();
		if (sousMenuYourte.on) sousMenuYourte.cacher ();
		if (sousMenuResidences.on) sousMenuResidences.cacher ();
		menu.afficher ();
	}
} 

/*
	DeplacementLineaire
*/
function DeplacementLineaire (idElement, origineX, destinationX, offsetX, origineY, destinationY, offsetY)
{
	this.idElement		= idElement;
	this.origineX		= origineX;
	this.destinationX	= destinationX;
	this.offsetX		= offsetX;
	this.origineY		= origineY;
	this.destinationY	= destinationY;
	this.offsetY		= offsetY;
	this.style			= document.getElementById(this.idElement).style;
	this.tempo			= null;
	this.on				= false;
	this.curseurX		= 0;
	this.curseurY		= 0;
	this.afficher		= afficher;
	this.cacher			= cacher;

	with (this)
	{
		style.left = origineX + "px";
		style.top  = origineY + "px";
		curseurX = origineX;
		curseurY = origineY;
	}	

	function afficher ()
	{
		this.style.display = "block";

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

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

