var tabBar = null;


// update the page content when the response is received
function tab_Change(responseText, status) {
	if (status == 200) {
		document.getElementById('content').innerHTML = responseText;
	} else {
		document.getElementById('content').innerHTML = "The page could not be retrieved.";
	}
}


// request page content
function tabSelect(tabBarID, tabName) {
	tabBar = document.getElementById(tabBarID);
	
	var data = "action=" + tabName;
	getAjax().query("ajax_query.php", tab_Change, data, "GET");
	formatTabBar(tabName);
}


function formatTabBar(activeTabName) {
	if (tabBar == null) {
		return;
	}
	tabs = tabBar.childNodes;
	for (var i = 0; i < tabs.length; i++) {
		tabs[i].className = "Tab";
	}
	document.getElementById(activeTabName).className = "Tab Active";
}
