// TWoP: Hide Enormous Header
// Copyright (c) 2006-2007 Orbona
// Version 1.0
// Release Date: 2008-04-28
//
// See also: http://www.orbona.com/greasemonkey/
//
// Original file name: twop_hideheader.user.js
// Please reference the original file name when contacting me regarding this
// script.
//
// This software is licensed under the CC-GNU GPL:
// http://creativecommons.org/license/cc-gpl
//
//---------------------------------------------------------------------------
// DESCRIPTION
//
// This script hides the enormous header at the top of the page.

// ==UserScript==
// @name            TWoP: Hide Enormous Header
// @description     Hides the enormous header at the top of the TWoP pages
// @namespace       http://www.orbona.com/greasemonkey/
// @include         http://forums.televisionwithoutpity.com/*
// ==/UserScript==

function doIt() {
   var header = document.getElementById('header');
   if (header) header.style.display = "none";

   var script = document.createElement('script');
   script.type = 'text/javascript';
   scriptText="function toggleVisibility(theID, theToggleID, toggleText) {\n  var theSectionElement = document.getElementById(theID);\n\n   var theToggleElement = theToggleID ? document.getElementById(theToggleID) : null;\n\n  if (theSectionElement.style.display != 'none') {\n      theSectionElement.style.display =  'none';\n\n      if (theToggleElement) theToggleElement.innerHTML= 'Show' + toggleText;\n   }\n   else {\n      theSectionElement.style.display = '';\n      if (theToggleElement) theToggleElement.innerHTML= 'Hide ' + toggleText;\n\n   }\n}\n";
   script.innerHTML = scriptText;
   document.body.appendChild(script);

   var headerToggle = document.createElement("div");
   headerToggle.innerHTML='<div><a href="#" id="header-toggle" onclick="toggleVisibility(\'header\', \'header-toggle\', \'Header\'); return false;">Show Header</a></div>';
   header.parentNode.insertBefore(headerToggle, header);

}

window.addEventListener("load", function() { doIt(); }, false);

