Effect.Transitions.exponential = function(pos) {
  return 1-Math.pow(1-pos,2);
}

var time_fondu = 4000;
var current_image_fondu = -1;
var next_image_fondu = 0;
var image_fondu = new Array();

function init_fondu() {
	if(document.getElementsByClassName("image")) {
		image_fondu = document.getElementsByClassName("image");
		for(i = 0; i < image_fondu.length; i++) {
			image_fondu[i].style.display = "none";
		}
	}
	
	if(image_fondu.length > 1) {
		galerie_fondu();
	} else {
		effectimage_fondu();
	}
}

function galerie_fondu() {
	self.setTimeout("nextimage_fondu()", time_fondu);
}

function effectimage_fondu() {
	if(current_image_fondu != -1) {
		new Effect.Fade(image_fondu[current_image_fondu], { duration: 2.0 });
	}
	new Effect.Appear(image_fondu[next_image_fondu], { duration: 2.0 });
}

function nextimage_fondu() {
	effectimage_fondu();
	current_image_fondu = next_image_fondu;
	if(next_image_fondu == (image_fondu.length - 1)) {
		next_image_fondu = 0;
	} else {
		next_image_fondu++;
	}
	galerie_fondu();
}
