function tabbed() {
  this.tab_open = false;
  this.s_content_id = "ld_content";
  
  this.get_linked_docs = function (obj, s_type, l_id, s_get) {
    obj.blur();
    this.close(this.tab_open.id == obj.parentNode.id);
    if (!this.tab_open || this.tab_open.id != obj.parentNode.id) {
      var p = obj.parentNode;
      $(p).addClass("bright");
      this.tab_open = p;
      p = p.parentNode;
      $(p).append("<div id=\"" + this.s_content_id + "\" class=\"zi2 bgfff brightborder p_tabs c\"><img src=\"/bilder/icons/ajax-loader.gif\" /></div>");
      $.post("/include/get_linked_docs.ajax.php", { t: s_type, id: l_id, get: s_get }, function(data) { tabs.reply(data) });
    } else
      this.tab_open = false;
  }
  
  this.close = function(b_keep_tab_open) {
    if (this.tab_open) {
      $(this.tab_open).removeClass("bright");
      $("#" + this.s_content_id).remove();
    }
    if (!b_keep_tab_open)
      this.tab_open = false;
  }
  
  this.reply = function(data) {
    $("#" + this.s_content_id).removeClass("c")
    data = '<div style="text-align: right; font-size: 0.8em;"><a href="javascript:void(0)" onclick="tabs.close();">Schließen</a></div>' + data;
    $("#" + this.s_content_id).html(data);
  }
}

var tabs = new tabbed();