function slow(quoi,sens)
{
	var zobj=Move.getzobj(quoi);
	var obj = document.getElementById(quoi);
	obj.style.overflow='hidden';
	var taille = obj.offsetHeight;
	if(taille==0)taille=parseInt(obj.style.height);
	if(isNaN(taille))
	{
		obj.style.display='block';
		taille = obj.offsetHeight;
		obj.style.display='none';
	}
	if(sens>0)
	{
		obj.style.height=0+"px";
		obj.style.display='block';
	}
	if(sens<0)
	{
		obj.style.height=taille+"px";
	}
	//doProgress(quoi,sens,taille);
	var step = taille/sens;
	if((step<1)&&(sens>0))step=1;
	if((step>-1)&&(sens<0))step=-1;
	zobj.sens=sens;
	zobj.taille=taille;
	zobj.step=step;
	doProgress(quoi);
}
function doProgress(quoi)
{
	var zobj=Move.getzobj(quoi);
	var sens = zobj.step;
	var taille = zobj.taille;
	var obj = document.getElementById(quoi);
	var t = parseInt(obj.style.height);
	var run = false;
	if((t < taille)&&(sens>0))
	{
		obj.style.height=(t+sens>taille?taille:t+sens)+"px";
		run = true;
	}
	if((t>0)&&(sens<0))
	{
		obj.style.height=(t+sens<0?0:t+sens)+"px";
		if(parseInt(obj.style.height)==0)
	{
		obj.style.display='none';
		obj.style.height=taille+"px";
	}
	else run = true;
	}
	if(run)setTimeout("doProgress('"+quoi+"')",10);
	else Move.endopenclose(quoi,sens);
}
function ZObjMove(id,sens,onlyone,restoreheight)
{
	this.id = id;
	this.open = sens>0?0:1;
	this.speed = Math.abs(sens);
	this.run = 0;
	this.origheight=document.getElementById(id).style.height;
	this.onlyone = onlyone;
	this.restoreheight = restoreheight;
	this.sens=0;
	this.step=0;
	this.taille=0;
}
function ZMove()
{
	function endopenclose(quoi,sens)
	{
		var zobj = this.getzobj(quoi);
		if(zobj!=null)
		{
			if(zobj.restoreheight)document.getElementById(quoi).style.height=zobj.origheight;
			if(zobj.onlyone)
			{
				this.removezobj(quoi);
			}
			else
			{
				zobj.run = 0;
				zobj.open = sens>0?1:0;
			}
		}
	}
	function getzobj(quoi)
	{
		var rtr = null;
		for(var i=0;i<this.lst.length;i++)
		{
			if(this.lst[i].id == quoi)
			{
				rtr=this.lst[i];
				break;
			}
		}
		return rtr;
	}
	function removezobj(quoi)
	{
		for(var i=0;i<this.lst.length;i++)
		{
			if(this.lst[i].id == quoi)
			{
				this.lst.splice(i,1);
				break;
			}
		}
	}
	function openclose(quoi,sens,onlyone,restoreheight)
	{
		var zobj=this.getzobj(quoi);
		if(zobj==null)
		{
			var restore = 1;
			if(restoreheight)restore=restoreheight;
			zobj = new ZObjMove(quoi,sens,onlyone,restore);
			this.lst.push(zobj);
		}
		if(!zobj.run)
		{
			zobj.run = 1;
			if(zobj.open)
			{
				slow(zobj.id,-zobj.speed);
			}
			else
			{
				slow(zobj.id,zobj.speed);
			}
		}
		else
		{
			zobj.step = -zobj.step;
		}
	}
	this.endopenclose = endopenclose;
	this.openclose = openclose;
	this.getzobj = getzobj;
	this.removezobj = removezobj;
	this.lst = new Array();
}
var Move = new ZMove();
