$(function()
{
	//Matches the current page to the relveant A tag and applies the class `tree_current_page`
	$('#internal-nav a[href="'+location.href+'"]').addClass('tree_current_page');
	
	//Add the class `actve_tree` to the parent li of the a tag with the class `tree_current_page`
	$('a.tree_current_page').parent('li').addClass('active_tree');
	
	//Add the class `top_level_tree` to the top parent li from the active_tree
	$('li.active_tree').parents('li').addClass('top_level_tree');
	
	//Hides all nested li's which parent's li dosen't have the `top_level_tree` class
	$('#internal-nav li:not(.top_level_tree) li').hide();
	
	//Hides all nested li's which parent's li dosen't have the `top_level_tree` class
	$('li.active_tree li ul:not(.active_tree)').hide();
	
	//Shows all the nested li's within the li's with the class `active_tree`
	$('li.active_tree li').show();
	
	//Removes the class backgrounded from the first three visible li's	
	$('#internal-list li:visible').slice(0, 3).removeClass('backgrounded');
	
	//Add the class `bordered` to the last visible a
	$('#internal-list a:visible:last').addClass('bordered');
	
	//Add the &raquo; html entity if the li has a child/ren ul
	$("#internal-nav li:has(ul)").find("a:first").append(" &raquo; ");
});