// JavaScript Document

$(document).ready(function(){
	
	$('.tagCon').hide();
	
	// Array for taglines
	var myTags = new Array();
	myTags[0] = "Net gain of nearly 11,000 businesses in Duval County since Jaguars inception.";
	myTags[1] = "Jaguars Foundation has awarded over $12.5 million to programs throughout Northeast Florida.";
	myTags[2] = "Scholarship fund established by Jaguars Foundation in partnership with UNF now at $500,000.";
	myTags[3] = "Weaver family has donated more than $42 million to Jacksonville non-profits since 1995.";
	myTags[4] = "Nearly $60,000 raised each home game by volunteers benefits more than 65 local charities.";
	myTags[5] = "Former head coach Tom Coughlin's Jay Fund contributes $2 million to help kids with cancer.";
	myTags[6] = "Local non-profits have received NFL Grassroots field grants for youth sports fields.";
	myTags[7] = "The Jaguars makes Jacksonville an all-round better, more exciting, more livable city.";
	
	// Selects a Random Tag
	//var myRandomTag = Math.floor(Math.random()*myTags.length); 
	var myRandomTag = 0;
	
	// Selects Next Tag
	function tagsNext(){
		if(myRandomTag == (myTags.length - 1)){
			
			// Restart the array on page
			myRandomTag = 0;
			tagTimer();
			//alert(myTags[myRandomTag]);
		} else {
			myRandomTag ++;
			tagTimer();
			//alert(myTags[myRandomTag]);
		};
	};
	
	// Hide all tags
	function tagHide(){
		$('.tagCon').fadeOut(1000, tagShow);
		//alert("hiding");
	};
	
	// Shows active tag
	function tagShow(){
		$('.tagCon').html(myTags[myRandomTag]);
		$('.tagCon').fadeIn(2000, tagsNext);
		//alert("showing");
	};
	
	// Timer 
	function tagTimer(){
		//$('.tagCon').oneTime(5000, tagHide);
		$('.tagCon').everyTime(8000, tagHide);
		///alert("timer");
	};
	
	tagShow();
});