// set target="_blank" on <a> elements with rel="external", as this is not
// allowed directly in strict XHTML
function preparExternalLinks()
{
  if (!document.getElementsByTagName) {
    return;
  }
  var anchors = document.getElementsByTagName("a");
  for (var i = 0; i < anchors.length; ++i) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
        anchor.getAttribute("rel") == "external") {
      anchor.target = "_blank";
    }
  }
}
window.onload = prepareExternalLinks;

function grabElement(whichElement)
{
  var element;
  if (document.getElementById) {
    element = document.getElementById(whichElement);
  }
  else if (document.all) {
    element = document.all[whichElement];
  }
  else if (document.layers) {
    element = document.layers[whichElement];
  }

  return element;
}


function toggleElement(whichElement)
{
  var style = grabElement(whichElement).style;
  style.display = (style.display == 'block') ? 'none' : 'block';
}
