var ilmariSlideshow = new Class({	Implements: [Options],		containerElement: null,	options: {		showDuration: 2000,		transitionDuration: 1000,		transition: 'sine:in:out'	},	timer: null, 	interval: null, 	current: 0,			stopped: true,	images: [],		showNext: function(){				this.images[this.current].tween(0);		if(++this.current >= this.images.length){			this.current = 0;		}		this.images[this.current].tween(1);				},		initialize: function(div, options) {		this.setOptions(options);				this.interval = this.options.showDuration + this.options.transitionDuration;				this.containerElement = document.id(div) || false;		if(!this.containerElement){			return; // just give up		}				var prepared = this.prepareImages();		if(prepared){			this.start();		}	},		start: function(){		(function(){			this.showNext();			this.timer = this.showNext.bind(this).periodical(this.interval);		}).bind(this).delay( this.options.showDuration );		this.stopped = false;	},	stop: function(){		this.timer = $clear(this.timer);		this.stopped = true;	},	toggle: function(){		if(this.stopped == true){			this.start();			return "started";		}		else {			this.stop();			return "stopped";		}	},		myArrayMin: function(a){		var foo;		a.each(function(item){			if(!foo){ 				foo=item; 			}else{				if(item < foo){					foo=item;				}			}					});		return foo;	},			prepareImages: function(){			var tweenOptions = {			property: 'opacity', 			link: 'cancel',			transition: this.options.transition,			duration: this.options.transitionDuration		};			this.images = this.containerElement.getElements('img');				// laskettu sen varaan, että CSS:ssä on oikeat tyylit valmiina		if(this.images.lenght <=1){			return false;		}				var s, w=[], h=[];					this.images.each(function( image, index ){			s = image.getSize();			w.push(s.x);			h.push(s.y);						if(index != 0){				image.fade('hide');			}						image.setStyles({				position: 'absolute',				margin: '0', 				padding: '0',				top: '0', 				left:'0'			});						image.set('tween', tweenOptions);					});						this.containerElement.setStyles({			position: 'relative',			// overflow: 'hidden', // bad idea on all but firefox?			width: this.myArrayMin( w ) +'px',			height: this.myArrayMin( h ) +'px'		});				return true;	}	});
