window.addEvent('domready', function () {									  
    var footer = $('menu_image').getChildren();
    footer.forEach(function (un_menu_image) {
        if (footer) {			
	    var fx = new Fx.Tween(un_menu_image, {link:"cancel", property:"background-position"});
            fx.set('bottom left'); 
	    un_menu_image.addEvent('mouseover',function() {
                fx.set('top left');
            });
           un_menu_image.addEvent('mouseleave',function() {
               	fx.set('bottom left'); 
           });
		   
	}       	
    });	
	
    if ($('sous_menu')!= null){
        var menu = $('sous_menu');
  		var y_init_menu = menu.getPosition().y
  		var tween_y_menu = new Fx.Tween(menu, {property:"top", link:"cancel"});
  		
      
    	function update_menu() { 
        	if (window.getScroll().y > 250) {
            	tween_y_menu.start(window.getScroll().y - 250);
	    		if ( window.getScroll().y > $('menu_contenu').getSize().y + 250 - menu.getSize().y ) { 
	        		tween_y_menu.start($('menu_contenu').getSize().y - menu.getSize().y + 30);
            	}
	 		} else {
	        	tween_y_menu.start(0);   
    		 }
     	}
  
    	update_menu();
    	window.addEvent('scroll',update_menu);
    	window.addEvent('resize',update_menu);
  
	}
	
});