
$(document).ready(function() {
	var $nossostelefones = $(".nossostelefones");

	var baseY = 38;
	var changeY = 35;
	var numberOfItems = 6; // == 6 items
	var currentItem = 3;
	
	setInterval(function() {
		var y;
		var backgroundPosition;
		do{ 
			//return a random integer between 0 and 10
			// currentItem = Math.floor(Math.random() * (numberOfItems - 1) + 1);
			currentItem = currentItem < numberOfItems ? currentItem + 1 : 0;
			y = baseY + currentItem * changeY;
			backgroundPosition = "0px -" + y + "px";
		} while(backgroundPosition == $nossostelefones.css('backgroundPosition'));
		
		$nossostelefones.fadeOut('slow', function() {
			$(this).css('backgroundPosition', backgroundPosition).fadeIn();
			return false;
		});
		// console.log($nossostelefones.css('backgroundPosition'));
	}, 7000);
});
