$(function(){
	//Open external links in a new window
	$("a[href^=http]").click(function(){
		if(!$(this).hasClass("sameWindow"))
		{
		window.open(this.href);
		return false;
		}
	});
	//Open PDFs in a new window
	$("a[href*='.pdf']").click(function(){
		window.open(this.href);
		return false;
	});
	//Open Commonspot uploaded documents in a new window
	$("a[href*='security/getfile']").click(function(){
		window.open(this.href);
		return false;
	});
	//Open page in new window based on class
	$("a.newWindow").click(function(){
		window.open(this.href);
		return false;
	});
	//Fix for CommonSpot nested lists
	//$("li ul").parent().css("background-image", "none");
	// Set up navigation highlighting
	var path = location.pathname, lastChar;
	lastChar = path.charAt(path.length - 1);
	if (lastChar === "/")
	{
		path = path + "index.cfm";
	}
	// Highlight primary nav items
	if (path.indexOf("/about-us/") != -1)
	{
		$("a.aboutUs").addClass("highlight");
	}
	else if (path.indexOf("/services-expertise/") != -1)
	{
		$("a.servicesExpertise").addClass("highlight");
	}
	else if (path.indexOf("/impact-stories/") != -1)
	{
		$("a.impact").addClass("highlight");
	}
	else if (path.indexOf("/innovation-resources/") != -1)
	{
		$("a.resources").addClass("highlight");
	}
	else if (path.indexOf("/careers/") != -1)
	{
		$("a.careers").addClass("highlight");
	}
	else if (path.indexOf("/news-events/") != -1)
	{
		$("a.newsEvents").addClass("highlight");
	}
	// Highlight current page
	$(".leftMenuContainer li a[href='" + path + "']").addClass("highlight");
});


