function roundOnLoad() {
   Nifty("div.roundDiv", "big");
   Nifty("div.roundTopDiv", "top");
   Nifty("div.roundTopContainer", "top");
}

function showOnly(which) {
   newTab = which + "_tab";
   newContent = which + "_content";
   // Find whichever stuff is currently active and make it inactive
   currentTab = getElementsByTagAndClassName("*", "leftTabSelected")[0];
   removeElementClass(currentTab, "leftTabSelected");
   currentContent = getElementsByTagAndClassName("*", "leftTabVisibleContent")[0];
   removeElementClass(currentContent, "leftTabVisibleContent");
   addElementClass(currentContent, "invisible");
   // Now make the newly selected tab and content have the right styles
   addElementClass(newTab, "leftTabSelected");
   removeElementClass(newContent, "invisible");
   addElementClass(newContent, "leftTabVisibleContent");
}

// On page load we check to see if there's an anchor in the URL. If so we
// highlight the corresponding tab if the page has left-side tabs and there's a
// tab with an id that matches the hash.
function showOnlyHash() {
   var parts = location.href.split('#');
   if (parts.length > 1) {
      var anchor = parts[1];
      // Find a table containing left tabs if one exists - we assume only 1
      var tabTable = document.getElementById('inPageTabsTable');
      if (tabTable) {
         var contentToShow = anchor + "_content";
         var contentDiv = document.getElementById(contentToShow);
         if (contentDiv) {
            showOnly(anchor);
         }
      }
   }
}

addLoadEvent(roundOnLoad);
addLoadEvent(showOnlyHash);
