
// ******************************************************
// Hide Navigation Elements Function
//
// Resets the site navigation. Removes any arrow graphic 
// indicator of which section is selected, and clears out
// any subnav that may be selected.
//
// ******************************************************	

function hideNavElements() {

	$('.submenu').hide();
	$('.submenu_selected').hide();
	$('.nav_arrow img').hide();
	
	// Reset Archive Submenu
	
	$("div[id*='subarchive_']").show();
	$(".subarchive_menu").hide();
	
	// Reset Shop Menu
	
	$("div[id*='shopcategory_']").show();
	$(".shopcategory_menu").hide();	
	
	return true;

}

// ******************************************************
// Sub Navigation Function
//
// Fades in the appropriate subnavigation menu and 'selected'
// arrow. It removes any previously selected subnav or selected 
// arrow first. 
//
// ******************************************************	

function showSubnav(navsection) {

	$('#bodycontent_inner').fadeTo('slow', 1);

	var nav_arrow = '#' + navsection + '_arrow';
	var nav_menu = '#' + navsection + '_menu';

	if (hideNavElements()) {

		$(nav_arrow).fadeIn('slow');

		$(nav_menu).fadeIn('slow');

	}

	return true;
}

function showArchiveNav(year) {

	$('#bodycontent_inner').fadeTo(300, 0.3);
	
	$('.subarchive_menu').fadeOut('slow');
	
	$(".subnav_item a").css('font-weight','normal');
	
	$(year).children().fadeIn('slow');
	$('a[href$="#"]', year).css('font-weight','bold');
}

function showShopNav(category) {

	$('#bodycontent_inner').fadeTo(300, 0.3);
	
	$('.shopcategory_menu').fadeOut('slow');
	
	$(".subnav_item a").css('font-weight','normal');
	
	$(category).children().fadeIn('slow');
	$('a[href$="#"]', category).css('font-weight','bold');
}


// ******************************************************
// jQuery Loading Script
//
// Attaches the subnav function to each of the three main 
// Navigation links (About, Archive & Shop
//
// ******************************************************


$(document).ready(function() {

	$('#about_link').click(function() {

		showSubnav('about');

	});

	$('#archive_link').click(function() {

		showSubnav('archive');

	});

	$('#shop_link').click(function() {

		showSubnav('shop');

	});
	
	$("div[id*='subarchive_']").click(function() {

		showArchiveNav(this);

	});	
	
	$("div[id*='shopcategory_']").click(function() {

		showShopNav(this);

	});	
		

});
