var imgScroll = new Class({
	initialize: function (params) {
		this.box = params.box;
		this.items = params.items;
		this.currentIndex = 0;
		this.width = 966;
		this.size = 161;
		this.max = 6;
		this.dir = 1;
		this.loopIndex = 1;
		this.interval = params.interval || 3000;
		if (this.items.length > this.max) {
			this.box1 = this.box.clone();
			this.box1.id = 'banners1';
			this.box1.setStyle('left', this.items.length * 161 + 'px');
			this.box1.inject(this.box, 'after');
			this.elements = [this.box1, this.box];
			this.fx1 = new Fx.Tween(this.box1,$extend((params.fxOptions||{duration:500,wait:false}),{property: 'left'}));
			this.fx2 = new Fx.Tween(this.box,$extend((params.fxOptions||{duration:500,wait:false}),{property: 'left'}));
			this._play = this['play'].periodical(this.interval,this);
		}
	},

	play: function() {
		if (this.currentIndex == this.loopIndex * this.items.length - this.max) {
			this.dir = 1 - this.dir;
			this.elements[this.dir].setStyle('left', '966px');
			this.loopIndex++;
		};
		this.currentIndex++;
		this.fx1.start(this.elements[0].getStyle('left').toInt() - this.size);
		this.fx2.start(this.elements[1].getStyle('left').toInt() - this.size);
	}
});