var ScrollPromo = new Class({
	initialize: function(max){
		this.max = max-4;
		this.count = 0;
		this.sens = 'left';
 		this.start();
	},
	stop: function(){
		$clear(this.periodicalTimer);
	},
	start: function(){
		this.slideFx = new Fx.Tween('random_scroll',{
			duration:500,
			transition:Fx.Transitions.Quart.easeOut,
			wait:false
		});

		this.periodicalTimer = this.refresh.periodical(4000, this);
	},
	refresh: function(){
		
		this.current = $('random_scroll').getStyle('margin-left').toInt();
		if (this.count==this.max){
			this.sens = (this.sens == 'left') ? 'right' : 'left';
			this.count = 0;
		}
		if(this.sens == 'left'){
			this.slideFx.start('margin-left',(this.current-185)+'px');
		}
		if(this.sens == 'right'){
			this.slideFx.start('margin-left',(this.current+185)+'px');
		}
		this.count++;
	}
});

