/*Clase JSTreeView*/

//Style definitions:
var jstvwTextOnly = 0;
var jstvwPictureText = 1;
var jstvwPlusMinusText = 2;
var jstvwPlusPictureText = 3;
var jstvwTreelinesText = 4;
var jstvwTreelinesPictureText = 5;
var jstvwTreelinesPlusMinusText = 6;
var jstvwTreelinesPlusPictureText = 7;

//LineStyle definitions:
var jstvwTreeLines = 0;
var jstvwRootLines = 1;

//BorderStyle definitions:
var jsccNone = 0;
var jsccFixedSingle = 1;

//Appearance definitions:
var jsccFlat = 0;
var jscc3D = 1;

//RelationShip definitions:
var jstvwFirst = 0;
var jstvwLast = 1;
var jstvwNext = 2;
var jstvwPrevious = 3;
var jstvwChild = 4;

function _formatTreeItem(oTreeItem)
{
  var bShowPlusMinus = ((oTreeItem.parentTreeView.Style & 2) && ((oTreeItem.level > 0) || oTreeItem.parentTreeView.LineStyle == jstvwRootLines));
  var bShowImages = oTreeItem.parentTreeView.Style & 1;
  var lWidth = 0, lHeight = 0, lTemp;
  with (oTreeItem.tableLayout)
  {
    indentationTD.style.height = "auto";
    PlusMinusTD.style.height = "auto";
    CheckBoxesTD.style.height = "auto";
    ImageTD.style.height = "auto";
    TextTD.style.height = "auto";

    indentationTD.style.left = lWidth + "px";
    indentationTD.style.width = (oTreeItem.parentTreeView.Indentation * oTreeItem.level) + "px";
    if (parseInt(indentationTD.style.width)==0) indentationTD.style.display="none"; else indentationTD.style.display="block";
    lWidth += indentationTD.offsetWidth;
    lHeight = indentationTD.offsetHeight;
    
    PlusMinusTD.style.left = lWidth + "px";
    PlusMinusTD.style.width = (bShowPlusMinus? oTreeItem.parentTreeView.Indentation + "px":"0px");
    if (parseInt(PlusMinusTD.style.width)==0) PlusMinusTD.style.display="none"; else PlusMinusTD.style.display="block";
    lWidth += PlusMinusTD.offsetWidth;
    if (PlusMinusTD.offsetHeight > lHeight) lHeight = PlusMinusTD.offsetHeight;

    CheckBoxesTD.style.left = lWidth + "px";
    CheckBoxesTD.style.width = (oTreeItem.parentTreeView.Checkboxes? "20px":"0px");
    if (parseInt(CheckBoxesTD.style.width)==0) CheckBoxesTD.style.display="none"; else CheckBoxesTD.style.display="block";
    lWidth += CheckBoxesTD.offsetWidth;
    if (CheckBoxesTD.offsetHeight > lHeight) lHeight = CheckBoxesTD.offsetHeight;
    
    ImageTD.style.left = lWidth + "px";
    ImageTD.style.width = (bShowImages? "20px":"0px");
    if (parseInt(ImageTD.style.width)==0) ImageTD.style.display="none"; else ImageTD.style.display="block";
    lWidth += ImageTD.offsetWidth;
    if (ImageTD.offsetHeight > lHeight) lHeight = ImageTD.offsetHeight;
    
    lTemp = oTreeItem.parentTreeView._tvwLayout._lyLayout.offsetWidth - lWidth;
    TextTD.style.left = lWidth + "px";
    if (!oTreeItem.parentTreeView.fixedWidth)
      if (TextTD.offsetLeft + TextTD.offsetWidth < lTemp) TextTD.style.width = (lTemp==0? "100%":(lTemp - parseInt(TextTD.style.paddingLeft)) + "px");
      else{
        var oTempDiv = document.body.appendChild(TextTD.cloneNode(true));
        with (oTempDiv.style) {visibility = "hidden"; border = "0px none black"; padding = "0px";}
        TextTD.style.width = oTempDiv.offsetWidth;
        document.body.removeChild(oTempDiv);
      }
    else TextTD.style.width = (lTemp<20? "0px":(lTemp - 20 - parseInt(TextTD.style.paddingLeft)) + "px");

    if (parseInt(TextTD.style.width)==0) TextTD.style.display="none"; else TextTD.style.display="block";
    if (TextTD.offsetHeight > lHeight) lHeight = TextTD.offsetHeight;

    if (lHeight < 20) lHeight = 20;
    indentationTD.style.height = lHeight + "px";
    PlusMinusTD.style.height = lHeight + "px";
    CheckBoxesTD.style.height = lHeight + "px";
    ImageTD.style.height = lHeight + "px";
    TextTD.style.height = lHeight + "px";

    style.height = TextTD.offsetHeight + "px";
    oTreeItem.rowAssigned.style.height = TextTD.offsetHeight + "px";
  }
}

