function _resetCustomNavigationEntries(obj){
  obj = element_isObject(obj);

  var cnt = 1;
  for(var i in _customList){
    if(_customList[i].id == obj.id) continue;
    var newZIndex = (599-cnt);
    _customList[i].style.zIndex = newZIndex.toString();

    cnt++;
  }
}

function _addCustomNavigationEntry(obj){
		obj = element_isObject(obj);
		if(!obj) return;

		var teaserObj = element_isObject(obj.id+'_teaser');
		if(!teaserObj) return;

		var backObj = element_isObject('subnavigation_content_navigation_customized_panel_back');


    obj.alvine_index = obj.getAttribute('alvine:index');

		teaserObj.alvine_initPosition = element_getPosition(teaserObj, true);
		teaserObj.alvine_initOpacity = 98;

		obj.alvine_backObj = backObj;
		obj.alvine_teaserObj = teaserObj;
    teaserObj.alvine_parentObj = obj;

		_customList[obj.id] = obj;

		obj.alvine_size       = element_getSize(obj);
		teaserObj.alvine_size = element_getSize(teaserObj);

    obj.alvine_position   = element_getPosition(obj);
    obj.alvine_position.x = obj.alvine_position.x;

    obj.alvine_teaserPosition = {x:obj.alvine_position.x,y:(obj.alvine_position.y-teaserObj.alvine_size.height+10)}

    mouse_attachToObject(obj);
    mouse_attachToObject(teaserObj);

		obj.onmouseover = function(ev){
			if(!ev) ev = window.event;
      var mpos = this.alvine_getMousePosition(true, true);

			for(var i in _customList){
				if(i!=this.id){
					_customList[i].alvine_hideTeaserPanel();
          
				} else {
          //if(this.alvine_teaserObj.alvine_isVisible == true || mpos.y<10) return object_preventDefaultEventBehaviour(ev);
          if(this.alvine_teaserObj.alvine_isVisible == true) return object_preventDefaultEventBehaviour(ev);
					_customList[i].alvine_showTeaserPanel();
          
				}
			}

			return object_preventDefaultEventBehaviour(ev);
		};

		obj.onmouseout = function(ev){
			if(!ev) ev = window.event;

      var mpos = this.alvine_getMousePosition(true, true);


      if(mpos.y < 10) return object_preventDefaultEventBehaviour(ev);
      this.alvine_hideTeaserPanel();

			return object_preventDefaultEventBehaviour(ev);
		};

		obj.alvine_showTeaserPanel = function(){
			element_addClassName(this, 'active');

      element_removeClassName(this.alvine_teaserObj, 'hidden');

      this.alvine_backObj.alvine_previousIndex = (!this.alvine_backObj.alvine_activeIndex)?0:this.alvine_backObj.alvine_activeIndex;
      this.alvine_backObj.alvine_activeIndex = this.alvine_index;

      _resetCustomNavigationEntries(this);
      this.style.zIndex = '599';

      element_replaceClassName(this.alvine_backObj, 'bg_panel_'+this.alvine_backObj.alvine_previousIndex, 'bg_panel_'+this.alvine_backObj.alvine_activeIndex);
      
			element_setOpacity(this.alvine_teaserObj, 0);
			element_move(this.alvine_teaserObj, this.alvine_teaserPosition.x, this.alvine_teaserPosition.y);

      this.alvine_teaserObj.alvine_isVisible = true;

      ie6ToggleActiveXControls(false);

			effects_fade(this.alvine_teaserObj,this.alvine_teaserObj.alvine_initOpacity, 'now', 24, 16);
		};

		obj.alvine_hideTeaserPanel = function(){


      element_removeClassName(this, ' active');
			element_move(obj.alvine_teaserObj, obj.alvine_teaserObj.alvine_initPosition.x, obj.alvine_teaserObj.alvine_initPosition.y);

      obj.alvine_teaserObj.alvine_isVisible = false;

      
      ie6ToggleActiveXControls(true);
			return true;
		};





    teaserObj.onmouseout = function(ev){
			if(!ev) ev = window.event;

      var mpos = this.alvine_getMousePosition(true, true);


      if(mpos.y<10) return object_preventDefaultEventBehaviour(ev);

      var size = element_getSize(this);

      if( (mpos.x>3 && mpos.x<(size.width-3) ) && (mpos.y>3 && mpos.y<(size.height-3) ) ) {
         return object_preventDefaultEventBehaviour(ev);
       }

      this.alvine_parentObj.alvine_hideTeaserPanel();

      return object_preventDefaultEventBehaviour(ev);
    };


	}


	function _documentClickHandler(ev){
		if(!ev) ev = window.event;

		for(var i in _customList){
			if(typeof _customList[i].alvine_hideTeaserPanel != 'function') continue;

			_customList[i].alvine_hideTeaserPanel();
		}

		return object_preventDefaultEventBehaviour(ev);
	}