var Slideshow = new Class({					 

	Implements: [Events, Options],
	
	options:{},

	initialize: function(options){
		this.options = options;
		this.ss_timer;	
		this.current_nr = 1;
		this.elements = $$('#' + this.options.container + ' ' + this.options.element);	
		this.current_element = this.elements.length;		
		this.ss_timer = this.get_previous.delay(2000, this);		
	},
	
	get_previous: function(){		
		var current = this.elements[this.current_element-1];
		current.fade('out').retrieve('tween').chain(function(){
			current.clone().setStyles({'visibility':'hidden', 'opacity':.999}).inject($$('#' + this.options.container)[0], 'top');
			current.dispose();		
			this.current_nr++;
			if(this.current_nr > this.elements.length) this.current_nr = 1;
			this.elements = $$('#' + this.options.container + ' ' + this.options.element);	
			$$('#' + this.options.container).getParent().getElement('span').set('html', this.current_nr + "/" + this.elements.length);
			this.ss_timer = this.get_previous.delay(4000, this);			
		}.bind(this));		
	}	
	
});
