var Slider = new Class({

	Implements: [Options],	
	timer: null,				

	options: {
		slideTimer: 10000,
		transitionTime: 2000,
		container: null,		
		items:  null,
		curItem: 0,
		containerWidth: 0
	},

	initialize: function(options) {
		this.setOptions(options);
		this.options.items = this.options.items -1;
		this.options.containerWidth = this.options.container.getWidth();
	},

	start: function() {
		this.slideIt();
		this.theTimer = this.slideIt.periodical(this.options.slideTimer, this, null);
	},

	slideIt: function() {
		
		
		
		var backgroundPosition = this.options.curItem*this.options.containerWidth*-1+'px 0px';
		
		if(this.options.curItem == this.options.items+1){
			var myEffect = new Fx.Morph(this.options.container, {
				duration: this.options.transitionTime,
				transition: 'expo:in',
				onComplete: function(event){
					this.options.container.setStyle('background-position', '0px 0px');
				}.bind(this)
			});
			this.options.curItem = 1;
		}
		else {
			var myEffect = new Fx.Morph(this.options.container, {
				duration: this.options.transitionTime,
				transition: 'expo:in'
			});
			this.options.curItem = this.options.curItem + 1;
		}
		myEffect.start({
			'background-position': backgroundPosition
		});			

	}
});