<!--

	var slideShow;
	Event.observe(window,'load',function(){
		slideShow = new SlideShow();
		slideShow.init('auto_slideshow');
	});
	
	var OCSFTransition = Class.create({
		duration: 1000,
		startValue: 0,
		endValue: 1,
		stepSize: .1,
		onComplete: false,
		init:function( element, options ) {
			dbg(element);
		}
	});
	
	var SlideShow = Class.create({
		preloadCount: 0,
		currentSlide: 0,
		zIndex: 1,
		settings: {
			waitTime: 4000,
			stepSize: 20,
			stepWaitTime: 200
		},
		
		stepFadeCurrentSlide: function(currentValue)
		{
			if( !currentValue ) var currentValue=0;
			currentValue+=this.settings.stepSize;
			if( currentValue>100 ) {
				currentValue=100;
			} 
			this.slides[this.currentSlide].setOpacity(currentValue/100);
			if( currentValue<100 ) {
				setTimeout( this.stepFadeCurrentSlide.bind(this,currentValue), this.settings.stepWaitTime );
			} else {
				this.slides[this.currentSlide].setOpacity(100);
				this.wait();
			}
		},
		
		showNextSlide: function()
		{
			this.currentSlide = (this.currentSlide+1) % this.slides.length;
			dbg( this.slides[this.currentSlide] );
			//Effect.Appear(this.slides[this.currentSlide],{duration:this.settings.fadeDuration,afterFinish:this.wait.bind(this)});
			this.slides[this.currentSlide].setOpacity(0).setStyle({position:'absolute',top:'0px',left:'0px',zIndex:this.zIndex++});
			//this.slides[this.currentSlide].setOpacity(0).css({position:'absolute',top:'0px',left:'0px'});
			this.stepFadeCurrentSlide();
		},
		
		wait: function()
		{
			setTimeout( this.showNextSlide.bind(this), this.settings.waitTime );
			//setTimeout( this.hidePreviousSlide.bind(this), this.settings.waitTime );
		},
		
		beginIfReady: function()
		{
			if( this.preloadCount>=this.images.length ) {
				$H({
					'slideshowwaittime': 'waitTime',
					'slideshowstepsize': 'stepSize',
					'slideshowwaittimebetweensteps': 'stepWaitTime'
				}).each( function( pair ) {
					if( $(this.className+'_container').readAttribute(pair.key) ) this.settings[pair.value] = parseInt( $(this.className+'_container').readAttribute(pair.key), 10 );
				}.bind(this) );
				
				this.wait();
			}
		},
		
		setupSlides: function()
		{
			$(this.className+'_container').setStyle({position:'relative',height:$(this.className+'_container').getHeight()+'px'});
			
			this.slides.each(function(slide,i){
				if( i==0 ) {
					slide.setOpacity(100).setStyle({position:'absolute',top:'0px',left:'0px',zIndex:this.zIndex++});
					slide.show();
				} else {
					slide.setOpacity(0).setStyle({position:'absolute',top:'0px',left:'0px',zIndex:this.zIndex++});
					slide.show();
				}
			}.bind(this));
		},
		
		preloadImages: function()
		{
			// preload all images contained in the slides
			this.images = $(this.className+'_container').select('img');
			this.images.each(function(image,i){
				var img = new Element("img").observe('load',function(){this.preloadCount++;this.beginIfReady()}.bind(this)).writeAttribute('src',image.src);
			}.bind(this));
		},
		
		init: function(className)
		{
			this.className = className;
			this.slides = $$('.'+className);
			
			if( this.slides.length<1 ) return;
			
			this.setupSlides();
			this.preloadImages();
		}
		
	});
	
	function dbg(a)
	{
		try {
			console.debug(a);
		} catch(e){
			//alert(a);
		}
	}
-->

