/******************
 * 
 * Class MenuLink *
 * 
 *****************/
(function(){
  MenuLink = function(element){
  
    this.elt = element;
    this.leave = false;
    this.enter = false;
    this.initListeners(this);
  };
  
  MenuLink.prototype.initListeners = function(obj){
    obj.elt.mouseenter(function(evt){
      if(!$(this).hasClass("actif")){
        obj.enter = true;
        obj.leave = false;
        
        $(this).animate({"opacity":0.3, "filter":"alpha(opacity=30)"}, {
          complete:function(){
            $(this).addClass("preactif");
           // $(this).css({"display":"block","opacity":1, "filter":"alpha(opacity=100)"});
            $(this).animate({"opacity":1, "filter":"alpha(opacity=100)"}, {
                complete:function(){
              //    $(this).css({"display":"block","opacity":1, "filter":"alpha(opacity=100)"});
                },
                step:function(now, fx){
                  if(obj.leave){
                    $(this).stop();
                  }
                },
                duration:Application.FADE_SPEED_HIGH
              });
            
          },
          step:function(now, fx){
            if(obj.leave){
              $(this).stop();
            }
          },
          duration:Application.FADE_SPEED_HIGH
        });
      }
    });
    
    
    obj.elt.mouseleave(function(evt){
      if(!$(this).hasClass("actif")){
        obj.enter = false;
        obj.leave = true;
   
        $(this).animate({"opacity":0.3, "filter":"alpha(opacity=30)"}, {
          complete:function(){
            $(this).removeClass("preactif");
            
            $(this).animate({"opacity":1, "filter":"alpha(opacity=100)"}, {
              complete:function(){
             //   $(this).css({"display":"block","opacity":1, "filter":"alpha(opacity=100)"});
              },
              step:function(now, fx){
                if(obj.enter){
                  $(this).stop();
                }
              },
              duration:Application.FADE_SPEED_HIGH
            });
            
          },
          step:function(now, fx){
            if(obj.enter){
              $(this).stop();
            }
          },
          duration:Application.FADE_SPEED_HIGH
        });
        
      }
    });
  };
  
})();
// end Class MenuLink
