var scrollingInterval;
var isScrolling = false;

$(function() {
	//add scroller css
	$("#customers").css("height", 92);
	$("#cust_holder").css("width", 5000);
	
	//start scrolling
	if ($("#cust_holder > ul").size() > 1)
		scrollingInterval = setInterval(scrollCustomers, 8000);
	
	//pause scrolling on mouse over
	$("#customers").hover(function() {
		clearInterval(scrollingInterval);
	}, function() {
		scrollingInterval = setInterval(scrollCustomers, 8000);
		
		if (!isScrolling)	scrollCustomers();
	});
});


function scrollCustomers () {
	isScrolling = true;
	$("#cust_holder").animate( { left: -1 * $("#cust_holder ul").eq(0).width() }, 4300, "easeInOutQuad", function () {
		isScrolling = false;
		//add the first child to the back and set the scrollPosition back
		$("#cust_holder ul").parent()[0].appendChild( $("#cust_holder ul")[0] );
		$("#cust_holder").css("left", 0);
	} );
}

