﻿var clientCount;
$(document).ready(function(){

	clientCount = $("div#clientListPaneHidden > div").size();

	setTimeout("swapLogos()", 5000);

});

function swapLogos() {
	var delayStagger = 0;
	
	$("ul#clientListPane li div").each(function(){
		
		var listItem = $(this);
		var itemId = parseInt($(this).attr("class").split("_")[1]);
				
		$(this).fadeTo(delayStagger, 1.0).fadeTo(300, 0, function(){
															
			var newLogoIndex = (itemId + 8) <= clientCount ? (itemId + 8) : ((itemId + 8) - clientCount);
			
			var newLogo = $("div#clientListPaneHidden div.logoid_" + newLogoIndex).clone();
			$(newLogo).css({opacity:0});	
			
			$(this).replaceWith(newLogo);
			
			$(newLogo).fadeTo(50, 0).fadeTo(300, 1);
			
		});
		
		delayStagger+= 150;
	
	});
	
	setTimeout("swapLogos()", 5000);
	
}