/* JavaScript Document for controlling Tab display */

var curr_display = '';

addEvent(window, 'load', initPage) ;

function initPage() {
	the_hash = window.location.hash;
	if (the_hash == ''||hashToKey(the_hash) == 'container'||hashToKey(the_hash) == 'top') {
		curr_display = 'what'
		makeHistory('what');
	} else {
		curr_display = hashToKey(window.location.hash);
	}
	document.getElementById('tab_content_loading').style.display = 'none';
	showSection(curr_display);
}

function makeHistory(newHash) {
	window.location.hash = newHash;
}

function hilightTab(id,TorF) {
	if (curr_display != id) {
		document.getElementById(id + '_tab').className = (TorF) ? 'rollover' : 'active';
	}
}

function displaySection(key) {
	hideSection(curr_display);
	showSection(key);
	makeHistory(key);
	curr_display = key;
}

function showSection(key) {
	document.getElementById(key+'_tab').className = 'current';
	document.getElementById(key+'_content').className = 'now_showing';
}

function hideSection(key) {
	document.getElementById(key+'_tab').className = 'active';
	document.getElementById(key+'_content').className = 'in_the_wings';
}

function hashToKey(hash) {
	hash_parts = hash.split('#');
	return hash_parts[1];
}