var btrScroll = new Class({
	'Implements' : Options,
	'options'    : {
		'container_prefix' : 'scroll_container_',
		'wrap_prefix'      : 'scroll_wrap_',
		'left_prefix'      : 'scroll_left_',
		'right_prefix'     : 'scroll_right_',
		'current_prefix'   : 'current_',
		'count_prefix'     : 'count_',
		'item_prefix'      : '_item_',
		'disabled_class'   : 'disabled'
	},
	'initialize' : function(options){
		this.setOptions(options);
		this.scrollHash = new Hash({'empty' : 'value'});
	},
	'addScroller' : function(id){
		//Build the Scroller
		this.scrollHash.set(id, new Fx.Scroll($(this.options.container_prefix + id)));
		
		//Scroll to first Element
		this.scrollHash.get(id).toElement(id + this.options.item_prefix + '1');
		
		//Add left button handler
		$(this.options.left_prefix + id).addEvent('click', function(e){
			e.preventDefault();		
			this.left(id);
		}.bind(this));
		
		//Add right button handler
		$(this.options.right_prefix + id).addEvent('click', function(e){
			e.preventDefault();
			this.right(id);
		}.bind(this));
	},
	'left' : function(id){
		var current = $(this.options.current_prefix + id).getProperty('value');
		if (current != 1){
			current--;
			$(this.options.current_prefix + id).setProperty('value', current);
			this.scrollHash.get(id).cancel();
			this.scrollHash.get(id).toElement(id + this.options.item_prefix + current);
			$(this.options.right_prefix + id).removeClass(this.options.disabled_class);
		} 
		if (current == 1){
			$(this.options.left_prefix + id).addClass(this.options.disabled_class);
		}

	},
	'right' : function(id){
		var current = $(this.options.current_prefix + id).getProperty('value');
		var count   = $(this.options.count_prefix + id).getProperty('value') - 1;
		if (current != count){
			current++;
			$(this.options.current_prefix + id).setProperty('value', current);
			this.scrollHash.get(id).cancel();
			this.scrollHash.get(id).toElement(id + this.options.item_prefix + current);
			$(this.options.left_prefix + id).removeClass(this.options.disabled_class);
		} 
		if (current == count){
			$(this.options.right_prefix + id).addClass(this.options.disabled_class);
		}
	}
});