function fixLinks()
{
  if (!document.getElementsByTagName) return null;
  var server = document.location.hostname;
  var anchors = document.getElementsByTagName("a");
  for(var i=0; i < anchors.length; i++)
  {
    var a = anchors[i];
    var href = a.href;
    var id = a.id;
    var title = a.title;
    if ((href.indexOf("#") != -1) && (href.indexOf("header") == -1)) { // jump ref
      var index = href.indexOf("#") + 1;
      href = "javascript:show('" + href.substring(index) + "');";
      a.setAttribute("href",href);
    }
  }
}

/*
	this function goes through the links in the page, and assumes that the anchor links with "mtx_" in them
	have already been fixed up, and sets the link that matches curlink to the current link, and everything else
	that has been touched up by fixLinks() to an empty class.
*/
function setcurlink(curlink)
{	
	if(!document.getElementsByTagName) 
		return null;
		
	if(!curlink) 
		curlink = "";
		
	var anchors = document.getElementsByTagName("a");
	for(var i=0; i < anchors.length; i++)
	{
		var anch = anchors[i];
		var href = anch.href;
		if(href.indexOf("'"+curlink+"'")!=-1)
			anch.className = "current";
		else
		{
			if(href.indexOf("javascript:show(")!=-1 && anch.className=="current")
				anch.className = "none";
		}
	}
}

function hideDivs(exempt)
{
  if (!document.getElementsByTagName) return null;
  if (!exempt) exempt = "";
  var divs = document.getElementsByTagName("div");
  for(var i=0; i < divs.length; i++)
  {
    var div = divs[i];
    var id = div.id;
    if ((id != "header") && (id != "footer") && (id != exempt) && (id.indexOf("mtx_")!=-1) )
    {
      div.style.display = "none";
    }
  }
}

function show(what)
{
  if (!document.getElementById) return null;
  showWhat = document.getElementById(what);
  showWhat.style.display = "block";
  hideDivs(what);
  setcurlink(what);
}

window.onload = function()
{
  fixLinks();
  hideDivs("mtx_overview");
}
