/**
 * TNT - ui.js - 2012.01.17
 * User Interface functions
 */
// globals
var clicked = false;	// flag to determine when the user has clicked a link

// Set the background color for the given element
function alterBackground(element, bg) {
	if (element.style.backgroundColor == bg) {
		element.style.backgroundColor = "#000000";
	}
	else {
		element.style.backgroundColor = bg;
	}
}

// toggle the visibility of a given ID
function show(id) {
	var element = document.getElementById(id);
	if (id == "sites") {
		document.getElementById("current").style.display = "none";
		document.getElementById("experience").style.display = "none";
	}
	if (id == "experience") {
		document.getElementById("sites").style.display = "none";
		document.getElementById("current").style.display = "none";
	}
	if (element.style.display == 'block') {
		element.style.display = 'none';	// hide the element
	}
	else {
		element.style.display = 'block';	// show the element
	}
}

// show the current site
function showCurrent(id) {
	var element = document.getElementById(id);
	var current = document.getElementById("current");
	if (id == "reset") {
		current.innerHTML = "";
		current.style.display = "none";
	}
	else {
		current.innerHTML = element.innerHTML;
		current.style.display = "block";
	}
}

