var ulOpen = new Array();
for(var i = 1; i < 6;i++) ulOpen[i] = false;

$(document).ready(function(){
    $(".menu_elem").mouseenter(function(){
        ulOpen[$(this).children("ul").attr("tabindex")] = true;
        $(this).children("ul").animate({ top: "0px" }, 400, 'linear', function(){if(ulOpen[$(this).attr("tabindex")]) $(this).css("z-index", "100")});
    });

    $(".menu_elem").mouseleave(function(){
        $(this).children("ul").css("z-index", "-100").animate({ top: "-55px" }, 400);
        ulOpen[$(this).children("ul").attr("tabindex")] = false;
    });
});

