// ==UserScript==
// @name			CFDJ - Cleaner
// @namespace		http://www.bennadel.com/
// @description		This cleans up the CFDJ page so that it
//					does not drive me crazy and make me want
//					to go around killing people.
// @include			http://coldfusion.sys-con.com/*
// ==/UserScript==


// Get page elements.
var objHeader = document.getElementById( "pageheader" );
var objPanel1 = document.getElementById( "#panel1" );
var objPanel6 = document.getElementById( "#panel6" );
var objMainPanel = document.getElementById( "#mainpanel" );

// Try to manipulate the DOM.
try {

	// Check to see if the header was found.
	if (objHeader){
	
		// Grab the tables from the header, but then get a
		// to the first one. This is the main navigation
		// table. We don't want to kill it.
		var objHeaderTable = objHeader.getElementsByTagName( "table" )[ 0 ];
		
		// Get the parent to this table.
		var objParent = objHeaderTable.parentNode;
	
		
		// Loop over the parent children in reverse order (so we
		// don't go out of bounds). 
		for (
			var intChild = (objParent.childNodes.length - 1) ; 
			intChild >= 0 ; 
			intChild--
			){
			
			// Get a pointer to the current node.
			var objNode = objParent.childNodes[ intChild ];
			
			// Check to make sure the current node is NOT our
			// main navigational table. Remember, we don't want
			// to kill that one.
			if (objNode != objHeaderTable){
		
				// Remove this child.
				objParent.removeChild( 
					objNode
					);
		
			}
		}
		
	}
	
	
	// Check for elemnts and remove them.
	if (objPanel1){	
		objPanel1.parentNode.removeChild( objPanel1 );
	}
	
	if (objPanel6){
		objPanel6.parentNode.removeChild( objPanel6 );
	}
	
	
	// Now that we have more room, let's increase the width
	// of the main content area.
	if (objMainPanel){ 
		objMainPanel.style.width = "700px";
	}
	
	
} catch (objError){
	
	// Something went wrong.
	alert( "Greasemonkey Error:\n\n" + objError );
	
}