function _Nodes_RecalcTops()
{
  var iFindex;

  if (arguments.length > 0) iFindex = arguments[0]; else iFindex = 0;
  if (!this[iFindex]){
    if (this.length > 0) alert("No es pot recalcular la posiciķ top de les capes, no es troba la referencia");
    return;
  }
  for (iFindex = this[iFindex].index; iFindex < this.length; iFindex++)
    this[iFindex].tableLayout.style.top =  this[iFindex].rowAssigned.offsetTop;
}

function _Nodes_AddItem(sKey)
{
  /*arguments: clauFamiliar, tipusRelacio, clauItem, textItem, imatgeItem, imatgeItemSeleccionat*/
  var oNewItem;
  var lRelativeIndex = -1;
  var lRelationShip = jstvwLast;
  var lItemLevel = 0;

  var lRowIndex;
  
  var bShowPlusMinus, bShowIcon;
  
  if (arguments.length >= 3){
    if (!isNaN(parseInt(arguments[2]))){
      alert("Clau no vālida (no pot tenir un format numčric)");
      return;
    }
    if (this[arguments[2]]){
      alert("Clau no vālida (ja estā sent utilitzada)");
      return;
    }
  }
  
  if (arguments[0] != null){
    if (!this[arguments[0]]){
      alert("Clau del familiar no vālida (no es troba el node especificat)");
      return;
    }
    else{
      relativeIndex = this[arguments[0]].index;
      lItemLevel = this[arguments[0]].level;
      lRelationShip = (arguments[1]? arguments[1]:jstvwLast);
    }
  } else{ lItemLevel = 0; lRowIndex = this.parentItem._tvwLayout._lyTable.rows.length;}

  switch (lRelationShip)
  {
    case jstvwFirst:
      break;
    case jstvwLast:
      break;
    case jstvwNext:
      break;
    case jstvwPrevious:
      break;
    case jstvwChild:
        lItemLevel ++;
        if (this[arguments[0]].seguent)
          lRowIndex = this[arguments[0]].seguent.rowAssigned.parentNode.rowIndex;
        else{
          lRowIndex = this.parentItem._tvwLayout._lyTable.rows.length;
          var oRef = this[arguments[0]].pare;
          while (oRef){
            if (oRef.seguent){
              lRowIndex = oRef.seguent.rowAssigned.parentNode.rowIndex;
              break;
            }
            oRef = oRef.pare;
          }
        }
      break;
    default:
      alert("Propietat de relaciķ entre nodes no vālida (RelationShip)");
      return;
      break;
  }
  
  bShowPlusMinus = (this.parentItem.Style & 2);
  bShowIcon = (this.parentItem.Style & 1);

  newItem = new Object();
  newItem.index = this.length;
  newItem.parentTreeView = this.parentItem;
  newItem.level = lItemLevel;

  with (this.parentItem._tvwLayout._lyTable)
  {
    newItem.rowAssigned = insertRow(lRowIndex).appendChild(document.createElement("TD"));
    newItem.rowAssigned.style.cursor = "default";
    newItem.tableLayout = newItem.rowAssigned.appendChild(document.createElement("DIV"));
    newItem.Text = (arguments[3]? arguments[3]:"");
    newItem.fills = 0;
    newItem.visible = true;
    newItem.expanded = false

    with (newItem.tableLayout)
    {
      style.position = "absolute";
      style.width = "100%";
      
      newItem.tableLayout.indentationTD = appendChild(document.createElement("DIV"))
      newItem.tableLayout.PlusMinusTD = appendChild(document.createElement("DIV"))
      newItem.tableLayout.CheckBoxesTD = appendChild(document.createElement("DIV"))
      newItem.tableLayout.ImageTD = appendChild(document.createElement("DIV"))
      newItem.tableLayout.TextTD = appendChild(document.createElement("DIV"))

      with (indentationTD){
        style.position = "absolute";
        style.top="0px";
        style.height="auto";
        innerHTML="&nbsp;";
      }

      with (PlusMinusTD)
      {
        style.position = "absolute";
        style.top="0px";
        style.height="auto";
        style.paddingTop="4px";
        style.paddingLeft="4px";
        PlusMinusTD.tableLayout = appendChild(document.createElement("TABLE"));
        with (tableLayout)
        {
          width="11px";
          align="left";
          cellPadding="0";
          cellSpacing="0";
          border="0";
          with (style)
          {
            tableLayout = "fixed";
            border = "1px solid black";
            overflow = "hidden";
            width = "11px";
            height = "11px";
            textAlign = "center";
            font = "normal normal normal 8px/8px Arial";
            color = "blue";
            visibility = "hidden";
          }
          tableLayout.td = insertRow(0).appendChild(document.createElement("TD"));
          tableLayout.td.innerHTML = "+";
        }
      }

      with (CheckBoxesTD){
        style.position = "absolute";
        style.top="0px";
        style.height="auto";
        style.paddingTop="0px";
        style.paddingLeft="2px";
        innerHTML = "<input type='checkbox' value='" + (arguments[2]?arguments[2]:"") + "'>"
      }
      
      with (ImageTD){
        style.position = "absolute";
        style.top="0px";
        style.height="auto";
        style.paddingTop="4px";
        style.paddingLeft="2px";
        innerHTML = "&nbsp;";
      }

      with (TextTD){
        style.position = "absolute";
        style.top="0px";
        style.height="auto";
        style.paddingTop="0px";
        style.paddingLeft="0px";
        style.font = this.parentItem.Font;
        style.verticalAlign="middle";
        if (this.parentItem.fixedWidth) style.overflow="hidden";
        innerHTML=(arguments[3]? arguments[3]:"");
      }

      style.top = newItem.rowAssigned.offsetTop;
      _formatTreeItem(newItem);
      newItem.rowAssigned.appendChild(document.createTextNode(" "));
    }
  }

  newItem.setText = function()
                    {
                      this.tableLayout.TextTD.innerHTML = this.Text = (arguments.length>0? arguments[0]:"");
                      _formatTreeItem(this);
                      this.parentTreeView.Nodes.recalcTops();
                    }

  newItem.hideChilds = function()
                       {
                         var oChild;
                         if (this.fills > 0){
                           oChild = this.fill
                           while (oChild){
                             oChild.Hide();
                             oChild = oChild.seguent;
                           }
                           this.tableLayout.PlusMinusTD.tableLayout.rows[0].firstChild.innerHTML = "+";
                         }
                       };

  newItem.showChilds = function()
                       {
                         var oChild;

                         if (this.fills > 0){
                           oChild = this.fill
                           while (oChild){
                             oChild.Show();
                             oChild = oChild.seguent;
                           }
                           this.tableLayout.PlusMinusTD.tableLayout.rows[0].firstChild.innerHTML = "-";
                         }
                       };

  newItem.Hide = function()
                 {
                   this.rowAssigned.parentNode.style.display = "none";
                   this.visible = false;
                   this.parentTreeView.Nodes.recalcTops();
                   if (this.expanded) this.hideChilds();
                   if (this.expanded && this.parentTreeView.SingleSel) this.expanded = false;
                 };

  newItem.Show = function()
                 {
                   this.rowAssigned.parentNode.style.display = "";
                   _formatTreeItem(this);
                   this.tableLayout.style.top = this.rowAssigned.offsetTop;
                   this.visible = true;
                   this.parentTreeView.Nodes.recalcTops();
                   if (this.expanded) this.showChilds();
                 };

  newItem.rowAssigned.itemAssigned = newItem;
  newItem.rowAssigned.onclick = function(){this.itemAssigned.parentTreeView.selectNode(this.itemAssigned.index) };

  this[this.length] = newItem;
  if (arguments[2]){
    newItem.Key = arguments[2];
    this[newItem.Key] = this[this.length - 1];
  }
  else newItem.Key = "";

  var tempItem;
  switch (lRelationShip)
  {
    case jstvwFirst:
      break;
    case jstvwLast:
      if (this[arguments[0]]){
        tempItem = this[arguments[0]].primer; 
        while(tempItem.seguent) {tempItem.ultim = newItem; tempItem = tempItem.seguent;}
        tempItem.ultim = newItem;
        tempItem.seguent = newItem;
        newItem.anterior = tempItem;
        newItem.primer = tempItem.primer;
        newItem.ultim = newItem;
      }
      else{
        newItem.primer = newItem;
        newItem.ultim = newItem;
      }
      break;
    case jstvwNext:
      break;
    case jstvwPrevious:
      break;
    case jstvwChild:
      if (this[arguments[0]].fill){
        tempItem = this[arguments[0]].fill;
        while(tempItem.seguent) {tempItem.ultim = newItem; tempItem = tempItem.seguent;};
        tempItem.ultim = newItem;
        tempItem.seguent = newItem;
        newItem.anterior = tempItem;
        newItem.primer = tempItem.primer;
        newItem.ultim = newItem;
      }
      else{
        this[arguments[0]].fill = newItem;
        newItem.primer = newItem;
        newItem.ultim = newItem;
      }
      newItem.pare = this[arguments[0]];
      this[arguments[0]].fills++;
      if (this[arguments[0]].fills == 1) this[arguments[0]].tableLayout.PlusMinusTD.tableLayout.style.visibility = "inherit";
      if ((!newItem.pare.visible) || (!newItem.pare.expanded)){newItem.Hide();};
      break;
    default:
      alert("Propietat de relaciķ entre nodes no vālida (RelationShip)");
      return;
      break;
  }

  this.recalcTops();

  this.parentItem.chekforScrollBar();
  return newItem;
}

