function co_t_item(id, id_down)
{
  id_down = (typeof id_down == "undefined") ? false : id_down;

  var elem = document.getElementById("treeRow" + this.ID);

  elem.bgColor = (this.ID == id) ? tree_color.SELECTED : tree_color.NONE;

  if(this.is_node == 1)
  {
    for(var i in this.sub)
    {
      this.sub[i].co_t_item(id, id_down);
    }
  }

  return true;
}

function g_t_item_path(id, withItem, isFirst, path)
{
  isFirst = (typeof isFirst == "undefined") ? true : isFirst;
  withItem = (typeof withItem == "undefined") ? true : withItem;

  path = (isFirst) ? new String("") : path;

  if(this.ID == id)
  {
    if(isFirst)
    {
      return "/";
    }

    //if(this.is_node == 1) return this.internal_name;
    return (withItem) ? ((this.internal_name != null) ? this.internal_name : this.name) : " ";
  }

  if(this.is_node == 1)
  {
    var tmp = "";

    for(var i in this.sub)
    {
      tmp = this.sub[i].g_t_item_path(id, withItem, false, path);

      if(tmp != "")
      {
        path = tmp;
        //alert("the:" + path);

        path = ((this.internal_name != null) ? this.internal_name : this.name) + "/" + path;

        if(isFirst)
        {
          path = "/" + path;
        }

        return path;
      }
    }
  }

  return "";
}

// help function
function doClick(to_click)
{
  if(typeof to_click == "undefined") to_click = "send_data";

  var to_check = document.tree;
  var elem = to_check.elements[to_click];

  if(typeof elem != "undefined") elem.click();
}

function onOver_line(lineid, select_line, tree_c, doc)
{
  if(!is_string(lineid) || strlen(lineid)===0 ||
     (!isset(tree_c) && !isset(tree_color)) ||
     (!is_bool(select_line) && !is_number(select_line))
    ) return false;

  if(!isset(tree_c)) tree_c = tree_color;

  if(!isset(doc)) doc = document;

  var elem = doc.getElementById(lineid);

  if(!elem) return false;

  elem.bgColor = (select_line ? tree_c.SELECTED : tree_c.NONE);

  return true;
}

