function selectSubNav()
{
	var bc = document.getElementById("breadcrumb");
	var bc_elems = bc.getElementsByTagName("li");
	
	//  Loop through the breadcrumb elements and select the last two
	//  This will only work for 2 level of items, if a 3rd level is added
	//  another loop will be necessary
	var i = 0;
	for (i; i < bc_elems.length; i++)
	{		
		//  Get the 2nd last item, this will be used for a parent section
		if (i == bc_elems.length - 2)
		{
			var prev_item = bc_elems[i].innerHTML;
			
			var text = bc_elems[i].getElementsByTagName("a");
			
			prev_item = text[0].innerHTML;
			prev_item = prev_item.replace(/[\s]/g, "");
		}
	
		//  Get the last item, this will be the for the selected item
		//  whether it is a parent or not
		if (i == bc_elems.length - 1)
		{
			var last_item = bc_elems[i].innerHTML;
			last_item = last_item.replace(/[\s]/g, "");
		}
	}
	
	var sidebar = document.getElementById("side-menu");
	var sb_elems = sidebar.getElementsByTagName("a");			
	
	//  Loop through the side bar items to select the ones that match with the breadcrumb
	//  If they match with the 2 last items from the breadcrumb apply a selected class to the item
	var j = 0;
		
	for (j; j < sb_elems.length; j++)
	{
		var str = sb_elems[j].innerHTML;	
		str = str.replace(/[\s]/g, "");
		
		if (str == prev_item || str == last_item)
		{			
			sb_elems[j].className = "selected";			
		}
	}
}

selectSubNav();