window.addEvent('domready', function(){
	new Slideshow();								 
});

var Slideshow = new Class({					 

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

	initialize: function(){
		this.ss_timer;	
		this.elements = $$('#m_ticker img');	
		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($$('#m_ticker')[0], 'top');
			current.dispose();			
			this.elements = $$('#m_ticker img');	
			this.ss_timer = this.get_previous.delay(4000, this);			
		}.bind(this));		
	}	
	
});
