function clientSideInclude(id, url, active) {
	var req = false;
	
	if (window.XMLHttpRequest) { //For Safari, Firefox, and other non-MS browsers
		try {
			req = new XMLHttpRequest();
		} catch (e) {
			req = false;
		}
	} else if (window.ActiveXObject) { //For Internet Explorer on Windows
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				req = false;
			}
		}
	}
	
  var element = document.getElementById(id);
  if (!element) {
    alert("Bad id " + id + " passed to clientSideInclude. You need a div or span element with this id in your page.");
    return;
  }
  
	if (req) {

		//Synchronous request, wait till we have it all
		req.open('GET', url, false);
		req.send(null);
    include_html = req.responseText;
		element.innerHTML = include_html;
		
		//Get the location of the file being included so we can adjust the links correctly
    slash = url.lastIndexOf("include/");
    if (slash != -1) {
      url_prefix = url.slice(0, slash);
      
      var links = element.getElementsByTagName("a");
      for (var i = 0; i < links.length; ++i) {
        links[i].href = links[i].href.replace(/URLBASE/, url_prefix);
      }
    }
		
		//Set the active element, used when including the header
		if (active) {
			var links = element.getElementsByTagName("a");
			for (var i = 0; i < links.length; ++i)
				if (links[i].name == active)
					links[i].id = "active";
		 }
	} else {
		element.innerHTML = "Sorry, your browser does not support XMLHTTPRequest objects. This page requires Internet Explorer 5 or better for Windows, or Firefox for any system, or Safari. Other compatible browsers may also exist.";
	}
}

function hideByName(name, hidden)
{
  if (hidden == null)
    hidden = true;
   
  var elements = document.getElementsByName(name);
  
  for (var i = 0; i < elements.length; i++)
    elements[i].style.display = hidden ? "none" : "";
}