/**
 * This script is used on the 'monument detail' page. It started
 * out as a pretty generic script, but unfortunately it is not
 * really generic anymore. So watch out what you copy paste.
 */
function showTab( nID )
{
  /* hide all other tabs */
  for( var i = 0; i < 4; i++ )
  {
    var oTab = document.getElementById( "tab" + i );
    var oTabHeader = document.getElementById( "tabheader" + i );

    if( oTab != null && oTabHeader != null )
    {
      oTab.style.display = "none";
      oTabHeader.className = "tabheader" + ( i == 0 ? " first" : ( i == 3 ? " last" : "" ));
    }
  }
  
  /* show the tab specified by the parameter */
  oTab = document.getElementById( "tab" + nID );
  oTabHeader = document.getElementById( "tabheader" + nID );
  
  if( oTab != null && oTabHeader != null )
  {
    oTab.style.display = "block";
    oTabHeader.className = "tabheader selected" + ( nID == 0 ? " first" : ( nID == 3 ? " last" : "" ));
    
    var loadFunc = oTab.getAttribute( "ontabload" );
    
    if( loadFunc != null )
    {
      eval( loadFunc );
    }
  }
}

