//paul reeves triskel commincations
//dependable on NN4Dom upgrade
function ChunkHandler(layerName) {
  this.layerName = layerName;
  if(typeof(arguments[0]) =="undefined") {
    this.layerName = "chunk";
  } 
  this.getTextLayers = ChunkHandler_getTextLayers;
  this.showLayer = ChunkHandler_showLayer;
  this.getLayers = ChunkHandler_getLayers;
  this.layers = new Array();
  
}


//looks for all the 'chunk...' layers
function ChunkHandler_getTextLayers() {
  var lyr = document.getElementsByTagName("div");
  for (var i=0; i<lyr.length; i++) {
    if(lyr[i].id.indexOf(this.layerName) == 0) {
      this.layers.push(lyr[i]);
    }
  }
}


function ChunkHandler_showLayer(layer) {
  this.layers = new Array(); //clear layers
  //hide
  //holds chunk layers
  layers = this.getTextLayers();  //puts layers into chunk layers;
  for (var i=0; i<this.layers.length; i++) {
    var style = (this.layers[i].style)?this.layers[i].style:this.layers[i];
    style.visibility = 'hidden';
  }
  var x = MM_findObj(layer);
  if(x.style){
    x.style.visibility = "visible"
  }
  else{
    x.visibility = "visible"
  }
  //(x.style)?x.style.visibility = 'visible':x.visibility = 'visible';
  return;
}

/**
 * allows the chunk handler to return all the layers associated with it
 * added by pr 31 03 03
 */
function ChunkHandler_getLayers(){
  this.getTextLayers();
  return this.layers;
}