window.addEvent('domready', function() {
 
	var container = $('partners-holder');
	var scroller = $('partners-container');
	
	var totalWidth = 0;
	scroller.getChildren().each(function(kid) { totalWidth += kid.offsetWidth; });
	
	scroller.setStyle('width', totalWidth + 'px');
	
	//console.log(container.scrollWidth, container.offsetWidth, scroller.scrollWidth, scroller.offsetWidth);
	
	if (container.scrollWidth <= container.offsetWidth) {
		return;
	}
	
	var min = 0;
	var max = container.scrollWidth/* - container.offsetWidth*/;
	
	scroller.setStyle('width', (2*totalWidth) + 'px');
	scroller.getChildren().each(function(kid) { scroller.appendChild(kid.clone(true)); });
	
	var baseTrans = Fx.Transitions.linear;
	
	var fx = new Fx.Tween(scroller, {
		transition: baseTrans,
		duration: 15000 * (max-min) / 1600
	});
	
	var isRight = true;
	
	var moveIt = function() {
		if (!isRight) {
			(function() {
				fx.start('left', -max, min);
			}).delay(1500);
		}
		else {
			//(function() {
				fx.start('left', min, -max);
			//}).delay(1500);
		}
		//isRight = !isRight;
	};
	
	fx.addEvent('onComplete', moveIt);
	
	moveIt();
	
});
