var currentPage = 'page_main';
var currentTab = 'tab_main';

function highlightTab(box)
{
	if (!box || box.id == currentTab) return;
	
	var sections = box.childNodes;
	var thisClass = '';
	for (var i=0; i<sections.length; ++i)
	{
		thisClass = sections[i].className;
		if (thisClass == 'tab_left')
			sections[i].style.background = "url(images/selected_tab_left.jpg) no-repeat";
		else if (thisClass == 'tab_right')
			sections[i].style.background = "url(images/selected_tab_right.jpg) no-repeat";
		else if (thisClass == 'tab_farright')
			sections[i].style.background = "url(images/selected_tab_farright.jpg) no-repeat";
		
	}
	box.style.background = "url(images/selected_tab_mid.jpg) repeat-x";
}
function unhighlightTab(box)
{
	if (!box || box.id == currentTab) return;
	
	var sections = box.childNodes;
	var thisClass = '';
	for (var i=0; i<sections.length; ++i)
	{
		thisClass = sections[i].className;
		if (thisClass == 'tab_left')
			sections[i].style.background = "url(images/tab_left.jpg) no-repeat";
		else if (thisClass == 'tab_right')
			sections[i].style.background = "url(images/tab_right.jpg) no-repeat";
		else if (thisClass == 'tab_farright')
			sections[i].style.background = "url(images/tab_farright.jpg) no-repeat";
		
	}
	box.style.background = "url(images/tab_mid.jpg) repeat-x";
}
function showPage(ident) 
{
	document.getElementById(currentPage).style.display = 'none';
	document.getElementById(ident).style.display = 'inline';
	currentPage = ident;
	
	var tokens = ident.split('_');
	if (tokens[1])
	{
		var oldTab = currentTab;
		currentTab = 'tab_'+tokens[1];
		unhighlightTab(document.getElementById(oldTab));
		highlightTab(document.getElementById(currentTab));
	}
}