function registerLinkage(input, display) {
    $(input).select("input").each(
        function(inp) {
            $(inp).onclick = function() {
                $(display).select("label").each(
                    function(label) {
                        if (label.readAttribute("for") == inp.id) {
                            $(label.parentNode).addClassName("selected");
                        } else {
                            $(label.parentNode).removeClassName("selected");
                        }
                    }
                );
            }
        }
    );
}

/**
 * Attaches an onclick event to each link with rel="external" that opens the
 * link in a new window.
 */
function initExternalLinks() {
  var as = document.getElementsByTagName("a");
  for (var i = 0; i < as.length; i++) {
    if (as[i].getAttribute("rel") == "external") {
      as[i].onclick = openNewWindow;
    }
  }

  function openNewWindow() {
    window.open(this.href);
    try {
      event.returnValue = false;
    } catch (e) {}
    return false;
  }
}