
var layer_class = function() { }

layer_class.prototype.Show = function(id,showAlert) {
   var obj = findObj(id);
   if(obj) {
      obj.style.display = 'block';
   }else{
      if(showAlert != false)
      alert('layer.Show() : Layer '+id+' não foi encontrado.');
   }
}

layer_class.prototype.Hide = function(id,showAlert) {
   var obj = findObj(id);
   if(obj) {
      obj.style.display = 'none';
   }else{
      if(showAlert != false)
      alert('layer.Show() : Layer '+id+' não foi encontrado.');
   }
}

layer_class.prototype.Invert = function(id) {
   var obj = findObj(id);
   if(obj) {
       obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
   }else{
       alert('layer.Invert() : Layer '+id+' não foi encontrado.');
   }
}

layer_class.prototype.Display = function(id) {
   var obj = findObj(id);
   if(obj) {
       return obj.style.display;
   }else{
       alert('layer.Display() : Layer '+id+' não foi encontrado.');
   }
}

layer_class.prototype.Set = function(id,bool) {
  if((bool) && bool != 'none') {
    this.Show(id);
  }else{
    this.Hide(id);
  }
}

layer_class.prototype.setText = function(objName,newText) {
  if((obj=findObj(objName))!=null) { with (obj)
      if(document.layers) {document.write(unescape(newText)); document.close();}
      else innerHTML = unescape(newText);
  }else{
      alert('layer.setText() : Layer '+objName+' não foi encontrado.');
  }
}

layer_class.prototype.isVisible = function(id) {
  var obj = findObj(id);
  if(obj) {
      return (obj.style.display == 'block');
  }else{
      alert('layer.isVisible() : Layer '+id+' não foi encontrado.');
      return false;
  }
}


/* deprecated */

layer_class.prototype.ShowFadded = function(id) {
   var obj = findObj(id);
   if(obj) {
      obj.style.display = 'block';
      obj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=50)";
   }else{
      alert('layer.Show() : Layer '+id+' não foi encontrado.');
   }
}


var layer = new layer_class;
