// JavaScript Document

$(document).ready(function(){
		$("#navMenu li").hover(function(){$(this).find(".subNavPopUp").show(500);},function(){$(this).find(".subNavPopUp").fadeOut("slow");});
		
		clientDetails.nextClient();
	});


/* ** Functions for the changing out of client logo highlights at the bottom of the page.
These will change the highlighted item shown and the text in the client area on the left depending 
on the client that is selected. */

	var TimerIDArray = new Array();
	
	var clientDetails={
		nextClient:function()
		{	
			TimerIDArray = $("#r3ClientSlider img");
			
			for(var i = 0; i < $("#r3ClientSlider img").length; i++)
			{
				setTimeout(TimerIDArray[i].addClass("active"), 4000);
				//TimerIDArray[i-1].removeClass("active");
				console.log(TimerIDArray[i]);
			}
			
			//$("#r3ClientDetails").show(1000,function(){if(jQuery.browser.msie)
			//{
			//	$("#r3ClientDetails").get(0).style.removeAttribute('filter');
			//}});			
			
			//TimerIDArray[0] = setTimeout("clientDetails.nextClient()", 4000);
		},
		showSweeps:function()
		{
			$("#sweepsDiv").css("z-index","10");			
			$("#recipesDiv").css("z-index","5");
			
			$("#newsDiv").css("display","none");
			
			$("#sweepsDiv").show(1000,function(){if(jQuery.browser.msie)
			{
				$("#sweepsDiv").get(0).style.removeAttribute('filter');	
			}});
			
			$("#recipesLink").removeClass("active");
			$("#sweepsLink").toggleClass("active");
			TimerIDArray[1] = setTimeout("clientDetails.showInsider()", 4000);
		},
		showInsider:function()
		{		
			$("#insiderDiv").css("z-index","10");			
			$("#sweepsDiv").css("z-index","5");
			
			$("#recipesDiv").css("display","none");
			
			$("#insiderDiv").show(1000,function(){if(jQuery.browser.msie)
			{
				$("#insiderDiv").get(0).style.removeAttribute('filter');	
			}});
			
			$("#sweepsLink").removeClass("active");
			$("#insiderLink").toggleClass("active");
			TimerIDArray[2] = setTimeout("clientDetails.showNews()", 4000);
		},
		showNews:function()
		{		
			$("#sweepsDiv").css("display","none");
			
			$("#newsDiv").css("z-index","10");			
			$("#insiderDiv").css("z-index","5");
			
			$("#newsDiv").show(1000,function(){if(jQuery.browser.msie)
			{
				$("#newsDiv").get(0).style.removeAttribute('filter');	
			}});
			
			$("#insiderLink").removeClass("active");
			$("#newsLink").toggleClass("active");
			TimerIDArray[3] = setTimeout("clientDetails.nextClient()", 4000);
		}
	}
	
	var ClickDivRotate={
		jumpToText:function(divClicked)
		{
			for (i = 0 ; i < 4 ; i++)
			{
				 window.clearTimeout(TimerIDArray[i]);
			}
			
			$("#insiderLink").removeClass("active");
			$("#newsLink").removeClass("active");
			$("#recipesLink").removeClass("active");
			$("#sweepsLink").removeClass("active");
			
			$("#recipesDiv").css("display","none");
			$("#sweepsDiv").css("display","none");
			$("#insiderDiv").css("display","none");
			$("#newsDiv").css("display","none");
			
			$("#recipesDiv").css("z-index","0");
			$("#sweepsDiv").css("z-index","0");
			$("#insiderDiv").css("z-index","0");
			$("#newsDiv").css("z-index","0");
			
			if(divClicked == "recipes")
			{
				clientDetails.nextClient();
			}
			else if(divClicked == "sweeps")
			{
				clientDetails.showSweeps();
			}
			else if(divClicked == "insider")
			{
				clientDetails.showInsider();
			}
			else
			{
				clientDetails.showNews();
			}	
				
			return false;
		}
	}
	