function navigationswf() {
	var params = {
		base: '../media/',
		wmode: 'transparent'
	};

	var flashvars = {
		section : 'activities',
		promo : 'false',
		allowscriptaccess: 'always'
	}

	swfobject.embedSWF("../media/main_nav_loader.swf", "navigation", "1000", "227", "9.0.115","", flashvars, params);
}

function subnavigation(id) {
	$('#' + id + ' > li').click(function () { 
		$('#' + id + ' > li').removeClass('current');
		$(this).addClass('current');
		$('#sections > div').hide(); 
		$('#featured-container > div').hide();
		var showdiv = $('a', this).attr('rev');
		var showcarousel = $('a', this).attr('rel');
		var url = $('a', this).attr('href');
		$(showdiv).fadeIn();
		$('#' + showcarousel).show();
		document.location = url;
		var trackingname = $('a', this).attr('class');
		sCode.trackFeaturedContentClick('#' + trackingname, trackingname);
		return false;
	});
}

function showFeatured(navLinkId) {
	var navId = $('#' + navLinkId).parent().parent();
	$('li', navId).removeClass('current');
	$('#' + navLinkId).parent().addClass('current');
	navLinkIdSection = navLinkId.split('-')[1];
	$('#featured-container > div').hide();
	$('#featured-' + navLinkIdSection).show();
}

function sectionLocation(defaultSection) {
	var urlHalves = String(document.location).split('#');
	if((urlHalves[1] == '') || (urlHalves[1] == undefined)) {
		$('#sections > div').hide();
		$('#' + defaultSection + '-container').show();		
	} else {
		var tempSectionUrl = urlHalves[1].split('-');
		navLinkId = 'nav-' + tempSectionUrl[1];
		showFeatured(navLinkId);
		$('#sections > div').hide();
		$('#' + tempSectionUrl[1] + '-container').show();
	}
}

$(document).ready(function() {	
	var flashversion = '9.0.115';
	if(typeof(swfobject)=='object' && swfobject.hasFlashPlayerVersion(flashversion)){
          $('head').append('<style type="text/css">#navigation ul, #navigation h1, .flash-error {display: none;}</style>');
          var embedflash = true;
	} else {
          var embedflash = false;
	}
	if (embedflash) {
		navigationswf();	
	}	
});	