	// This code should go in a JavaScript source file and be included on the page AFTER the UICS JavaScript files
	// Are you already using a 'uk extensions' JavaScript file? If not, speak to me to see how we've done it elsewhere to prevent major theme disruption
	
	// Here, we extend a UICS object to add our own 'rules'
	Object.extend(CS.v3.componentTargets, {
		// The rule for showing all rows in a tree table
		'csShowTreeTableRows': {
			component:'',
			fire: function(target,event) {
		
				// Stop the click on the link from performing it's normal action.
				event.preventDefault(event);
				// Read the 'nodes to show' data attribute and use the first string (the section ID) to determine all the hide/show link sin the tree table
				var attr = $$(target.readAttribute('data-csnodestoshow').split(' ').first() + ' a.csToggle');
				// Process each item (link) in the array
				attr.each(function(el) {
					// Add a class to the link to change it's icon
					el.addClassName('csToggleShow');
					// Add a class to the links parent (span) - doesn;t appear to do anything but this is what core code does, so keep it for completeness
					el.up().addClassName('csIconShow');
					// Remove the class that is hiding each of the rows that this link toggles (there may be more than one)
					$$(el.readAttribute('data-csnodestotoggle')).invoke('removeClassName', 'csHide');
				});
			}
		}
		,
		// The rule for hiding all rows in a tree table
		// No comments, see above, it's just the reverse :)
		
		'csHideTreeTableRows': {
			component:'',
			fire: function(target,event,section) {
				event.preventDefault(event);
				var attr = $$(target.readAttribute('data-csnodestohide').split(' ').first() + ' a.csToggle');
				attr.each(function(el) {
					el.removeClassName('csToggleShow');
					el.up().removeClassName('csIconShow');
					$$(el.readAttribute('data-csnodestotoggle')).invoke('addClassName', 'csHide');
				});
			}
		}
	});	
