window.addEvent('domready', function(){
  var cursor = $('curseur');
  var menus = $('menu').getElements("LI");
  var frame = $('menu');
  var cursor_original_position;
  
  
  menus.each(function(elem){
    if (elem.getElement("A").hasClass("actif"))
    {
      cursor_original_position = elem.getCoordinates(frame).left + elem.getSize().x / 2 - 5;
      cursor.setStyle('left', cursor_original_position);
    }
    
      elem.addEvent('mouseenter', function(){
        cursor.tween('left', this.getCoordinates(frame).left + this.getSize().x / 2 - 5);
      });
      
      elem.addEvent('mouseleave', function(){
        cursor.tween('left', cursor_original_position);
      });
  });
  
  var targets = $$('.target');
  
  targets.addEvent('click', function(e){
    e.stop();
    window.open(this.href); return false;
  });
  
});
