jQuery(function($) {
    // Global menu
    $('#gnavi li').hover(function() {
        $(this).addClass('hover');
    }, function() {
        $(this).removeClass('hover');
    });

    var eachTimeout = [],
        target = $('#gnavi ul');

    target.each(function(i) {
        var $this = $(this);
        $this.parent().hover(function() {
            target.hide();
            for ( var i=0; i<eachTimeout.length; i++ ) {
                clearTimeout(eachTimeout[i]);
            }
            $this.show();
        }, function() {
            eachTimeout[i] = setTimeout(function() {
                $this.hide();
            }, 50); // ここの300を大きくすると消えるまでの待ち時間が増える
        });
    });
});
