﻿// Current select tab
var currentTab;

// Switch Library List tabs
// @anchor clicked tab <a> reference
function libraryTab(anchor){

	// Get selected tab
	var newTab = anchor.parentNode;
	// Get selected library string
	var sLibraryType = newTab.id.split("_")[1];

	// Hide current tab if its not the new tab
	if(currentTab != undefined && currentTab != newTab){
		currentTab.className = "";
		currentTab.getElementsByTagName("img")[0].src = "/content/s2/images_refresh/backgrounds/navPeopleCap.gif";
		var sCurrentLibrary = currentTab.id.split("_")[1];
		document.getElementById("lib_"+sCurrentLibrary).style.display = "none";
	}
	
	
	// Show new tab if its not the current tab
	if(currentTab != newTab){
		newTab.className = "selected";
		newTab.getElementsByTagName("img")[0].src = "/content/s2/images_refresh/backgrounds/navPeopleSelectedCap.gif";
		currentTab = newTab;
		document.getElementById("lib_"+sLibraryType).style.display = "block";
		// Stop anchor retaining focus highlight
		anchor.blur();
	}
	
}