﻿// Current select tab
var currentTab;

// Switch People List tabs
// @anchor clicked tab <a> reference
function showLocationList(anchor){

// Get selected tab
var newTab = anchor.parentNode;
// Get selected location string
var sLocation = 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 sCurrentLocation = currentTab.id.split("_")[1];
document.getElementById("list_"+sCurrentLocation).style.display = "none";
}


// Check to see whether we have a selected people list anchor
try {
var currentAnchor = document.getElementById("selectedAnchor");
} catch (err){
}

// 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("list_"+sLocation).style.display = "block";
// Stop anchor retaining focus highlight
anchor.blur();
// Hide currently displayed people details
try {
document.getElementById("peopleDetails").style.display = "none";
} catch (error){

}
// Deselect current people list anchor
if(currentAnchor != null){
currentAnchor.className = "";
currentAnchor.id = "";
}
}
}