jQuery(document).ready(function()
{
	// Setup base variables
	loadLimit = 9; // The number of loads the thrumming effect takes place during
	theContent = jQuery("#menufirst").html();
	
	// Create our cookie if it hasn't been created yet
	if (document.cookie.indexOf("loadCount") == -1)
	{
		var theDate = new Date();
		theDate.setDate(theDate.getDate()+14);
		document.cookie = "loadCount=0; expires="+ theDate.toGMTString();
	}
	
	// Check our load cookie to make sure that the effect only occurs a handful of times
	loadCookie = document.cookie;
	countPos = loadCookie.indexOf("loadCount=") + 10;
	loadCount = parseInt(loadCookie.substring(countPos,countPos+1));	
	
	// If the number of pages viewed is under the limit, animate the nav
	if (loadCount < loadLimit)
	{
		loadCount++;
		var theDate = new Date();
		theDate.setDate(theDate.getDate()+14);
		document.cookie = "loadCount="+loadCount+"; expires="+ theDate.toGMTString();
	
	
		setTimeout(animateOutAlt2, 5000);
		animateCount = 0;
		animateLimit = 2;
		animateLimitAlt2 = 6;
	}
});



function animateOutAlt2()
{
	jQuery("#menufirst").append("<img id='thrumTemp' style='position:absolute; z-index:100; top:16px; right:-1px; opacity:0;' src='templates/client/images/menu/menuThrum.png' alt=''>");
	
	timeout = 0;
	
	for (i=0; i<animateLimitAlt2; i++)
	{
		timeout += 2700;
		setTimeout(animateBeginAlt2,timeout);
	}
}

function animateBeginAlt2()
{
	jQuery("#menufirst").animate({
	color:'orange'
	}, 1250);
	
	jQuery("#thrumTemp").animate({
	opacity:1.0
	}, 1250, animateReturnAlt2);
}


function animateReturnAlt2()
{
	jQuery("#menufirst").animate({
	color:'white'
	}, 1250);
	
	jQuery("#thrumTemp").animate({
	opacity:0
	}, 1250);
}
