jQuery.noConflict();
jQuery(document).ready(function(){
    
    jQuery("#menu").mouseover(function(){
        if(timer != null) clearTimeout(timer); 
    });

});
    
var selectMenuSubId = null;
var timer = null;

function showMenuSub(id) {    
    if (selectMenuSubId != null && selectMenuSubId != id) {
        hideMenuSubAction(id);
    }

    if(jQuery("#sub_"+id).is(":hidden")) {
        jQuery("#sub_"+id).slideDown("normal");
        jQuery("#"+id).css("background-color","#5a5958");
        selectMenuSubId = id;
    }
    
    jQuery("#"+id).mouseover(function(){
        if(timer != null) clearTimeout(timer); 
    });
    
    jQuery("#"+id).mouseout(function(){
        hideMenuSub(id);
    });
}

function hideMenuSub() {
    if(timer != null) clearTimeout(timer); 
    timer = setTimeout(function(){hideMenuSubAction(selectMenuSubId)},1000);
}

function hideMenuSubAction(id){
    if(timer != null) clearTimeout(timer);
    if (jQuery("#sub_" + selectMenuSubId).is(":visible")) {
        jQuery("#sub_" + selectMenuSubId).slideUp("normal");
    }
    jQuery("#"+selectMenuSubId).css("background-color",'');
    selectMenuSubId = null;
}