window.addEvent('domready', function() {
	

	if($('brandsWrapper')) {
			
		var brandsWidth = 280;
		
		var thisDuration = 0
		
		var brandsWrapperWidth = 0;
									
		$$('.brandItem').each(function(element) {
			brandsWrapperWidth += brandsWidth;
			thisDuration = thisDuration + 6000;
		})
		
		$('brandsInner').setStyle('width',brandsWrapperWidth);						
		
		// Instantiate the duration variable
		
		// Instantiate the thisHeight variable, this is the maximum height of the element
		var thisWidth = 0 - $('brandsInner').getStyle('width').toInt();			

			
		// The scrolling function
		function doScroll() {		
			$('brandsInner').setStyle('left',$('brandsWrapper').getStyle('width').toInt());				
			$('brandsInner').set('tween', {
				onComplete: function(e) {
						doScroll();
				},
				duration: thisDuration,
				transition: 'linear',
				fps: '20'
			});			
			$('brandsInner').tween('left', thisWidth);						
		}
		
		doScroll();				
				
		 
	}
		
						
})