function _Nodes_ClearAll()
{
  for (var iCounter = this.length - 1; iCounter >= 0; iCounter--){
    if (this[iCounter].Key.length > 0) delete this[this[iCounter].Key];
    delete this[iCounter];
    this.length--;
  }
  while (this.parentItem._tvwLayout._lyTable.rows.length > 0) this.parentItem._tvwLayout._lyTable.deleteRow(0);
  this.parentItem.chekforScrollBar();
}

function _Nodes_Remove(sIndex)
{
  var iIndex, tItem;
  var oTempItem;

  if (!isNaN(parseInt(sIndex)))
    iIndex = parseInt(sIndex);
  else
    iIndex = parseInt(this[sIndex].index);

  if (this[iIndex].Key.length > 0) delete this[this[sIndex].Key];

  if (this[iIndex].fill)
    while (this[iIndex].fill){
      tItem = this[iIndex].fill.index;
      this.Remove(this[iIndex].fill.index);
    }

  if (this[iIndex].pare){
    this[iIndex].pare.fills--;
    if (this[iIndex].pare.fills == 0){
      delete this[iIndex].pare.fill;
      this[iIndex].pare.tableLayout.PlusMinusTD.tableLayout.style.visibility = "hidden";
    }
  }
  if (this[iIndex].ultim.index == this[iIndex].index){
    oTempItem = this[iIndex].anterior;
    while (oTempItem){ oTempItem.ultim = this[iIndex].anterior; oTempItem = oTempItem.anterior;}
  }
  if (this[iIndex].primer.index == this[iIndex].index){
    oTempItem = this[iIndex].seguent;
    while (oTempItem){ oTempItem.primer = this[iIndex].seguent; oTempItem = oTempItem.seguent;}
  }
  if (this[iIndex].anterior) this[iIndex].anterior.seguent = this[iIndex].seguent;
  if (this[iIndex].seguent) this[iIndex].seguent.anterior = this[iIndex].anterior;

  this.parentItem._tvwLayout._lyTable.deleteRow(this[iIndex].rowAssigned.parentNode.rowIndex)
  delete this[iIndex];

  for (var iCounter = iIndex; iCounter < this.length - 1; iCounter++){
    this[iCounter] = this[iCounter+1];
    this[iCounter].index = iCounter;
  }

  delete this[this.length-1];
  this.length--;

  this.recalcTops();
  this.parentItem.chekforScrollBar();
}

