// This file contains functions for display of layers associated with different tabs and their pans.

//----------------------------------------------------------------------------------------------------------------------

function MapTabS (pOgcData, pMapData, pcfgparams, pId) {

   this.activateTab = o_showMapLayers;
   this.deActivateTab = o_hideMapLayers;
   this.id = pId;
   this.myTab = null;

   this.ogcData  = pOgcData;
   this.mapData  = pMapData;
   this.cfgparams= pcfgparams;
}


function o_showMapLayers (tab) {

  //showLayer ('theTop' + this.mapData.id);
  this.mapData.updateMapImages ();// Takes care-off any changes made when this tab was in-active.

  if (this.cfgparams.displayToolbar == 'y')
      this.mapData.tbarActive = true;
}

function o_hideMapLayers (tab) {
    this.mapData.tbarActive = false;
    hideLayer ('theTop' + this.mapData.id);

    var j= this.mapData.tocData.groupLayerCounts + 1;// Total number of layer. Creating layers and giving them a name is


    for (var i=0;i<j;i++) { // TBD;
	hideLayer ('theMap' + this.mapData.id + i);
    }
}

//----------------------------------------------------------------------------------------------------------------------
function blankFun (div) {

}

//----------------------------------------------------------------------------------------------------------------------

// Id stands for the name of the variable representing this object.

function TocTabS (pTocData, pId) {

   this.activateTab = o_changeLayerDisplayContents;
   this.deActivateTab = blankFun;
   this.id = pId;
   this.myTab = null;

   this.tocData  = pTocData;

}

function o_changeLayerDisplayContents (tab) {
    tab.changePaneContents (this.tocData.getTOCHTML());
}

//----------------------------------------------------------------------------------------------------------------------
//--  Displays legend -----

function LegendTabS (pOgcData, pId) {

   this.activateTab = o_displayLegend;
   this.deActivateTab = blankFun;
   this.id = pId;
   this.myTab = null;

   this.ogcData  = pOgcData;

}


function o_displayLegend (tab) {
   tab.changePaneContents (this.ogcData.getLegendHTML());
}

