// when the DOM is ready
$(document).ready(function(){
	
	// hide the external link
	$('#rsslink').hide(); // may have to remove if required 
	
	// override the link style
	$('#news a').css({ 
		
		textDecoration:'none',
		fontSize:'12px',
		fontWeight:500,
		color:'#4aa2b0',
		lineHeight:'14px'
		
	});
	
	// hide the news loader icon
	$('#news-loader').hide();
	
	// show the news links
	$('#news').fadeIn(); 
	
	// set the isAnimating attribute to all tabs for the tabIsAnimating condition
	$(".navigation-tab").attr("isAnimating","nope"); 
		
	// sub tab event (animation open)
	$(".navigation-tab[tab]").mouseenter(function(){
		
		tab = $(this); // create the tab object
		
		tabName = tab.attr("tab");	// create the tab name object
		tabIsAnimating = tab.attr("isAnimating"); // create the tabIsAnimating object for condition
		
		subTab = $(".navigation-subtab[tab="+tabName+"]"); // create the sub tab object
			
		$(".navigation-subtab[tab!="+tabName+"]").stop(true,true).fadeOut(200); // stop all other tab animations and fire callbacks, then close all the other tabs
		
		// only open the sub tab if it's not already animating
		if(tabIsAnimating == "nope"){	
		
			tabIsAnimating = "yep"; // set the tab as animating
	
			subTab.slideDown(300,function(){
			
				tabIsAnimating = "nope"; // set the tab as not animating anymore when completed [via callback]
				
			});	
				
		}
				
	});
	
	// sub tab event (animation close) when mouse away 
	$("#header, #navigation, #content, #after-divider, #footer").mouseenter(function(){
			
		$(".navigation-subtab[tab]").stop(true,true).fadeOut(200); // cloase all sub tabs	
		$(".navigation-tab").attr("isAnimating","nope"); // reset the isAnimating attribute on all tabs 
		
	});
						   
	$('#container-telephone-background[myURL]').live("click",function(){
		
		myURL = $(this).attr("myURL");
		
		window.open(myURL);
	
	});
	
});
