  var thisHost = location.hostname;
  var thisPage = location.pathname;

  // First remove the host name.
  var re = new RegExp('.*' + thisHost);
  thisPage = thisPage.replace(re,'');

  // Then remove TeamSite-specific path components.
  re = new RegExp('.*(/STAGING|/WORKAREA/[^/]+)');
  thisPage = thisPage.replace(re,'');

  // Remove trailing "index.htm", if any.
  re = new RegExp('/(index.html?)?\$');
  thisPage = thisPage.replace(re,'');
  
  var navCell = document.getElementById('content-row-navigation');
  var links = navCell.getElementsByTagName('a');
  var currentPageLink;
	if (thisPage != '')
		{
		for (var i = 0; i < links.length; i++)
			{
			re = new RegExp(thisPage + '(/(index.html?)?)?\$');
			if (links[i].href.match(re))
				{
				currentPageLink = links[i];
				}
			}
		}
  
  // Highlight the current page.
  addClass(currentPageLink, 'current-page');
  
  // Collapse all ULs.
  var uls = navCell.getElementsByTagName('ul');
  for (var i = 0; i < uls.length; i++) {
    addClass(uls[i], 'navigation-collapsed');
  }

  if (currentPageLink) {
    // Expand relevant navigation tree sections.
    var currentNode = currentPageLink;
    while (currentNode) {
      if (currentNode.nodeName.toUpperCase() == 'UL') {
        removeClass(currentNode, 'navigation-collapsed');
      }
      currentNode = currentNode.parentNode;
    }
    var siblingNodes = currentPageLink.parentNode.childNodes;
    for (var i = 0; i < siblingNodes.length; i++) {
      if (siblingNodes[i].nodeName.toUpperCase() == 'UL') {
        removeClass(siblingNodes[i], 'navigation-collapsed');
      }
    }
  }
  