function Slideshow(imageContainer,slideshowId,interval,duration){
  this.imageContainer = imageContainer;
  this.loadedImages = new Array();
  this.interval = interval;
  this.duration = duration;
  this.current = 0;
  this.documentImages = null;
  this.slideshowId = slideshowId;
}
/**
* Prototyp für Vererbung erstellen
*/
Slideshow.prototype = new Object();

/**
* Slideshow initialisieren
*/
Slideshow.prototype.init = function(){
	if(!document.getElementById || !document.createElement)return;	

	// erstes Bild wird eingelesen
	this.documentImages = document.getElementById(this.slideshowId).getElementsByTagName("img");
	this.loadedImages[0] = this.documentImages[0];
	this.loadedImages[0].style.display = "block";
	this.loadedImages[0].xOpacity = .99;

	this.loadedImages[1] = new Image();
	this.loadedImages[1].src = this.imageContainer[1];
	this.loadedImages[1].xOpacity = 0;
	document.getElementById(this.slideshowId).appendChild(this.loadedImages[1]);
	thisObj=this;

	setTimeout(thisObj.fade,this.interval);
	this.nextImage();
}

Slideshow.prototype.fade = function(){

	cOpacity = thisObj.loadedImages[thisObj.current].xOpacity;
	nIndex   = thisObj.loadedImages[thisObj.current+1]?thisObj.current+1:0;
	nOpacity = thisObj.loadedImages[nIndex].xOpacity;
	
	cOpacity-=thisObj.duration; 
	nOpacity+=thisObj.duration;
	
	thisObj.loadedImages[nIndex].style.display = "block";
	thisObj.loadedImages[thisObj.current].xOpacity = cOpacity;
	thisObj.loadedImages[nIndex].xOpacity = nOpacity;
	
	thisObj.setOpacity(thisObj.loadedImages[thisObj.current]); 
	thisObj.setOpacity(thisObj.loadedImages[nIndex]);
	
	if(cOpacity<=0) {
		thisObj.loadedImages[thisObj.current].style.display = "none";
		thisObj.current = nIndex;
		setTimeout(thisObj.fade,thisObj.interval);
		thisObj.nextImage();
	} else {
		setTimeout(thisObj.fade,50);
	}
}

Slideshow.prototype.setOpacity = function(obj){
	if(obj.xOpacity>.99) {
		obj.xOpacity = .99;
		return;
	}
	obj.style.opacity = obj.xOpacity;
	obj.style.MozOpacity = obj.xOpacity;
	obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
}	

Slideshow.prototype.nextImage = function(){
	// immer ein Bild vorausladen
	if ( (this.current < (this.imageContainer.length-2)) && (this.loadedImages.length < this.imageContainer.length) ) {
		this.loadedImages[this.current+2]           = new Image();
		this.loadedImages[this.current+2].src       = this.imageContainer[this.current+2];
		this.loadedImages[this.current+2].xOpacity  = 0;
		document.getElementById(this.slideshowId).appendChild(this.loadedImages[this.current+2]);
	}
}
