
$(document).ready(function(){
	
	var theWidth = 0;
	var mouseOver = false;
	
	$('.brandsBox').css({ overflow:'hidden',overflowX:'hidden' }).mouseover(function(){ mouseOver = true; }).mouseout(function(){ mouseOver = false; });
	
	$('.brandsBox ul li').each(function(){
		theWidth += $(this).outerWidth();
		//alert($(this).outerWidth());
	});
	//alert(theWidth);
	$('.brandsBox ul').css({ width: theWidth+'px', left:-300+'px' }).clone(true).appendTo('.brandsBox').css({ width: theWidth+'px', left:(theWidth-300)+'px' });
	
	left = 0;
	maxLeft = 0 - theWidth;//(theWidth-$('.brandsBox').width());
	$brandsBox = $('.brandsBox ul').eq(0);
	$brandsBox2 = $('.brandsBox ul').eq(1);
	setInterval(function(){ if (mouseOver==false) { left-=1; if (left < maxLeft) left=0; $brandsBox.css({ left: left+'px' }); $brandsBox2.css({ left: (theWidth+left)+'px' }); } },50);
	
	//spacing = 135;
	/*
	function animation(){
		//$('.brandsBox ul').animate({left:'-'+(theWidth-$('.brandsBox').width())+'px'},theWidth*12, "linear", function(){ animation(); });
		//$('.brandsBox ul li:first').clone(true).appendTo($('.brandsBox ul'));
		//$('.brandsBox ul li:first').hide($(this).width(),function(){ $(this).remove(); animation(); });
		$('.brandsBox ul li:first').animate({width:'hide'},($(this).width()),"linear",function(){ 
			$(this).clone(true).appendTo($('.brandsBox ul')).show();
			$(this).remove(); 
			animation(); 
		});
	}
	
	animation();
	*/
});
