/* $Id: xpander.js,v 1.6 2008/03/29 01:25:29 bob Exp $ */

// Toggles the visibility of element using the blind effect.
//
function toggleXpander(item) {
	new Effect.toggle($($($(item).next('.xpander')).identify()),'blind');
	item.toggleClassName('xpander-on');

	if (item.innerHTML == 'Show')
		item.update('Hide');
	else
		item.update('Show');
}


// Look for elements of class "xpander" and hide them, then add a "Show"
// button before them.
//
Event.observe(window,'load', function () {
	items = $$('.xpander');

	items.each(function(item) {
		item.hide();
		item.insert({before: '<a class="xpander-control" href="#" onclick="javascript:toggleXpander(this); return false">Show</a>\n'});
	});
});
