window.addEvent('domready', function(){

	var t = $$("a[rel=external]");
	t.each(function(lnk, nr){
		lnk.set({'target':'_blank'}).addClass('external');									
	});	
	
	var rp = new Rp_animation();
									 
});

var Rp_animation = new Class({					 

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

	initialize: function(){		
		this.img_timer;		
		this.images = $$('#slideshow_wrapper div');	
		this.current_img = this.images.length;		
		this.get_next.delay(2000, this);
	},
	
	get_next: function(){		
		previous = this.images[this.current_img-1];
		this.current_img--;
		if(this.current_img < 1){ this.current_img = this.images.length; }	
		previous.set('morph', {duration: 'long', transition: 'bounce:out'});
 		previous.morph({width: 0}).retrieve('morph').chain(function(){	
			previous.setStyle('width', '410px').inject('slideshow_wrapper', 'top');																	
			this.get_next.delay(2000, this);															
		}.bind(this));
	}
});
