// ------------------------------------------------------------------------
// SampleZone GmbH,  copyright 2000-2010
// ------------------------------------------------------------------------
// JS Class CSlideShow 
// requires mootools-rs.V1.00.js
// ------------------------------------------------------------------------
// Rolf Schöpfer, 13.02.2010
//
// 13.02.2010, Rolf Schöpfer, V1.0
//
// V1.0
// ------------------------------------------------------------------------
		// SampleZone NameSpace
		var sz; if(!sz) sz = {};

		//-------------------------------------------------------
		// sz.CSlideShow
		//-------------------------------------------------------
		sz.CSlideShow = new Class(
		{
			options: {
				duration: { show: 3000, fade: 1000 },
				fps: 10,
			},
			Implements: [Options,Events],
			initialize: function(container,options)
			{
				this.setOptions(options);
				this.container = $(container);
				this.elements = this.container.getElements('img');
				this.currentIndex = 0;
				this.interval = '';
				// assign
				this.elements.each(function(el,i)
				{
					el.set('tween', {duration: this.options.duration.fade, fps: this.options.fps});
					if(i > 0) el.set('opacity',0);
				},this);
			},
			show: function()
			{
				var o = this.elements;
				o[this.currentIndex].fade('out');
				o[this.currentIndex = this.currentIndex < o.length - 1 ? this.currentIndex+1 : 0].fade('in');
			},
			start: function()
			{
				this.interval = this.show.bind(this).periodical(this.options.duration.show);
			},
		});
