// JavaScript Document JavaScript created by James Owens, Questions? Contact me: 773.271-3837, audiomonkey@earthlink.net. Matt Kruse provided the AnchorPosition function, navcell_sixs. www.mattkruse.com

//Array for locating which tab is active 

var tbEl = ["tabOne"]; 

function tabSelect(tb) {

if (tb != tbEl[0]) {
	//1. the number of tabs and the names of the tabs are retrieved from the table "tabsTable" 
	tabRow = document.all.tabsTable.rows[0];//find the correct row on the tabsTable
	tabCount = tabRow.cells.length;//Count the cells (minus 1 for the spacer cell)
		for (j=1; j<tabCount; j++) {
			tbEl[j] = tabRow.cells[j].id;//Load the innerHTML into the array
		}
	
	//alert(posT);
	var selectedTab = eval("document.all." + tb);
	//var selectedAnc = eval("document.all." + tb + "A");
	var selectedDiv = eval("document.all." + tb + "Div");
	// Activate the selected tab elements
			selectedTab.className = 'tab_on';
			selectedTab.children[0].className = 'tab_link_on';
			selectedDiv.style.display = "inline";
		
	
	// Set styles to prior tab (tbEl[1]) to non-selected
			otherTab = eval("document.all." + tbEl[0]);
			otherDiv = eval("document.all." + tbEl[0] + "Div");
			otherTab.className = 'tab';
			otherTab.children[0].className = 'tab_link';
			otherDiv.style.display = "none";
	
	 for (i=1; i<=tbEl.length; i++) //Loop for selected tab
		{
		if (tb == tbEl[i]) //Found selected tab
			{
			for (j=i; j-1>0; j--) 
				{//3. set styles for cells to the left of the selected tab
				leftTab = eval("document.all." + tbEl[j-1]);
				leftTab.className = 'tab_l';
				}
			for (j=i; j<tbEl.length-1; j++) 
				{//4. set styles for cells to the right of the selected tab
				rightTab = eval("document.all." + tbEl[j+1]);
				rightTab.className = 'tab';			
				}
			i = tbEl.length;
			} 
		}
	tbEl[0] = tb;	
	}
}