var shown = {}


/* Show a item in a set of toggleable items */
function show_block(group_name_prefix, item) {
  /* If not supported, then exit */
	if(!document.getElementsByTagName) {
		return false;
	}
	/* Make sure same type when comparing below in loop */
	item = parseInt(item);
	/* Search for all things with group prefix and toggleblock class */
	var block_divs = document.getElementsByTagName('DIV');
	var block_div;
	var block_id;
	var i = 0;
	/* Loop all blocks */
	while(block_div = block_divs.item(i++)) {
		/* Make sure right class */
		if (block_div.className.indexOf('toggleblock') < 0) {
			/* javascript enabled, show these nav bits */
			if (block_div.className.indexOf('togglenav') > -1) {
				block_div.style.display = 'block';
			}
			continue;
		}
		/* Make sure right group */
		if (block_div.id.indexOf(group_name_prefix + '_') != 0) {
			continue;
		}
		block_id = parseInt(block_div.id.replace(group_name_prefix + '_', ''));
		/* Do we hide or show */
		if (block_id != item) {
			Element.hide(block_div.id)
		} else {
			if (shown[group_name_prefix]) {
			  Effect.Appear(block_div.id, {duration: 0.5})
			} else {
			  Element.show(block_div.id)
			}
		}
		/* Shown, so we can use nice fancy effect next time */
		shown[group_name_prefix] = true
	}
	return true;
}

/* Opens an external URL in a new window */
function jump(url) {
	win=window.open(url, 'external', 'scrollbars,toolbar,menubar,location,resizable,width=800,height=600');
	win.focus();
	return false;
}

/* Shows pop up for a given term */
function term(term_name) {
	win=window.open('/terms.html#' + term_name, 'term', 'scrollbars,width=256,height=500');
	win.focus();
	return false;
}
