var Slideshow = new Class(
{
	options: 
	{
		Dauer: 5000
	},
	initialize: function(container,elements,options) 
	{
		this.container = $(container);
		this.elements = $$(elements);
		this.index = 0;
		this.elements.each(function(el,i)
		{
			if(i > 0) el.set("opacity",0);
			
		},this);
		
	},
	show: function(to) 
	{
		this.elements[this.index].set('tween', {duration: '1000'});
		this.elements[this.index].tween("opacity", "0");
		//this.elements[this.index].fade("out");
		this.index = $defined(to) ? to : (this.index + 1) % this.elements.length;
		this.elements[this.index].set('tween', {duration: '1000'});
		this.elements[this.index].tween("opacity", "1");
		//this.elements[this.index].fade("out");
	},
	start: function() 
	{
		this.intervall = this.show.bind(this).periodical(this.options.Dauer);
	}	
});

