window.addEvent('domready', function(){
	$$('div.flex-sponsor-scrolling').each(function(flex){
		var content = flex.getElement('.content');
		if(content){
			var coord = content.getCoordinates();
			var fcoord = flex.getCoordinates();
			if(coord.height > fcoord.height){
				content.setStyle('height', coord.height);
				var contents = [content];
				var tpl = content.clone();
				var h = coord.height-fcoord.height;
				var ch = coord.height;
				var fx1 = new Fx.Scroll(flex, {
    					offset: {
        					'x': 0,
       						'y': h
    					},
    					duration: coord.height*10,
    					transition: 'linear',
    					onComplete: function(){
    						contents.extend([tpl.clone()])
    						flex.adopt(contents.getLast());
    						if(contents.length>3){
    							contents[contents.length-3].destroy();
    							ch += coord.height;
    							content.setStyle('height', ch);
    							content.empty();
    						}
    						this.options.offset.y += coord.height;
    						this.toTop();
    					}
				}).toTop();
			}
		}
	});
});
