function HTMLDetailPanel(sys, formID, code, posX, posY, width, height, description, value) {
  this.create(sys, formID, code, posX, posY, width, height, description, value);
  this.components   = new Array();
  this.wasVisible   = new Array();
  this.wasEnabled   = new Array();
  this.wasNotReadOnly  = new Array();
}

HTMLDetailPanel.inherits(HTMLGroupBox);
HTMLDetailPanel.prototype.name = 'HTMLDetailPanel';

HTMLDetailPanel.prototype.designComponent = function(doc) {
  this.callMethod(HTMLGroupBox, 'designComponent', doc);
  this.hidden = document.createElement("input");
  this.hidden.name = "WFRDetailPanelVisible" + this.code;
  this.hidden.type = "hidden";
  this.hidden.value = this.visible.toString();
  this.context.appendChild(this.hidden);
}

HTMLDetailPanel.prototype.setX = function(posX) {
  posX = parseInt(posX);
  var oldX = parseInt(this.posX);
  this.callMethod(HTMLGroupBox, 'setX', posX);

  for (var i = 0; i < this.components.length; i++) {
    var com = this.components[i];
    if (com) {
      var diff = posX - oldX;
      com.setX(com.getX()+diff);
    }
  }

}

HTMLDetailPanel.prototype.setY = function(posY) {
  posY = parseInt(posY);
  var oldY = parseInt(this.posY);
  this.callMethod(HTMLGroupBox, 'setY', posY);

  for (var i = 0; i < this.components.length; i++) {
    var com = this.components[i];
    if (com) {
      var diff = posY - oldY;
      com.setY(com.getY()+diff);
    }
  }

}

HTMLDetailPanel.prototype.add = function(comp) {
  this.components.push(comp);

  comp.designDragComponent = function() { }
  comp.setDraggable = function() { }
  comp.setResizable = function() { }
}

HTMLDetailPanel.prototype.setVisible = function(visible, force) {
  //Deve ter
  if (visible == this.visible && !force) return;

  this.callMethod(HTMLGroupBox, 'setVisible', visible);


  if (!visible) {

    this.wasVisible = new Array();
    for (var i = 0; i < this.components.length; i++) {
      if (this.components[i]) {
        if (this.components[i].getVisible())
          this.wasVisible.push(this.components[i]);
        this.components[i].setVisible(false);
      }
    }

  } else {
    for (var i = 0; i < this.wasVisible.length; i++)
        this.wasVisible[i].setVisible(true);
  }

  this.hidden.value = this.visible.toString();

}

HTMLDetailPanel.prototype.setEnabled = function(enabled, force) {

  //Deve ter
  if (enabled == this.enabled && !force) return;

  this.callMethod(HTMLGroupBox, 'setEnabled', enabled);

  if (!enabled) {
    this.wasEnabled = new Array();
    for (var i = 0; i < this.components.length; i++) {
      if (this.components[i]) {
        if (this.components[i].getEnabled())
          this.wasEnabled.push(this.components[i]);
        this.components[i].setEnabled(false);
      }
    }

  } else {
    for (var i = 0; i < this.wasEnabled.length; i++)
        this.wasEnabled[i].setEnabled(true);
  }
}

HTMLDetailPanel.prototype.setReadOnly = function(readonly, force) {

  //Deve ter
  if (readonly == this.readonly && !force) return;

  this.readonly = readonly;

  if (readonly) {
    this.wasNotReadOnly = new Array();
    for (var i = 0; i < this.components.length; i++) {
      if (this.components[i]) {
        if (!this.components[i].getReadOnly())
          this.wasNotReadOnly.push(this.components[i]);
        this.components[i].setReadOnly(true);
      }
    }

  } else {
    for (var i = 0; i < this.wasNotReadOnly.length; i++)
        this.wasNotReadOnly[i].setReadOnly(false);
  }
}

HTMLDetailPanel.prototype.freeComponent = function() {
  for (i = 0; i < this.components.length; i++) {
          if (this.components[i]) {
                  this.components[i].free();
          }
  }
}