function _TreeView_SetAppearance(lApp){

  switch (lApp)
  {
    case jsccFlat:
      this._tvwWindowMarcExternOut.lyBorderWidth(0);
      this._tvwWindowMarcExternIn.lyBorderWidth(0);
      break;
    case jscc3D:
      this._tvwWindowMarcExternOut.lyBorderWidth(1);
      this._tvwWindowMarcExternIn.lyBorderWidth(1);
      break;
    default:
      alert("Valor de la propietat no vālid (Appearance)");
      return;
      break;
  }
  this.Appearance = lApp;
  this.Height(this.Height());
  this.Width(this.Width());

  this.repositionScrollBar();
}

function _TreeView_SetBorderStyle(lBSt){

  switch (lBSt)
  {
    case jsccNone:
      this._tvwLayout.lyBorderWidth(0);
      break;
    case jsccFixedSingle:
      this._tvwLayout.lyBorderWidth(1);
      break;
    default:
      alert("Valor de la propietat no vālid (BorderStyle)");
      return;
      break;
  }
  this.BorderStyle = lBSt;
  this.Height(this.Height());
  this.Width(this.Width());

  this.repositionScrollBar();
}

function _TreeView_SetScroll(bSc)
{
  switch (bSc)
  {
    case true:
      this.Scroll = true;
      this._tvwLayout._lyStyle.overflow="auto";
      break;
    case false:
      this.Scroll = false;
      this._tvwLayout._lyStyle.overflow="hidden";
      break;
    default:
      alert("Valor de la propietat no vālid (Scroll)");
      return;
      break;
  }
}

