function diaporama(name, instanceName) {
	this.count = 0;
	this.interval = '';
	this.name = name;
	this.instanceName = instanceName;
	this.timer = 8000;
	this.LIs = new Array();
	
	this.construct = function () {
		this.LIs = $$("#" + this.name + "_ul li");
	
		for(i=1; i < this.LIs.length; i++)
		this.LIs[i].style.display = "none";
		
		this.buildLink(0);
		
		this.play();
	}
	
	this.next = function () {
		var previous = this.count - 1;
		if(previous < 0) { previous = this.LIs.length - 1; }
		this.LIs[previous].style.display = "none";
		
		this.LIs[this.count].style.zIndex = 1;
		
		var next = this.count + 1;
		if(next >= this.LIs.length) { next = 0; }
		this.LIs[next].style.zIndex = 2;
		this.LIs[next].appear();
		
		this.count = next;
		this.buildLink(next);
	}
	this.play = function () {
		if(this.interval == '')
		this.interval = setInterval(this.instanceName + '.next()', this.timer);
	}
	this.pause = function() {
		clearInterval(this.interval);
		this.interval = '';
	}
	this.buildLink = function (i) {
		var a = this.LIs[i].getElementsByTagName("a");
		$(this.name + "_lien").innerHTML = '<a href="' + a[0].href + '"></a>';
	}
	this.construct();
}

