function OpenComments (c) {
    window.open('/spike/mt/mt-comments.cgi?' +
                    'entry_id=' + c,
                    'comments' + c,
                    'width=480,height=480,scrollbars=yes,status=yes');
}

function OpenLinksComments (c) {
    window.open(c,
                    'comments',
                    'width=480,height=480,scrollbars=yes,status=yes');
}

function NewOpenComments (s, c) {
    window.open('http://www.fiveandtwenty.com/spike/' + s,
                    'comments' + c,
                    'width=480,height=480,scrollbars=yes,status=yes');
}

function OpenEmailTo (c) {
    window.open('/spike/emailthis.php?' +
                    'mtentryid=' + c,
                    'emailtowin',
                    'width=400,height=480,scrollbars=yes,status=yes');
}

function update_frame(myoptions, usephp, newwindow) {
        destination = myoptions[myoptions.selectedIndex].value;
          if (destination == " ") {
            return true;
          }
         if (usephp == 0)
           window.open(destination, '_blank');
         else {
          if (newwindow == 1)
            window.open('/spike/go.php?url=' + destination, '_blank');
          else
            window.location.href = '/spike/go.php?url=' + destination;
        }
        return true;
}


function OpenTrackback (c) {
    window.open(c,
                'trackback',
                'width=480,height=480,scrollbars=yes,status=yes');
}

function getRefToDiv(divID) {
    if( document.layers ) { //Netscape layers
        return document.layers[divID]; }
    if( document.getElementById ) { //DOM; IE5, NS6, Mozilla, Opera
        return document.getElementById(divID); }
    if( document.all ) { //Proprietary DOM; IE4
        return document.all[divID]; }
    if( document[divID] ) { //Netscape alternative
        return document[divID]; }
    return false;
}

function changeDisplay( elementId, setTo ) {
    if( document.getElementById ) {
        //DOM
        var theElement = document.getElementById( elementId );
    } else {
        if( document.all ) {
            //Proprietary DOM
            var theElement = document.all[ elementId ];
        } else {
            //Create an object to prevent errors further on
            var theElement = new Object();
        }
    }
    if( !theElement ) {
        /* The page has not loaded or the browser claims to support
        document.getElementById or document.all but cannot actually
        use either */
        return;
    }
    //Reference the style ...
    if( theElement.style ) { theElement = theElement.style; }
    if( typeof( theElement.display ) == 'undefined' &&
    !( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) {
      //The browser does not allow us to change the display style
      //Alert something sensible (not what I have here ...)
      window.alert( 'Your browser does not support this' );
      return;
    }
    //Change the display style
    theElement.display = setTo;
}

function hidelinks() {
  changeDisplay("midcolumn", "none");
  changeDisplay("toggleoff", "none");
  changeDisplay("toggleon", "inline");
}

function showlinks() {
  changeDisplay("toggleon", "none");
  changeDisplay("toggleoff", "inline");
  changeDisplay("midcolumn", "block");
}