function HTMLGroupBox(sys, formID, code, posX, posY, width, height, description, value) {
  this.create(sys, formID, code, posX, posY, width, height, description, value);
  this.style = 1;
  this.nodesc = false;
}

HTMLGroupBox.inherits(HTMLElementBase);

HTMLGroupBox.prototype.zindex = 0;
HTMLGroupBox.prototype.name = 'HTMLGroupBox';
HTMLGroupBox.prototype.tabable = false;

HTMLGroupBox.prototype.setWidth = function(width) {
  width = parseInt(width);
  this.width = width;
  this.div.style.width = width;
  this.table.style.width = width;
}

HTMLGroupBox.prototype.setHeight = function(height) {
  height = parseInt(height);
  this.height = height;
  this.div.style.height = height;
  var h = this.height;
  if (this.description.length > 0 || !this.nodesc)
    h = h-7;
  this.table.style.height = h;
}

HTMLGroupBox.prototype.setDescription = function(description) {
  this.description = description;
  if (this.label) this.label.setDescription(description.replace(/\s/g, '&nbsp;'));
}

HTMLGroupBox.prototype.setColor = function(color) {
  this.color= color;
  if (this.label) this.label.setColor(color);
}

HTMLGroupBox.prototype.setBGColor = function(color) {
  this.bgColor= color;
  if (this.content) this.content.style.backgroundColor = color;
  if (this.label) this.label.setBGColor(color);
}

HTMLGroupBox.prototype.setStyle = function(style) {
  this.style = style;
  this.designComponent(this.doc);
}

HTMLGroupBox.prototype.setFont = function(f) {
  this.font = f;
  if (this.label) this.label.setFont(f);
}

HTMLGroupBox.prototype.setSize = function(s) {
  this.size = s;
  if (this.label) this.label.setSize(s);
}

HTMLGroupBox.prototype.focus = function() { return false; }

HTMLGroupBox.prototype.blur = function() { return false; }

HTMLGroupBox.prototype.setNoDescription = function(v) { this.nodesc = v; }

HTMLGroupBox.prototype.toPermissionMode = function() {
}

HTMLGroupBox.prototype.designComponent = function(doc) {
    var top   = true;
    var left  = true;
    var right = true;
    var down  = true;

    if (this.style == 2) {
      left = false;
      right = false;
      down = false;
    }
    else if (this.style == 3) {
      top = false;
      left = false;
      right = false;
    }
    else if (this.style == 4) {
      top = false;
      right = false;
      down = false;
    }
    else if (this.style == 5) {
      top = false;
      left = false;
      down = false;
    }
    else if (this.style == 6) {
      top = false;
      left = false;
      right = false;
      down = false;
    }

    var h = this.height;
    var desc = this.description.length > 0 && this.style == 1;
    if (this.nodesc) desc = false;
    if (desc) h = h-7;
    var output = '';
    var flag = true;
    if (this.getHeight() <= 5) {
      output = output + "<table width=\""+this.getWidth()+"\" height=\"1\" border=0 cellspacing=0 cellpadding=0>";
      output = output + "<tr><td background=\""+skin+"gb_top_back.gif\"></td>";
      output = output + "</tr></table>";
      flag = false;
    } else if (this.getWidth() <= 5) {
      output = output + "<table width=\"1\" height=\""+h+"\" border=0 cellspacing=0 cellpadding=0>";
      output = output + "<tr><td background=\""+skin+"gb_left_back.gif\"></td>";
      output = output + "</tr></table>";
      flag = false;
    } else {
      if (desc) output = output + "<table height=7 border=0><tr><td></td></tr></table>";

      output = output + "<table width=\""+this.getWidth()+"\" height=\""+h+"\" border=0 cellspacing=0 cellpadding=0>";
      output = output + "<tr><td width=\"1\" height=\"1\">";

      if (top && left) output = output + "<img src=\""+skin+"gb_top_left.gif\">";

      output = output + "</td>";
      output = output + "<td height=\"1\" valign=\"top\" ";

      if (top) output = output + "background=\""+skin+"gb_top_back.gif\"";

      output = output + ">";

      if (top) output = output + "<img src=\""+skin+"gb_top_back.gif\">";

      output = output + "</td>";

      output = output + "<td width=\"1\" height=\"1\">";

      if (top && right) output = output + "<img src=\""+skin+"gb_top_right.gif\">";

      output = output + "</td>";
      output = output + "</tr><tr><td width=\"1\"";

      if (left) output = output + "background=\""+skin+"gb_left_back.gif\"";

      output = output + ">";

      if (left) output = output + "<img src=\""+skin+"gb_left_back.gif\">";

      output = output + "</td>";
      output = output + "<td width=\"100%\" id=\"HTMLGroupBox"+this.code+"\"></td><td width=\"1\"";

      if (right) output = output + "background=\""+skin+"gb_right_back.gif\"";

      output = output + ">";

      if (right) output = output + "<img src=\""+skin+"gb_right_back.gif\">";

      output = output + "</td>";
      output = output + "</tr><tr><td height=\"1\" width=\"1\">";

      if (down && left) output = output + "<img src=\""+skin+"gb_down_left.gif\">";

      output = output + "</td>";
      output = output + "<td height=\"1\"";

      if (down) output = output + "background=\""+skin+"gb_down_back.gif\" ";

      output = output + ">";

      if (down) output = output + "<img src=\""+skin+"gb_down_back.gif\">";

      output = output + "</td>";
      output = output + "<td height=\"1\" width=\"1\">";

      if (down && right) output = output + "<img src=\""+skin+"gb_down_right.gif\">";

      output = output + "</td></tr></table>";
  }
  this.div.innerHTML = output;

  if (this.style <= 1 && flag) {
    this.content = this.div.childNodes.item(desc?1:0).firstChild.childNodes.item(1).childNodes.item(1);
  } else
    this.content = null;

  if (desc) {
    this.table = this.div.childNodes.item(1);
    var description = this.description.replace(/\s/g, '&nbsp;');
    this.label = new HTMLLabel(this.sys, this.formID, this.code, 8, 0, 1, 15, description);
    this.div.style.backgroundColor = doc.style.backgroundColor;
    this.label.required = this.required;
    this.label.design(this.div);
  } else {
    this.table = this.div.firstChild;
    this.label = null;
  }

  if (this.onclick) {
    this.div.onclick = this.onclick;
    this.div.onmouseover = (this.div.style.cursor = "pointer");
  }
}

HTMLGroupBox.prototype.setHint = function(hint) {
	this.callMethod(HTMLElementBase, "setHint", [hint]);
	
	if (this.table) {
    this.table.hint = hint;
    this.table.alt = hint;
    this.table.title = hint;
	}
}