 function HTMLMultiSelect(sys, formID, code, posX, posY, width, height, value) {

  this.create(sys, formID, code, posX, posY, width, height, '', value);

  this.type = 1;
  this.levels = 0;
  this.arrData;
  this.multSelect;

  this.designComponent();

}

HTMLMultiSelect.inherits(HTMLElementBase);

HTMLMultiSelect.prototype.name = 'HTMLMultiSelect';
HTMLMultiSelect.prototype.tabable = false;

HTMLMultiSelect.prototype.designComponent = function(doc) {
  this.multiSelect = new Bs_MultiLevelSelector();
}

HTMLMultiSelect.prototype.setData = function(arrData) {
  this.arrData = arrData;
}

HTMLMultiSelect.prototype.getData = function() {
  return this.arrData;
}

HTMLMultiSelect.prototype.initLevel = function(level,posX,posY,width,lines) {
  this.levels++;

  var div = this.getDiv('WFRSelect'+this.code, posX, posY, width, lines, 3, true);

  var select = document.createElement("SELECT");
  select.id = "fld" + this.levels + this.code;

  if(lines)
    select.size = lines;

  select.style.width = width + "px";

  div.appendChild(select);

  document.body.appendChild(div);

}

HTMLMultiSelect.prototype.associateRuleToLevel = function(e, level, ruleName) {
        objSelect = MM_findObj("fld" + level + this.code);
        this.attachEvent(objSelect, e, this.selectChangedAction, this, [ruleName.toUpperCase(), objSelect]);
}

HTMLMultiSelect.prototype.selectChangedAction = function(obj, evt, ruleName, objSelect) {
        executeJSRuleNoField(this.sys, this.formID, ruleName, [objSelect.value]);
}

HTMLMultiSelect.prototype.show = function() {

        this.multiSelect.setData(this.arrData);

        for(i = 1; i <= this.levels; i++) {
                this.multiSelect.initLevelByExistingField(i,"fld" + i + this.code);
        }
        this.multiSelect.render();
}

HTMLMultiSelect.prototype.visibleFields = function(boolType) {
        var displayType = "none";
        if (boolType) {
                displayType = "block";
        }
        for(i = 1; i <= this.levels; i++) {
                MM_findObj("fld" + i + this.code).style.display = displayType;
        }
}

HTMLMultiSelect.prototype.setLevels = function(levels) {
  this.levels = levels;
}

HTMLMultiSelect.prototype.getLevels = function() {
  return this.levels;
}

HTMLMultiSelect.prototype.focus = function() { return false; }

HTMLMultiSelect.prototype.blur = function() { return false; }

HTMLMultiSelect.prototype.loadScripts = function() {
  webrun.include("components/treeview/core/lang/Bs_Misc.lib.js");
  webrun.include("components/treeview/core/form/Bs_FormFieldSelect.class.js");
  webrun.include("components/treeview/components/multilevelselector/Bs_MultiLevelSelector.class.js");
}
