SimpleSlideshow = new Class({
	
		container : '',
		imgs : [],
		holdDuration: 0,
		index:0,
		Implements: Options,
                options : {
			
			fadeOptions : {duration:2000}
		},
	
		/*
		CONSTRUCTOR
		new SimpleSlideshow(container:string, holdDuration:integer, [options:object] ):object
		
		Arguments:
			container - the id of the container div
			holdDuration - the amount of time in miliseconds each image will hold
		*/
		
		initialize: function(container, holdDuration, options){
			this.container = $(container);
			this.holdDuration = holdDuration;
			this.setOptions(options);
			this.imgs = this.container.getElements('img');
			this.imgs.each(function(img, i){
                                
				if(i>0) img.setOpacity(0);
                                img.setStyle('visibility', 'visible');
				img.set('tween', this.options.fadeOptions)
			}, this);
			this.gotoNext.periodical(this.holdDuration, this);
		},
		
		gotoNext: function(){
			var newIndex = this.index + 1;
                        if(newIndex > this.imgs.length - 1) newIndex = 0;
			this.imgs[this.index].tween('opacity',0);
			this.imgs[newIndex].tween('opacity',1);
			this.index = newIndex;
		}
});

