/**
 * 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.
 */

var iactiveTab = -1;

function showTab( nID ) {
  /* hide active tab */
  var oTab = document.getElementById( "tab" + iactiveTab + "-content" );
  var oTabHeader = document.getElementById( "tab" + iactiveTab );
  if( oTab != null && oTabHeader != null ) {
    oTab.style.display = "none";
    oTabHeader.className = "tab";
  }
   
  /* show the tab specified by the parameter */
  oTab = document.getElementById( "tab" + nID + "-content" );
  oTabHeader = document.getElementById( "tab" + nID );
  
  if( oTab != null && oTabHeader != null ) {      
	oTab.style.display = "block";
    oTabHeader.className = "tab active";
    var loadFunc = oTab.getAttribute( "ontabload" );
    
    document.cookie = "activetab=" + nID + ";";
	iactiveTab = nID;	    
    
	if( loadFunc != null ) {
      eval( loadFunc );
    }
  }
}

function showTabLinks(tabId, linkId) {
  /* hide all other links */
  for( var i = 0; i < 10; i++ ) {
    var link = document.getElementById( "link"+tabId+"-"+i);
    if( link != null) {
      link.style.display = "none";
    }
  }

  /* show the links specified by the parameters */
  var link = document.getElementById( "link" + tabId + "-" + linkId );
  if( link != null ) {    
    link.style.display = "block";
  }
}