var Carousel = new Class({
	speed : 1500,
	containerEl: null,
	contentEl: null,
	leftEl: null,
	rightEl: null,
	titleEl: null,
	scroll: null,
	
	/* Constructor */
	initialize: function ( containerId, contentId, leftId, rightId, titleId ) {
		this.containerEl = $(containerId);
		var items = $ES( 'div', containerId );
		this.contentEl = $(contentId);
		this.contentEl.style.width = (items.length*175)+"px";
		
		this.scroll = new Fx.Scroll(containerId, {
			wait: false,
			duration: this.speed,
			transition: Fx.Transitions.Quad.easeInOut
		});
		
		leftEl = $(leftId);
		leftEl.addEvent('click', function(event) {
			event = new Event(event).stop();
			var newx = this.containerEl.getSize().scroll.x-600;
			if(newx<0) newx = 0;
			this.scroll.scrollTo(newx,0);
			KobSettings[this.containerEl.title] = newx;
			HashCookie.extend(KobSettings);
		}.bindAsEventListener( this ));
		leftEl.setOpacity( 0.5 );
		leftEl.addEvent('mouseover', function () { leftEl.setOpacity( 1 ); }.bindAsEventListener( this ));
		leftEl.addEvent('mouseout', function () { leftEl.setOpacity( 0.5 ); }.bindAsEventListener( this ));
		
		rightEl = $(rightId);
		rightEl.addEvent('click', function(event) {
			event = new Event(event).stop();
			var newx = this.containerEl.getSize().scroll.x+600;
			var maxx = this.containerEl.getSize().size.x-this.containerEl.getSize().x;
			if(newx>maxx) newx = maxx;
			this.scroll.scrollTo(newx,0);
			KobSettings[this.containerEl.title] = newx;
			HashCookie.extend(KobSettings);
		}.bindAsEventListener( this ));
		rightEl.setOpacity( 0.5 );
		rightEl.addEvent('mouseover', function () { rightEl.setOpacity( 1 ); }.bindAsEventListener( this ));
		rightEl.addEvent('mouseout', function () { rightEl.setOpacity( 0.5 ); }.bindAsEventListener( this ));
		
		if (HashCookie.get(this.containerEl.title)) {
			this.scroll.scrollTo(HashCookie.get(this.containerEl.title),0);
		}
	}
	
});