 $(document).ready(function() {

 
 /*	Home page, 4 boxes
	------------------	*/
	
	if ($(document).width() >= 768) {
		$(".tab_content").each( function() {
			$(this).css("position","relative");	
			
			if(!$(this).hasClass("active_content")) {
				$(this).css("display","none");
			}
		});
	
		$(".jmango_tab").click(function() {
			$(this).addClass("active_tab");
			
			//Find the current active tab and content
			var newSelection = $(this);
			$(this).siblings('.active_tab').each(function(i,activeTab) {
				// Remove the active flag from last Tab
				var activeTab = $(this);
				activeTab.removeClass("active_tab");
				
				// Fade out the last panel and fade in the new panel
				$("#" + $(this).attr('id') + "_content").hide().removeClass("active_content");
				$("#" + newSelection.attr('id') + "_content").fadeIn("300", function() {
					$(this).addClass("active_content");
				});		
			});
		});
		
		$("#customers .jmango_tab").hover(function() {
			$(this).addClass("active_tab");
			
			//Find the current active tab and content
			var newSelection = $(this);
			$(this).siblings('.active_tab').each(function(i,activeTab) {
				// Remove the active flag from last Tab
				var activeTab = $(this);
				activeTab.removeClass("active_tab");
				
				// Fade out the last panel and fade in the new panel
				$("#" + $(this).attr('id') + "_content").hide().removeClass("active_content");
				$("#" + newSelection.attr('id') + "_content").fadeIn("300", function() {
					$(this).addClass("active_content");
				});		
			});
		});
		
		$("#teamTab .jmango_tab").hover(function() {
			$(this).addClass("active_tab");
			
			//Find the current active tab and content
			var newSelection = $(this);
			$(this).siblings('.active_tab').each(function(i,activeTab) {
				// Remove the active flag from last Tab
				var activeTab = $(this);
				activeTab.removeClass("active_tab");
				
				// Fade out the last panel and fade in the new panel
				$("#" + $(this).attr('id') + "_content").hide().removeClass("active_content");
				$("#" + newSelection.attr('id') + "_content").fadeIn("300", function() {
					$(this).addClass("active_content");
				});		
			});
		});		
		
		$("#ourLineUp .jmango_tab").hover(function() {
			$(this).addClass("active_tab");
			
			//Find the current active tab and content
			var newSelection = $(this);
			$(this).siblings('.active_tab').each(function(i,activeTab) {
				// Remove the active flag from last Tab
				var activeTab = $(this);
				activeTab.removeClass("active_tab");
				
				// Fade out the last panel and fade in the new panel
				$("#" + $(this).attr('id') + "_content").hide().removeClass("active_content");
				$("#" + newSelection.attr('id') + "_content").fadeIn("300", function() {
					$(this).addClass("active_content");
				});		
			});
		});	
		
		$("#by_territory .jmango_tab").hover(function() {
			$(this).addClass("active_tab");
			
			//Find the current active tab and content
			var newSelection = $(this);
			$(this).siblings('.active_tab').each(function(i,activeTab) {
				// Remove the active flag from last Tab
				var activeTab = $(this);
				activeTab.removeClass("active_tab");
				
				// Fade out the last panel and fade in the new panel
				$("#" + $(this).attr('id') + "_content").hide().removeClass("active_content");
				$("#" + newSelection.attr('id') + "_content").fadeIn("300", function() {
					$(this).addClass("active_content");
				});		
			});
		});	
		
 	}
 });
