$(document).ready(function(){
	
	candidates = $('#sponsors img');
	
	$(candidates[0]).addClass('left');
	$(candidates[1]).addClass('on');
	$(candidates[2]).addClass('right');
	
	$('#sponsors .left, #sponsors .right').fadeTo(0,0.6);

	$(document).everyTime(5000, function(){
		speed = 1500;
		
		on = $('#sponsors .on');
		left = $('#sponsors .left');
		right = $('#sponsors .right');

		next = $('#sponsors img.right').next(':not(.on, .left, .right)');

		
		if(next.size() == 0){
			candidates = $('#sponsors img.right').siblings(':not(.on, .left, .right)');
			next = $(candidates[0]);
		}
		
		next.addClass('right').animate({opacity: 0.6}, speed, "swing");
								
	  left.animate({opacity: 0}, speed, "swing", function(){$(this).removeClass('left');}).animate({left: '420px'});
	
		right.css('z-index', 20).animate({width: '295px', height: '168px', left: '200px', top: '0px', opacity: 1}, speed, "swing",
		  						 function(){$(this).removeClass('right').addClass('on');});

		on.css('z-index', 10).animate({width: '255px', height: '128px', left: '0px', top: '30px', opacity: 0.6}, speed, "swing", 	 
			          function(){$(this).removeClass('on').addClass('left');}).css('z-index', 1);	
	});


	

});