var effect = 1;
var time = 4000;

var current_image = 0;
var next_image = 1;
var image = new Array();

function init() {
	image = $('diaporama').getElementsByTagName('img')
	if(image) {
		//image = document.getElementsByClassName("image");
		var divlegende =$('txtill')	
		if(divlegende){			divlegende.innerHTML = image[0].getAttribute('title');}
		for(i=1; i < image.length; i++) {
			image[i].style.display = "none";
		}
	}
	
	if(image.length > 1) galerie();
}
function galerie() {
	self.setTimeout("nextimage()",time);	
}
function nextimage() {
	var divlegende =$('txtill')
	if(divlegende){divlegende.innerHTML = ''}
	if(effect == 1) { new Effect.Fade(image[current_image]); new Effect.Appear(image[next_image], {afterFinish:function(){if(divlegende){divlegende.innerHTML = image[current_image].getAttribute('title');}}}); }
	if(effect == 2) { new Effect.BlindUp(image[current_image]); new Effect.BlindDown(image[next_image], {afterFinish:function(){if(divlegende){divlegende.innerHTML = image[current_image].getAttribute('title');}}}); }
	
	
	if(next_image == (image.length-1)) {
		current_image = next_image;
		next_image = 0;
	} else {
		current_image = next_image;
		next_image++;
	}
	//$('txtill').innerHTML = image[current_image].getAttribute('title');
	galerie();
}
