function CLASS_NAVI_ELEMENT(p_parent,p_index,p_root)
{
  //Öffentliche Variablen
  this.className = "navi_element";
  this.parent = p_parent;
  this.level = this.parent.level+1;
  this.label = "";
  this.client_width = 0;
  this.left = 0;
  this.action = new Array();
  this.active = false;
  this.displayed = false;
  this.children = new Array();
  this.index = p_index;
  this.root = p_root;
  this.name = "";
  this.hideme = "false";

  this.fenster_div;
  this.bg_div;
  this.content_div;
  this.label_span;
  this.xml = "";
  //Private Variablen

  

  //Öffentliche Methoden
  this.init_from_xml = function(xml){
  this.xml = xml;
  var xml = xml.childNodes;
  var i=0;
  for(var counter=0;counter<xml.length;counter++) {
    if (xml[counter].firstChild){
    switch(xml[counter].nodeName.toLowerCase()){
      case "label":
        this.label = xml[counter].firstChild.nodeValue;
        break;
      case "name":
        this.name = xml[counter].firstChild.nodeValue;
        break;
      case "hide":
        this.hideme = xml[counter].firstChild.nodeValue;
        break;
      case "action":
        this.action.push(xml[counter].firstChild.nodeValue);
        break;
      case "element":
        var temp = new CLASS_NAVI_ELEMENT(this,i,this.root)
        i++;
        temp.init_from_xml(xml[counter]);

        this.children.push(temp);
        break;
    }  
	}
  }
  }
  this.draw = function(){
    //create deeplink
    var temp_nav = "";
    if (this.hideme != "true"){
      if (this.level == 1){
        temp_nav = "navigate_to_by_index(" + this.index + ");";
      }else if(this.level == 2){
        temp_nav = "navigate_to_by_index(" + this.parent.index + "," + this.index + ");";
      }            
    }
    var temp = new CLASS_DEEPLINK(this,this.root,temp_nav);
    temp.init_from_xml(this.xml);
    //end create deeplink
  
    if (this.hideme != "true"){
      this.fenster_div = document.createElement("div");
  
      this.fenster_div.className = this.className;
      for(var counter=0;counter<this.index;counter++) {
        this.left += this.parent.children[counter].client_width+2;
      }
      
      this.fenster_div.style.top = (this.level-1)*27+(this.level-1)*2;
      this.fenster_div.style.left = this.left - this.parent.left;//this.index*104-this.parent.index*104;
      this.fenster_div.setAttribute('active',"false");
      this.fenster_div.obj = this;
  
      this.bg_div = document.createElement("div");
      this.bg_div.className = "bg";
      this.bg_div.style.backgroundColor = this.root.color;
      this.bg_div.style.filter="alpha(opacity:" + (this.root.element_alpha*100) + ")";
      this.bg_div.style.KHTMLOpacity = this.root.element_alpha;
      this.bg_div.style.MozOpacity = this.root.element_alpha;
      this.bg_div.style.opacity = this.root.element_alpha;
      
      
      this.fenster_div.appendChild(this.bg_div);
      //
      this.content_div = document.createElement("div");
      this.content_div.className = "content";
      this.content_div.onselectstart = "return false";
          this.label_span = document.createElement("span");
          this.label_span.className = "nav_l"+this.level;
          this.label_span.innerHTML = this.label;
          this.content_div.appendChild(this.label_span);
          
      //register events
      this.content_div.onmouseout = this.hover_event_out;
      this.content_div.onmouseover = this.hover_event_over;
      this.content_div.onclick = this.click_event;
      
      initLinks(this.content_div);
  
      this.fenster_div.appendChild(this.content_div);
      this.parent.fenster_div.appendChild(this.fenster_div);
      
        //länge anpassen
       this.fenster_div.style.display = "block";
       //Länge eines Navigationseintrags min 102 pixel(inkl. 15 pixel platz links und rechts). Wenn Text länger ist, dann wird in 10px Schritten vergrößert. 
       if (this.label_span.clientWidth<102-30){
         this.client_width = 102;
       }else{
         this.client_width = Math.ceil((this.label_span.clientWidth+30)/10)*10;
       }
       this.fenster_div.style.width = this.client_width;
      //ende länge anpassen
       
      if (this.level>1) {
        this.fenster_div.style.display = "none";
        this.displayed = "true";
      }
      
    	for (var counter=0;counter<this.children.length;counter++) {
        this.children[counter].draw();
      }
    }
  }
  
  this.toggle_display = function(){
    if (this.displayed == true){
     this.hide();
    }else{
     this.show();
    }
  }
  this.show = function(){
     
     this.fenster_div.style.display = "block";
     this.displayed = true;
     
  }
  this.hide = function(){
     this.fenster_div.style.display = "none";
     this.displayed = false;
  }
  this.change_alpha = function(alpha){
      var bg = this.bg_div;
           
      if (document.all) {
              bg.style.opacity = alpha;
	            bg.style.filter = 'alpha(opacity='+(alpha*100)+')';
      } else if (document.getElementById) {
             bg.style.MozOpacity = alpha;
      }
  }
  this.do_actions = function(){
	variables["akt_desk3_deeplink"] = this.name;
      for( var i = 0; i < this.action.length; i++ ) {
        show(this.action[i]);
      }
  }
  this.hover_event_out = function(e){
      var trigger = '';
      if(!e && event.srcElement) trigger= event.srcElement;
      else if(e.target) trigger = e.target;
    
    var target = trigger;
    for( var i = 0; i < 10; i++ ) {
      target = target.parentNode;
      if (target.className == "navi_element"){
        target = target.obj;
        break;
      }
    }
    
      if (!target.active){
        var alpha = target.root.element_alpha;
        target.change_alpha(alpha);
      }
  }
  this.hover_event_over = function(e){
    var trigger = '';
    if(!e && event.srcElement) trigger= event.srcElement;
    else if(e.target) trigger = e.target;

    var target = trigger;
    for( var i = 0; i < 10; i++ ) {
      target = target.parentNode;
      if (target.className == "navi_element"){
        target = target.obj;
        break;
      }
    }
    if (!target.active){
      var alpha = target.root.element_alpha_active;
      target.change_alpha(alpha);
    }
    }
  this.click_event = function(e){
    var trigger = '';
    if(!e && event.srcElement) trigger= event.srcElement;
    else if(e.target) trigger = e.target;
  
    var target = trigger;
    for( var i = 0; i < 10; i++ ) {
      target = target.parentNode;
      if (target.className == "navi_element"){
        target = target.obj;
        break;
      }
    }
    target.click();
  }
     
  this.click = function(){
    var bg = this.bg_div;

    if (this.level == 1){
      if (!this.active){
        if (this.root.active_element_l1 != null){
          this.root.active_element_l1.change_alpha(this.root.element_alpha);
          this.root.active_element_l1.displayed = false;
          this.root.active_element_l1.active = false;
          for( var i = 0; i < this.root.active_element_l1.children.length; i++ ) {
            this.root.active_element_l1.children[i].hide();
          }
        }
        
        for( var i = 0; i < this.children.length; i++ ) {
          this.children[i].show();
        }
        this.active = true;
        this.change_alpha(this.root.element_alpha_active);
        this.root.active_element_l1 = this;
        if (this.children.length == 0){
          if (this.root.active_element_l2 != null){
            this.root.active_element_l2.change_alpha(this.root.element_alpha);
            this.root.active_element_l2.active = false;
          }
        }
      }
      
      //click on first subentry
      if (this.action.length == 0){
        close_all_windows();
        this.children[0].do_actions();
        this.children[0].active = true;
        if (this.root.active_element_l2 != null){
          this.root.active_element_l2.change_alpha(this.root.element_alpha);
          this.root.active_element_l2.active = false;
        }
        this.root.active_element_l2 = this.children[0];
        this.children[0].change_alpha(1.0);
        ignorehash = true;
        //window.location.hash = this.children[0].name;
        hashListener.setHash(this.children[0].name);
        set_oppacity("desk2",1.0);
		var bg = document.getElementById("desk2");	
		bg.style.zIndex = 1;
      }else{
        if (this.root.active_element_l2 != null){
          this.root.active_element_l2.change_alpha(this.root.element_alpha);
          this.root.active_element_l2.active = false;
          this.root.active_element_l2 != null
        }    
      }
      //end click on first subentry
      
      
    }else if (this.level == 2){
      if (!this.active){
        if (this.root.active_element_l2 != null){
          this.root.active_element_l2.change_alpha(this.root.element_alpha);
          this.root.active_element_l2.active = false;
        }
          this.active = true;
          this.change_alpha(this.root.element_alpha_active);
          this.root.active_element_l2 = this;
      }
    }
      
    if (this.action.length != 0){
      ignorehash = true;
      hashListener.setHash(this.name);
      //window.location.hash = this.name;
      close_all_windows();
      for( var i = 0; i < this.action.length; i++ ) {
        show(this.action[i]);
      }
      set_oppacity("desk2",1.0);
	  var bg = document.getElementById("desk2");	
		bg.style.zIndex = 1;
    }
  }
  
  //Private Methoden
}
