function Navi() {
  
  this._mainNaviId = "main_navi";
  this._mainNaviActId = "main_navi_act";
  this._mainNaviActClass = "act_navi";
  this._mainNaviActHalfWidth = 20;
  this._mainNaviIEDiff = 66;
  this._mainNaviMarginLeft = 355;
  this._lastPointer = null;
  
  this.Navi = function() { }
  
  this.showLastSubNavi = function() {
    
    this.showSubNavi(this._lastPointer, 1);
    
    return true;
    
  }
  
  this.hideLastSubNavi = function() {
    
    this.hideSubNavi(this._lastPointer, 1);
    
    return true;
    
  }
  
  this.showSubNavi = function(pointer) {
    
    this._lastPointer = pointer;
    
    /*
    if (this.showSubNavi.arguments[1] != 1)
      this._actBow(pointer, 1);
    */
    
    document.getElementById(this._mainNaviActId).style.display = "block";
    
    this._moveActStatus(pointer);
    
    with (pointer.getElementsByTagName("div")[0].style) {
      
      display = "block";
      marginLeft = (this._getPosition(pointer).x - this._mainNaviMarginLeft).toString() + "px";
      
    }
    
    pointer.getElementsByTagName("ul")[0].style.marginLeft = Math.round(pointer.getElementsByTagName("img")[0].width / 2).toString() + "px";
    
    return true;
    
  }
  
  this.hideSubNavi = function(pointer) {
    
    document.getElementById(this._mainNaviActId).style.display = "none";
    
    /*
    if (this.hideSubNavi.arguments[1] != 1)
      this._actBow(pointer, 0);
    */
    
    pointer.getElementsByTagName("div")[0].style.display = "none";
    
    return true;
    
  }
  
  this._actBow = function(pointer, hide) {
    
    var liElements = pointer.parentNode.getElementsByTagName("li");
    
    for (var i = 0; i < liElements.length; i++)
      with (liElements[i])
        if (className == this._mainNaviActClass) {
          
          if (hide == 1)
            style.backgroundImage = "none";
          else
            style.backgroundImage = "url(/cms/fileadmin/templates/img/main_navi_act.gif)";
          
          break;
        
        }
      
    return true;
    
  }
  
  this._isIE = function() {
    
    if (navigator.appName.search(/internet\sexplorer/i) != -1)
      return true;
      
    return false;
    
  }
  
  this._moveActStatus = function(pointer) {
    
    var evalWidth = Math.round(pointer.getElementsByTagName("img")[0].width / 2) - this._mainNaviActHalfWidth - 1;
    
    if (this._isIE() == true)
      evalWidth -= this._mainNaviIEDiff;
    
    document.getElementById(this._mainNaviActId).style.marginLeft = (this._getPosition(pointer).x + evalWidth).toString() + "px";

    return true;
    
  }
  
  this._getPosition = function(element) {
    
    var x = 0, y = 0;
    
    while ((typeof(element) == "object") && (typeof(element.tagName) != "undefined")) {
      
      x += element.offsetLeft;
      y += element.offsetTop;
      
      if (element.tagName.toLowerCase() == "body")
        element = 0;
      
      if (typeof(element) == "object")
        if (typeof(element.offsetParent) == "object")
          element = element.offsetParent;
      
    }
    
    var position = new Object();
    
    position.x = x;
    position.y = y;
    
    return position;
    
  }
  
  this.setIEDiff = function(value) {
    
    this._mainNaviIEDiff = value;
    
    return true;
    
  }
  
}

/* Misc functions */


// Ansprechpartner PopUp
function openAP(ap) {
  
  switch(ap){
   case "ap_schubert":
    id = "203";
    break;
   case "ap_stremmel":
    id = "204";
    break;
   case "ap_fischer":
    id = "215";
    break;
  }
  str = "http://winckel.de/index.php?id=" +id ;
  window.open(str, "_blank", "width=280,height=290");

}