var slidebox = new Class({
	initialize: function(el, options) {
		this.el = el;
		this.options = Object.extend({
			scrollDistance: this.el.getStyle('width').toInt(),
			scrollDuration: 600,
			scrollLoop: false,
			scrollMax: -1,
			scrollPages: 2,
			scrollReset: false,
			scrollTransition: Fx.Transitions.cubicOut
		}, options || {});
		if (this.options.scrollMax<0) this.options.scrollMax = this.options.scrollDistance * this.options.scrollPages;

		if (this.options.scrollReset) {
			this.scroll = 0;
			this.el.scrollTo(this.scroll, 0);
		} else {
			this.scroll = this.el.getSize().scroll.x;
		}
		this.fx = new Fx.Scroll(el, { wait: false, duration: this.options.scrollDuration, transition: this.options.scrollTransition });
	},
	slide: function(d) {
		this.scroll += (this.options.scrollDistance*d);
		if (this.options.scrollLoop) {
			if (this.scroll<0) this.scroll = this.options.scrollMax;
			if (this.scroll>this.options.scrollMax) this.scroll = 0;
		} else {
			if (this.scroll<0) this.scroll = 0;
			if (this.scroll>this.options.scrollMax) this.scroll = this.options.scrollMax;
		}
		this.fx.scrollTo(this.scroll,0);
	}
});