var JUHPSlideshow = Class.create();
JUHPSlideshow.prototype = {
	initialize : function(element, options) {
		this.id = element.identify();
		this.element = $(element);

		this.element.childElements().each(function (x) { if (!x.hasClassName('first')) { x.fade();	} });
		new PeriodicalExecuter(this.next.bind(this), 5);
	},
	next : function() {
		this.element.firstDescendant().fade({ duration: 1 })
		this.element.insert({ bottom: this.element.firstDescendant() });
		this.element.firstDescendant().appear({ duration: 1 });
	}
}
Element.addMethods('DIV', { slideshow : function(e) { return new JUHPSlideshow(e); } });
Event.observe(window, 'load', function() { $$('div[class=juhp-slideshow]').invoke('slideshow'); });
