function activateMenu()
{
	var m = /.+\/([^_]+).*\.aspx/.exec(document.location.href);
	var f = m != null ? m[1].toLowerCase() : "default";

    $("#" + f).addClass("active");
}

function activateSubMenu()
{
	$("#subnav li a").each(function(i, item)
	{
		if (item.href && item.href.toLowerCase() == document.location.href.toLowerCase())
			$(item).addClass("active");
	});
}


function setupExternalLinks() 
{	
	$("a").each(function(i, item)
	{
		if (item.rel.toLowerCase() == "external")
		{
			$(item).bind("click", function()
			{
				window.open(this.href, "external");
				return false;
			});
		}
	});
}

$(document).ready(function() {
    setupExternalLinks();
	activateMenu();	
    activateSubMenu(); 
	
	/*$("#closeRibbon").click(function(i, item)
	{
		$("#ribbonContainer").fadeOut("slow");
		return false;
	});*/
	
});