var Slider = new Class({
	Implements: [Options, Events],
	options: {
		debug: false,
		VisibleItems: 1,
		RotationSpeed: 5000,
		FxSpeed: 1000,
		FxTransition: Fx.Transitions.Quad.easeInOut
	},
	
	initialize: function(element,options){
		this.setOptions(options);
		this.element = document.id(element); 
		
		this.slides = this.element.getChildren();
		
		//console.log( this.element );
		
		this.CreateElements();
		
		
		this.element.setStyles({
			'position': 'absolute',
			'width': ( this.slides[0].getSize().x * this.slides.length )
		});
		
		
		this.GoRight.addEvent('click', GoRight);
		
	},
	
	CurrentPos: 0,
	
	GoRight: function(){
		this.CurrentPos -= this.slides[0].getSize().x;
		
		if( this.CurrentPos < -( this.slides[0].getSize().x * (this.slides.length - this.options.VisibleItems) ) )
			this.CurrentPos = 0;
		
		this.element.tween('left', this.CurrentPos);
	},
	GoLeft: function(){
		this.CurrentPos += this.slides[0].getSize().x;
		
		if( this.CurrentPos > 0 )
			this.CurrentPos = -( this.slides[0].getSize().x * (this.slides.length - this.options.VisibleItems) );
		
		this.element.tween('left', this.CurrentPos);
	},
	
	CreateElements: function(){
		// CreateWrap
		this.wrap = new Element('div', {
			'class': 'slider-wrap',
			'styles': {
			}
		});
		this.wrap.wraps( this.element );
		
		
		// Go Right Button
		this.GoRightEle = new Element('a', {
			'class': 'go-right',
			'events': {
				'click': (function(){
					this.GoRight();
				}).bind(this)
			}
		});
		this.GoRightEle.inject( this.wrap, 'after' );
		
		// Go Left Button
		this.GoLeftEle = new Element('a', {
			'class': 'go-left',
			'events': {
				'click': (function(){
					this.GoLeft();
				}).bind(this)
			}
		});
		this.GoLeftEle.inject( this.wrap, 'after' );
	}

});
