var textContainer;
var totalPhrases;
var currentPhrase;
var prevPhrase;

$(document).ready(function() {
	textContainer = $("#textBanner");
	$(textContainer.children()).css("display","none");

	totalPhrases = textContainer.children().length;
	currentPhrase = 0;
	prevPhrase = 0; 
	
	startTimer();
});
function startTimer(){
	var timer = setTimeout(onTick, 4500);
	$(textContainer.children()[currentPhrase]).fadeIn(500);
}
function onTick(){						   
	prevPhrase = currentPhrase;
	if(currentPhrase == totalPhrases-1){
		currentPhrase = 0
	} else {
		currentPhrase++;
	}
	$(textContainer.children()[currentPhrase]).fadeIn(500);
	$(textContainer.children()[prevPhrase]).fadeOut(500);
	var timer = setTimeout(onTick, 4500);
}