$(document).ready(function() {

    $(".Item_1").after($(".sub_prod"));
    $(".Item_2").after($(".sub_floor"));
    $(".Item_3").after($(".sub_sport"));


    function megaHoverOver() {
        $(this).find(".sub_prod").stop().fadeTo('fast', 0.8).show();
        $(this).find(".sub_floor").stop().fadeTo('fast', 0.8).show();
        $(this).find(".sub_sport").stop().fadeTo('fast', 0.8).show();

        //Calculate width of all ul's
        (function($) {
            jQuery.fn.calcSubWidth = function() {
                rowWidth = 0;
                //Calculate row
                $(this).find("ul").each(function() {
                    rowWidth += $(this).width();
                });
            };
        })(jQuery);

    }

    function megaHoverOut() {
        $(this).find(".sub_prod").stop().fadeTo('fast', 0, function() {
            $(this).hide();
        });

        $(this).find(".sub_floor").stop().fadeTo('fast', 0, function() {
            $(this).hide();
        });

        $(this).find(".sub_sport").stop().fadeTo('fast', 0, function() {
            $(this).hide();
        });
    }



    var config = {
        sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
        interval: 10, // number = milliseconds for onMouseOver polling interval    
        over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
        timeout: 100, // number = milliseconds delay before onMouseOut    
        out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
    };
    $("ul#topnav li .sub_prod").css({ 'opacity': '0' });
    $("ul#topnav li").hoverIntent(config);

    $("ul#topnav li .sub_floor").css({ 'opacity': '0' });
    $("ul#topnav li").hoverIntent(config);

    $("ul#topnav li .sub_sport").css({ 'opacity': '0' });
    $("ul#topnav li").hoverIntent(config);



});

