jQuery(function($) {
	// Figure out the location based on the browser URL
	var path = location.pathname;

	// Set your homepage here, eg. /index.php or /
	var home = "/";
	// Check the home link against the path and set the navigation accordingly. 
	if (path == home || path == "/") {
		// Note that the jQuery selector matches *only* the home link
		var $nav = $('#nav a[@href="' + home + '"]');
	} else {
		var $nav = $('#nav a[@href$="' + path + '"]');
	}

	// Hide all subnavigation
	$('#nav li ul').hide();

	// Add the active class to the current path and activate it's subnavigation
	$nav.addClass('current').siblings("ul").slideDown();
	
	// If the active class has subnavigation, show it
	$nav.parents("ul").show();
});
