// ----------------------------------------------------------------------------
// Just a shortcut alias for the ever present document.getElementById, as popu-
// larised by the Prototype js library. Won't balk if you pass it a non-string.
// ----------------------------------------------------------------------------

function $(id) { 
	var el = (typeof id == 'string') ? document.getElementById(id) : id;
	return el;
}
// ----------------------------------------------------------------------------
// Show/hide an element, if you also pass it a reference to the clicked link it
// will try and rewrite it from "Show blah" to "Hide blah". Call like so:
// <a href="#" onclick="return toggle('whatever',this);">Show whatever</a>
// ----------------------------------------------------------------------------

function toggle(id, anchor) {
	var el = $(id);

	if (el.style.display) {
		el.style.display = ''
		if (anchor && anchor.innerHTML.indexOf('Show') > -1) {
			anchor.innerHTML = anchor.innerHTML.replace(/Show/,'Hide');
		}
	} else {
		el.style.display = 'none';
		if (anchor && anchor.innerHTML.indexOf('Hide') > -1) {
			anchor.innerHTML = anchor.innerHTML.replace(/Hide/,'Show');
		}
	}
	
	if (anchor) anchor.blur();
	return false;
}
