$(document).ready(function(){

    $(".top_nav_menu_items_item").bind("mouseenter", function(){
                var section_link = $(this).find("span");
        var menu_item_content=$("#" + $(this).attr("id") + "_content");
        menu_item_content.css("visibility", "visible");
                section_link.addClass("active_section");

        $(menu_item_content).bind("mouseleave", function(){
            $(this).css("visibility", "hidden");
                        section_link.removeClass("active_section");
        });

        $(this).bind("mouseleave", function(e){
            if (e.pageY < parseInt(menu_item_content.css("top"))){
                                menu_item_content.css("visibility", "hidden");                
                                section_link.removeClass("active_section");
            }
        });
    });
    
    //adjusting megamenu anchor left and right padding
    //var nav_item_anchors=$(".top_nav_item_col .gear_nav_li a");
    //var parent_div_width = 0;
    //var nav_item_anchor_padding = 0;
    //for (var a=0; a < nav_item_anchors.length; a++) {
    //    parent_div_width = parseInt($(nav_item_anchors[a]).parents(".top_nav_item_col").css("width"));
    //    nav_item_anchor_padding = parseInt($(nav_item_anchors[a]).css("padding-right"));
    //    $(nav_item_anchors[a]).css("width",  parent_div_width - (nav_item_anchor_padding * 2) + "px");
    //}

    $(".top_nav_item_col").equalWidths("gear");
    $(".gear_col_mid").equalHeights();
    $("#gear_first_col_mid").height($(".gear_col_mid").height());
    $("#gear_last_col_mid").height($(".gear_col_mid").height());
    $("#gear_bottom").width($(".gear_col_mid").addWidths()-48);

    $(".top_nav_item_col").equalWidths("explore");
    $(".explore_col_mid").equalHeights();
    $("#explore_first_col_mid").height($(".explore_col_mid").height());
    $("#explore_last_col_mid").height($(".explore_col_mid").height());
    $("#explore_bottom").width($(".explore_col_mid").addWidths()-51);
});
