var obj = null;
function checkHover() {
    if (obj) {
        obj.find('.SubMenu').fadeOut('fast');
    }
}

$(document).ready(function() {
    $('.MenuItem').hover(function() {
        if (obj) {
            obj.find('.SubMenu').hide();
            obj = null;
        }

        $(this).find('.SubMenu').show();
    }, function() {
        obj = $(this);
        setTimeout("checkHover()", 400);
    });
});