var isvisible = true;
window.addEvent('domready', function(){ collapse(); setEventHandlers(); });

function setEventHandlers()
{
	$$('span.author').addEvent('click', function(){
		handleshow(this);
	});
	$$('span.date').addEvent('click', function(){
		handleshow(this);
	});
}

// Take any child of div.meta and handle toggling the display state 
// of the associated div.changes
function handleshow(obj)
{
	var elem = obj.getParent().getParent().getElement('div.changes');
	var currstyle = elem.getStyle('display');
	if (currstyle == 'none')
	{
		elem.setStyle('display','block');
	}
	else
	{
		elem.setStyle('display','none');
	}
}

// If needed, toggle state of all div.changes
function toggleall()
{
	if (isvisible == true)
	{
		collapse();
		isvisible = false;
	}
	else
	{
		isvisible = true;
		expand();
	}
}

// Expand all div.changes
function expand()
{
	$$("div.changes").setStyle('display','block');
}

// Collapse all div.changes
function collapse()
{
	$$("div.changes").setStyle('display','none');
}