function Lift(elementId, visibleElements)
{
	this.element = document.getElementById(elementId);

	this.lift;
	this.clip;
	this.list;
	this.list2;
	this.upButton;
	this.downButton;

	this.position = 0;
	this.position2 = 0;
	this.listHeight = 0;
	this.itemHeight = 0;

	this.timer = null;
	this.visibleElements = visibleElements;

	this.addItem = function(url, title, picture)
	{
		var item = document.createElement('a');
		item.href= url;
		item.title = title;

		var img = document.createElement('img');
		img.src = picture;

		item.appendChild(img);
		item.appendChild(document.createTextNode(title));

		this.list2.appendChild(item);

		return item;
	}

	this.init = function()
	{
		var parent = this.element.parentNode;

		this.lift = document.createElement('div');
		this.lift.className = 'lift';

		this.upButton = document.createElement('a');
		this.upButton.href = '#';
		this.upButton.className = 'lift_up';

		this.downButton = document.createElement('a');
		this.downButton.href = '#';
		this.downButton.className = 'lift_down';

		this.clip = document.createElement('div');
		this.clip.className = 'lift_clip';

		this.list = this.element;
		this.list.className = 'lift_list';

		this.list2 = document.createElement('ul');
		this.list2.className = 'lift_list';

		this.clip.appendChild(this.list);
		this.clip.appendChild(this.list2);

		this.lift.appendChild(this.upButton);
		this.lift.appendChild(this.clip);
		this.lift.appendChild(this.downButton);

		var elements = this.list.getElementsByTagName('LI');
		var nbElt = elements.length;

		for (var i = 0; i < nbElt; i++)
		{
			var element = elements[i].firstChild;

			var item = this.addItem(element.href, element.childNodes[1].nodeValue, element.childNodes[0].src);

			/*if (this.itemHeight == 0)
				this.itemHeight = element.childNodes[0].height;

			item.style.height = (this.itemHeight + 32) + 'px';
			element.style.height = item.style.height;*/
		}

		parent.appendChild(this.lift);

		this.itemHeight = this.clip.clientHeight;
		//this.itemHeight += 32; // Ajoute la hauteur des deux lignes de texte
		this.clip.style.height = (this.itemHeight * this.visibleElements) + 'px';
		this.downButton.style.marginTop = (this.itemHeight * this.visibleElements - 25) + 'px';

		this.listHeight = this.itemHeight * nbElt;
		this.list.style.height = this.listHeight + 'px';

		this.list2.style.height = this.listHeight + 'px';
		this.list2.style.top = this.listHeight + 'px';
		this.position2 = this.listHeight;
	}

	this.init();

	var self = this;

	this.clip.onmouseover = function()
	{
		if (self.timer)
			clearTimeout(self.timer);
	}

	this.clip.onmouseout = function()
	{
		self.timer = setTimeout(self.scroll, 2000);
	}

	this.upButton.onclick = function()
	{
		if (self.timer)
			clearTimeout(self.timer);

		if (self.position2 + self.itemHeight > 0)
			self.position2 = 0 - self.listHeight * 2;

		var animation = new Animation(self.list); 
		animation.moveUp(self.position, self.position + self.itemHeight, 5, 50, 1);

		var animation = new Animation(self.list2); 
		animation.moveUp(self.position2, self.position2 + self.itemHeight, 5, 50, 1);

		self.position = self.position + self.itemHeight;
		self.position2 = self.position2 + self.itemHeight;

		if (self.position >= self.listHeight)
			self.position = self.position2;

		self.timer = setTimeout(self.scroll, 4000);

		return false;
	}

	this.downButton.onclick = function()
	{
		if (self.timer)
			clearTimeout(self.timer);

		var animation = new Animation(self.list); 
		animation.moveUp(self.position, self.position - self.itemHeight, 5, 50, 1);

		var animation = new Animation(self.list2); 
		animation.moveUp(self.position2, self.position2 - self.itemHeight, 5, 50, 1);

		self.position = self.position - self.itemHeight;
		self.position2 = self.position2 - self.itemHeight;

		if (self.position <= 0 - self.listHeight)
			self.position = self.position2 + self.listHeight;

		if (self.position2 <= 0 - self.listHeight)
			self.position2 = self.position + self.listHeight;

		self.timer = setTimeout(self.scroll, 4000);

		return false;
	}

	this.scroll = function()
	{
		var animation = new Animation(self.list); 
		animation.moveUp(self.position, self.position - self.itemHeight, 10, 50, 1);

		var animation = new Animation(self.list2); 
		animation.moveUp(self.position2, self.position2 - self.itemHeight, 10, 50, 1);

		self.position = self.position - self.itemHeight;
		self.position2 = self.position2 - self.itemHeight;

		if (self.position <= 0 - self.listHeight)
			self.position = self.position2 + self.listHeight;

		if (self.position2 <= 0 - self.listHeight)
			self.position2 = self.position + self.listHeight;

		self.timer = setTimeout(self.scroll, 2000);
	}

	this.startScroll = function()
	{
		this.timer = setTimeout(this.scroll, 4000);
	}

	this.startScroll();
}