// JavaScript Document
 var selectedDetailTabName;

  function changeDetailPageTab(tabName) {

    for (var i in tabArray) {
    
      var tabObj = tabArray[i];
      
      if (tabObj == null)
        continue;
        
      // set the tab image to 'on' or 'off'
      var tab = document.getElementById('tab_' + tabObj.name);
      if (tab != null){
        tab.type = "image";
        if (tabObj.name == tabName)
          tab.src = tabObj.onImg;
        else
          tab.src = tabObj.offImg;
      }
      // show this tab, hide all others
      var div = document.getElementById('div_' + tabObj.name);
      if (div != null)
        if (tabObj.name == tabName) 
          div.style.display = "block";
        else
          div.style.display = "none";
      // Turn the accessibility images off.
       var div2 = document.getElementById('access_' + tabObj.name);
       if (div2 != null) 
          div2.style.display = "none";
  
    } // foreach tab

    // remeber which tab is selected
    selectedDetailTabName = tabName;
   
    // Handle accessibility text.
   // var access = document.getElementById('ddiv');
   // var text = "There are " + tabArray.length + " buttons in the next section, to make the tab readable click it and navigate past the buttons. The currently selected tab is " + tabName + ".";
    //access.innerHTML = text;
 
    // hide or display the "see more info" link
    var moreInfoLink = document.getElementById('moreInfoLink');
    if (moreInfoLink != null) {
      if (tabObj.enableMoreInfoLink)
        moreInfoLink.style.display = "block";
      else
        moreInfoLink.style.display = "none";
    }
    

  }

  function setTabFocus(e, tabName) {
    var key;
    if (window.event) key = e.keyCode;
    if (e.which) key = e.which;
    if (key != 13) return;
    changeDetailPageTab(tabName);
  }

