var Openmoomenu = new Class ({
  Implements : Options,
 
  options : {
    delay: 400
    /*
     *animate: {
     *  props: ['height','opacity','width'],
     *  options: {
     *    duration:700,
     *    fps: 100,
     *    transition: 'sine:out'
     *  }
     *}
     */
  },

  preventOverlap: function( hide, title, titles ){
    return;
    display = hide ? "none" : "block";
    if( title.id == "last" && titles.length >= 3 ){
      $$('.cornerRight')[1].setStyle('display', display);
      if( (el = $('navigatorContainer')) )
        el.getElement('.cornerRight').setStyle('display', display );
    }
  },
 
  initialize: function(container, options) {
    this.setOptions(options);
    this.container = document.getElement(container);
    this.titles = this.container.getChildren(); 
    this.open = '';
    this.titles.each(function(title){
      if (title.getElement('ul')) {
        title.store('w',title.getElement('ul').getCoordinates(title).width);
        title.store('h', title.getElement('ul').getCoordinates(title).height);
        //title.store('h', title.getSize().y * title.getElements('a').length );
        title.addEvent('mouseover',function(title){
          $clear(this.remove_d);
          this.preventOverlap( true, title, this.titles );
          if (!title.hasClass('sfHover')) {
            if (this.open != ''){
              if (this.open.getElement('ul'))
                this.open.removeClass('sfHover'); 
              this.open = '';
            }
            this.menu = title.getElement('ul');
            this.open = title;
            this.transitions = {};
            if( this.options.animate ){
              this.options.animate.props.each(function (prop) {
                this.menu.setStyle(prop,0);
                if (prop == 'opacity')
                  this.transitions.opacity = 1; 
                if (prop == 'width')
                  this.transitions.width = title.retrieve('w'); 
                if (prop == 'height')
                  this.transitions.height = title.retrieve('h'); 
              },this); 
              title.addClass('sfHover');
              this.menu.set('morph',this.options.animate.options);
              this.menu.get('morph').start(this.transitions);
            }
          }
          this.menu.setStyle('display','block');
        }.bind(this,title));
 
        title.addEvent('mouseleave',function(title){
          this.preventOverlap( false, title, this.titles );
          this.remove_d = (function(){title.removeClass('sfHover'); this.open = '';}).delay(this.options.delay);
          this.menu.setStyle('display','none');
        }.bind(this,title)); 
      }
      else {
        title.addClass('');
        title.addEvent('mouseover',function(title){
          $clear(this.remove_d);
          if (this.open != title) {
            if (this.open != ''){
              if (this.open.getElement('ul'))
                this.open.removeClass('sfHover'); 
              this.open = '';
            }
          }
          this.open = title;
        }.bind(this,title));
      }
    },this);
 
  }
});