function _TreeView_SetVisible(bVi){
  switch (bVi)
  {
    case true:
      this._tvwWindow.lyVisibility("inherit");
      break;
    case false:
      this._tvwWindow.lyVisibility("hide");
      break;
    default:
      alert("Valor de la propietat no vālid (Visible)");
      return;
      break;
  }
}

function _TreeView_Top(){
  return this._tvwWindow.lyTop(arguments[0]?arguments[0]:null);
}
function _TreeView_Left(){
  return this._tvwWindow.lyLeft(arguments[0]?arguments[0]:null);
}
function _TreeView_Height(){

  var lHeight, lMEOHeight, lMEIHeight, lLyHeight;

  if (arguments.length > 0){
    lHeight = this._tvwWindow.lyHeight(arguments[0]);
    lMEOHeight = lHeight-(this.Appearance == jscc3D? 2:0);
    lMEIHeight = lMEOHeight-(this.Appearance == jscc3D? 2:0);
    lLyHeight = lMEIHeight-(this.BorderStyle == jsccFixedSingle? 2:0);
    this._tvwWindowMarcExternOut.lyHeight(lMEOHeight);
    this._tvwWindowMarcExternIn.lyHeight(lMEIHeight);
    //this._tvwLayout.lyHeight(lLyHeight);
  }
  else lHeight = this._tvwWindow.lyHeight();

  this.chekforScrollBar();

  return lHeight;
}
function _TreeView_Width(){

  var lWidth, lMEOWidth, lMEIWidth, lLyWidth;
  if (arguments.length > 0){
    lWidth = this._tvwWindow.lyWidth(arguments[0]);
    lMEOWidth = lWidth-(this.Appearance == jscc3D? 2:0);
    lMEIWidth = lMEOWidth-(this.Appearance == jscc3D? 2:0);
    lLyWidth = lMEIWidth-(this.BorderStyle == jsccFixedSingle? 2:0);
    this._tvwWindowMarcExternOut.lyWidth(lMEOWidth);
    this._tvwWindowMarcExternIn.lyWidth(lMEIWidth);
    this._tvwLayout.lyWidth(lLyWidth);
    for (var iCounter = 0; iCounter < this.Nodes.length; iCounter++) if (this.Nodes[iCounter].visible) _formatTreeItem(this.Nodes[iCounter]);
    this.Nodes.recalcTops();
  }
  else lWidth = this._tvwWindow.lyWidth();

  this.chekforScrollBar();

  return lWidth;
}

function _TreeView_SelectNode(sIndex){

  var oParent;

  if (!this.Nodes[sIndex]){
    alert("no s'ha pogut trobar la referencia al node (" + sIndex + ")");
    return;
  }

  
  if (this.SelectedItem){
    if (this.SelectedItem.index != this.Nodes[sIndex].index){
      this.SelectedItem.selected = false;
      if (this.SingleSel)
      {
        oParent = this.SelectedItem;
        while (oParent){
          if (this.Nodes[sIndex].pare)
            if (oParent.index == this.Nodes[sIndex].pare.index) break;
          oParent.expanded = false;
          oParent.hideChilds();
          oParent = oParent.pare;
        }
      }
    }
  }

  this.SelectedItem = this.Nodes[sIndex];

  with (this.SelectedItem)
  {
    selected = true;
    expanded = !expanded;
    if (!expanded) hideChilds(); else showChilds();
  }

  if (this.onselectitem) this.onselectitem(this.SelectedItem);
  this.chekforScrollBar();
}

