// global
var navInterval;

// Show Sub Nav
function showSubNav(thisSubNav) {
	// First, hide all subnavs
	document.getElementById("navHome").style.visibility = "hidden";
	document.getElementById("navAboutUs").style.visibility = "hidden";
	document.getElementById("navSolutions").style.visibility = "hidden";
	document.getElementById("navProjects").style.visibility = "hidden";
	// Then, show the desired subnav
	if (thisSubNav != null) {
		document.getElementById(thisSubNav).style.visibility = "visible";
	}
}

// Hide Sub Nav
function hideSubNav (obj) {
	obj.style.visibility = "hidden";
}

// Hide Sub Nav Delayed
function hideSubNavDelayed (thisSubNav) {
	navInterval = setInterval(function() {
		document.getElementById(thisSubNav).style.visibility = "hidden";
		clearInterval(navInterval);
	}, 800);
}

// Highlight Current Page
function highlightCurrentPage() {
	// Grab reference from query string
	var currentPage = location.search;
	// Keep only the relevant string
	currentPage = unescape(currentPage.slice(currentPage.lastIndexOf("=") + 1));
	// Create a regex pattern based on this string
	var re = new RegExp();
	re.compile("location=[^>]+\">" + currentPage);
	// Update page HTML
	document.body.innerHTML = (document.body.innerHTML).replace(re, ".html\"><span class='selected'>" + currentPage + "</span>");
}
