var Nav = new Class({

  initialize: function(nn){
    var borderLeftNav = $('border-left-nav');
    var topOffset = window.ie6 ? -1 : 0;
    nn.each(function(n, i) {
      var item = $('nav_item_' + n);
      var popup = $('pop_top_menu_' + n);
      if (item && popup) {
        var w = item.offsetWidth;
        popup.setStyles({
          left: item.offsetLeft + 'px',
          top: topOffset,
          width: w + 'px'
        });
        popup.getElement('.bottom_pop_top_menu_center').setStyle('width', (w - 16) + 'px');
        item.addEvent('mouseenter', function(){
          if (i == 0) borderLeftNav.addClass('hover');
          item.addClass('hover');
          this.showPopTopMenu(n);
        }.bind(this));
        item.addEvent('mouseleave', function(evt){
          if (i == 0) borderLeftNav.removeClass('hover');
          item.removeClass('hover');
          this.startTimerMenuHide(n,evt);
        }.bind(this));
        popup.addEvent('mouseenter', function(){
          this.breakTimerMenuHide(n);
        }.bind(this));
        popup.addEvent('mouseleave', function(evt){
          this.startTimerMenuHide(n,evt);
        }.bind(this));
      }
    }, this);
  },

  showPopTopMenu: function(id){
    eval('myVerticalSlide' + id).slideIn();
  },

  hidePopTopMenu: function(id){
    eval('myVerticalSlide' + id).slideOut();
  },

  startTimerMenuHide: function(id,evt){
    if (evt) evt = new Event(evt);
    eval("timeoutMenu" + id + " = window.setTimeout('hidePopTopMenu(" + id + ");' , 300 );");
  },

  breakTimerMenuHide: function(id){
    eval("clearTimeout(timeoutMenu"+ id +");");
  }

});

