Element.implement({
	slideShowDelay : 500,
	timeOutId : null,
	slideshow_showFirst: function(){
			var pic = this.getFirst('img');
			pic.set('styles', { 'display': 'inline' });
			while((pic = pic.getNext()) != null){
				pic.set('styles', { 'display': 'none' });
			}
			$clear(this.timeOutId);
			return this;
	},
	slideshow_showNext: function(){
			var firstPic = this.getFirst('img');
			var pic = firstPic;
			do{
				if(pic.getStyle('display') == 'inline'){
					pic.set('styles', { 'display': 'none' });
					if((pic = pic.getNext()) != null){
						pic.set('styles', { 'display': 'inline' });
						break;
					}else{
						firstPic.set('styles', { 'display': 'inline' });
						break;
					}
				}
			}while((pic = pic.getNext()) != false);
			this.timeOutId = this.slideshow_showNext.delay(this.slideShowDelay, this);
			return this;
	}
});

window.addEvent('domready', function(){
	$$('.slideshow_pic').slideshow_showFirst();
	$$('.slideshow_pic').addEvent('mouseenter', function(){ this.slideshow_showNext() });
	$$('.slideshow_pic').addEvent('mouseleave', function(){ this.slideshow_showFirst() });
});
