/* Runs through the page, making sure the right things are shown and hidden */
function updatepage() {
    if (! document.getElementById) return true;

    var showdocs = document.getElementById('showdocs');
    if (showdocs.checked) {
      showIt("docs", "block");
    } else {
      hideIt("docs");
    }

    var showlong = document.getElementById('showlong');
    if (showlong.checked) {
      showIt("longquery", "block");
      hideIt("searchform");
    } else {
      showIt("searchform", "block");
      hideIt("longquery");
    }
    return false;
}

/* Given an element name, conceals it if it exists and if the browser is OK. */
function hideIt(elementName) {
    if (! elementName) return true;

    if (! document.getElementById) return true;
    var element = document.getElementById(elementName);
    if (! element) return true;

    element.style.display = 'none';

    return false;
}

/* Given an element name, shows it if it exists and if the browser is OK. Can
   optionally be passed a display style to show as, but defaults to inline. */
function showIt(elementName, todisplay) {
    if (! elementName) return true;
    if (! todisplay) todisplay = 'inline';

    var element = document.getElementById(elementName);
    if (! element) return true;

    element.style.display = todisplay;

    return false;
}