function _TreeView(psNom, poContainer, plTop, plLeft, plHeight, plWidth)
{
  this._tvwWindow = new _Layer(psNom + "_window", poContainer, plTop, plLeft, plHeight, plWidth);

  this._tvwWindowMarcExternOut = new _Layer(psNom + "_windowMarcExternOut", this._tvwWindow._lyLayout, 0, 0, plHeight-2, plWidth-2);
  this._tvwWindowMarcExternOut.lyBorderWidth(1);
  with (this._tvwWindowMarcExternOut._lyStyle){borderTop=borderLeft="1px solid #848284"; borderBottom=borderRight="1px solid #ffffff";}

  this._tvwWindowMarcExternIn = new _Layer(psNom + "_windowMarcExternIn",this._tvwWindowMarcExternOut._lyLayout, 0, 0, plHeight-4, plWidth-4);
  this._tvwWindowMarcExternIn.lyBorderWidth(1);
  with (this._tvwWindowMarcExternIn._lyStyle){borderTop=borderLeft="1px solid #424142";borderBottom=borderRight="1px solid #d6d3ce";}

  this._tvwLayout = new _Layer(psNom + "_windowMarcIntern",this._tvwWindowMarcExternIn._lyLayout, 0, 0, plHeight-4, plWidth-4, "white");
  this._tvwLayout.lyBorderWidth(0);
  with (this._tvwLayout._lyStyle){borderTop=borderLeft="0px solid black";borderBottom=borderRight="0px solid black";}

  this._tvwLayout._lyTable = document.createElement("TABLE");
  this._tvwLayout._lyLayout.appendChild(this._tvwLayout._lyTable);
  with (this._tvwLayout._lyTable)
  {
    style.tableLayout = "fixed";
    border="0";
    cellPadding="0";
    cellSpacing="0";
    width="100%";
  }
  
  this.fixedWidth = true;

  this.Appearance = jscc3D;
  this.BorderStyle = jsccNone;
  this.Container = poContainer;
  this.Checkboxes = false;
  this.Enabled = true;
  this.Font = "normal normal normal 1px 'MS Sans Serif', Arial";
  this.HideSelection = true;
  this.hWnd = this._tvwWindow._lyLayout;
  this.ImageList = new Array();
  this.Indentation = 20;
  this.LineStyle = jstvwTreeLines;
  this.Name = psNom;
  this.PathSeparator = "/";
  
  //this.Scroll = true; this._tvwLayout._lyStyle.overflow="auto";
  this.Scroll = false; this._tvwLayout._lyStyle.overflow="hidden";
  this.SelectedItem;
  this.SingleSel = true; //false;
  this.Style = jstvwTreelinesPlusMinusText;
  this.Tag = "";
  this.Visible = true;

  this.Nodes = new Array();
  this.Nodes.parentItem = this;
  this.Nodes.Add = _Nodes_AddItem;
  this.Nodes.Clear = _Nodes_ClearAll;
  this.Nodes.Remove = _Nodes_Remove;
  this.Nodes.recalcTops = _Nodes_RecalcTops;
  
  this.vScroll = new _ScrollBar(this._tvwWindowMarcExternIn, this._tvwLayout);
  this.vScroll._Layer.lyVisibility("hide");

  this.repositionScrollBar = function () {this.vScroll.reposition()};

  this.chekforScrollBar = function()
                          {
                            this._tvwLayout.lyAutoSizeHeight(true);
                            if (this._tvwLayout.lyHeight() > (this._tvwWindowMarcExternIn.lyHeight() - this._tvwWindowMarcExternIn.lyBorderWidth())){
                              this.vScroll.reposition();
                              this.vScroll._Layer.lyVisibility("inherit");
                            }
                            else {
                              this._tvwLayout.lyTop(0);
                              this.vScroll._Layer.lyVisibility("hide");
                            }
                          }
}
_TreeView.prototype.setAppearance = _TreeView_SetAppearance;
_TreeView.prototype.setBorderStyle = _TreeView_SetBorderStyle;
_TreeView.prototype.setScroll = _TreeView_SetScroll;
_TreeView.prototype.setVisible = _TreeView_SetVisible;
_TreeView.prototype.Top = _TreeView_Top;
_TreeView.prototype.Left = _TreeView_Left;
_TreeView.prototype.Height = _TreeView_Height;
_TreeView.prototype.Width = _TreeView_Width;
_TreeView.prototype.selectNode = _TreeView_SelectNode
/*_TreeView.prototype.GetVisibleCount = _TreeView_GetVisibleCount;
_TreeView.prototype.HitTest = _TreeView_HitTest;
_TreeView.prototype.Refresh = _TreeView_Refresh;
_TreeView.prototype.SetFocus = _TreeView_SetFocus;*/