window.addEvent('load', function(){

// Hide all submenu link
$('sublinks').getElements('ul').setStyle('display', 'none');

// Show by default the first submenu related to the tab "Home"
$('s1_m').setStyle('display', 'block');

$$('#mymenu li').each(function(el){
el.getElement('a').addEvent('mouseover', function(subLinkId){

var layer = subLinkId+"_m";

// Display current submenu
$('sublinks').getElements('ul').setStyle('display', 'none');
$(layer).setStyle('display', 'block');
}.pass( el.id)
);
});

// --------------------------------------- //
// SHOW and HIDE Submenu with MooTools Toggle animation

// Get the layer to animate
var mySlide = new Fx.Slide('sublinks');

// Prepare onClick event for the link with ID="op1"
$('op1').addEvent('click', function(e){

// Get text contained into the link :"Hide submenu"
var textLink = $('op1').innerHTML;

// When an user click on this link update text: "Hide submenu" or "Display submenu"
if(textLink=='Hide submenu'){
$('op1').innerHTML = 'Display submenu';
} else {
$('op1').innerHTML = 'Hide submenu';
}

// Event Toggle for the Submenu
e = new Event(e);
mySlide.toggle();
e.stop();
});
});