<style type="text/css"><!--
.hidden { display: none }

.shredder-help { background-color: #ffe99d; margin: 1em 2em; padding: 1em; border-style: solid; border-color: black; border-width: 1px }
.pod-sequence-C { background-color: #eee }

.shredder-form { line-height: 3em }
.shredder-form span { margin-left: 1em; margin-right: 1em }

#shredder-select-plugin { border-style: solid; border-color: black; border-width: 1px }
#shredder-plugin-results { border-style: solid; border-color: black; border-width: 1px; margin-top: 1em; }
#shredder-plugin-results input { margin-left: 1em; }
--></style>
<script type="text/javascript">
function hideElement(node)
{
	if( !node || node.nodeType != 1  /* ELEMENT_NODE */ ) return;
	if( node.className.match( /\bhidden\b/ ) ) return;
	node.className += (node.className == '')? 'hidden': ' hidden';
}

function showElement(node)
{
	if( !node || node.nodeType != 1 /* ELEMENT_NODE */ ) return;
	node.className = node.className.replace( /\bhidden\b/, '' );
}

function walkChildNodes(parent, callback)
{
	if( !parent || !parent.childNodes ) return;
	var list = parent.childNodes;
	for( var i = 0; i < list.length; i++ ) {
		callback( list[i] );
	}
}

function walkChildElements(parent, callback)
{
	walkChildNodes( parent, function(node) {
		if( node.nodeType != 1 ) return;
		return callback( node );
	} );
}

function showShredderPluginTab( plugin )
{
	var plugin_tab_id = 'shredder-plugin-'+ plugin +'-tab';
	var root = document.getElementById('shredder-plugin-tabs');
	walkChildElements( root, function(node) {
		if( node.id == plugin_tab_id ) {
			showElement( node );
		} else {
			hideElement( node );
		}
	} );
	if( plugin ) {
		showElement( document.getElementById('shredder-submit-button') );
	} else {
		hideElement( document.getElementById('shredder-submit-button') );
	}
}

function checkAllObjects()
{
	var check = document.getElementById('shredder-select-all-objects-checkbox').checked;
	var elements = document.getElementById('shredder-search-form').elements;
	for( var i = 0; i < elements.length; i++ ) {
		if( elements[i].name != 'WipeoutObject' ) {
			continue;
		}
		if( elements[i].type != 'checkbox' ) {
			continue;
		}
		if( check ) {
			elements[i].checked = true;
		} else {
			elements[i].checked = false;
		}
	}
}
</script>
