/******************************************************************************
 * Rotating Puff Begone
 * version 0.0.2
 * 05/11/2005
 * Based on a similar GreaseMonkey script by Alexander Else
 * Copyright (c) 2005, Adam Kent
 * Copyright (c) 2005, Alexander Else
 * (see http://www.else.id.au/greasemonkey-scripts.php for original code)
 * Released under the GPL license, version 2
 * http://www.gnu.org/copyleft/gpl.html
 ******************************************************************************/

// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.  To install it, you need
// Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Rotating Puff Begone", and click Uninstall.
//
// --------------------------------------------------------------------

// ==UserScript==
// @name          Rotating Puff Begone
// @namespace     http://semicircular.net
// @description   Remove the right hand column "rotating puff" from the SMH
// @include       http://*.smh.com.au/*
// @include       http://smh.com.au/*
// @include       http://*.theage.com.au/*
// @include       http://theage.com.au/*
// ==/UserScript==

(function()
{
    var idDiv, idDivs, content, contentStyle;

    function xpath(query) {
        return document.evaluate(query, document, null,
            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    }

    function killNode(target) {
        if(target.parentNode) {
            target.parentNode.removeChild(idDiv);
        } else {
            delete(target);
        }
    }

    idDivs = xpath("//div");

    for(var i = 0; i < idDivs.snapshotLength; i++) {
        idDiv = idDivs.snapshotItem(i);
	switch(idDiv.id) {
            case 'rotatingpuff':
            case 'networkStripAd':
            case 'adSpotBanner-Leader':
            case 'adSpot-textBox':
            case 'adSpot-textBox2':
            case 'adSpotIsland':
            case 'adSpot-navsearch':
            case 'adSpot-advertorial':
            case 'printout-sponsor':
                killNode(idDiv);
            default:
        }
        switch(idDiv.className) {
            case 'adSpot-textBox':
                killNode(idDiv);
            default:
        }
    }
}
)();


