var Slider = new Class({
	Implements: [Options, Events],
	
	options: {},
	SlideButton: [],
	CurrentButton: 0,
	CurrentLocation: 1,
		
	initialize: function(element,options){
		this.setOptions(options);
		this.WrapElement = $(element);
		
		this.SlideElement = this.WrapElement.getElement('#latest-slider .wrap');
		this.Slides = this.SlideElement.getElements('.slide-item');
		// Set Wrap Size
		var TotalSize = this.Slides[0].getSize().x * this.Slides.length;
		this.SlideElement.setStyle('width', TotalSize);
		
		//
		this.CreateElements();
		
		//this.GoTo(0);
	},
	
	CreateElements: function(){

		this.ButtonWrap = new Element('div', { 'class': 'button-wrap' }).inject( this.WrapElement );
		
		/*this.Slides.each(function(item,index){
			this.SlideButton[index] = new Element('a', {
				'class': 'item',
				'html': 'Go to item #'+ index,
				'events': {
					'click': function(){
						this.GoTo( index );
					}.bind(this)
				}
			}).inject( this.ButtonWrap );
		},this);*/
		
		this.leftButton = new Element('a', {
			'class': 'item left',
			'html': 'left',
			'events': {
				'click': function(){
					this.GoLeft();
				}.bind(this)
			}
		}).inject( this.ButtonWrap )
		
		this.rightButton = new Element('a', {
			'class': 'item right',
			'html': 'right',
			'events': {
				'click': function(){
					this.GoRight();
				}.bind(this)
			}
		}).inject( this.ButtonWrap )
		
	},
	
	/*GoTo: function(index){
		var width = this.Slides[index].getSize().x;
		
		
		this.SlideElement.tween('left',  -(width*index) );
		this.SlideButton[this.CurrentButton].removeClass('selected');
		this.SlideButton[index].addClass('selected');
		
		this.CurrentButton = index;
	}*/
	
	GoRight: function(){
		var count = this.Slides.length;
		if(this.CurrentLocation < count){
			var width = this.Slides[0].getSize().x;
			this.SlideElement.tween('left', -(width * this.CurrentLocation));
			this.CurrentLocation++
		}
	},
	
	GoLeft: function(){
		if(this.CurrentLocation > 1){
			var width = this.Slides[0].getSize().x;
			this.SlideElement.tween('left', -(width * (this.CurrentLocation - 2)));
			this.CurrentLocation--
		}
	}
	
	
});
