﻿$(document).ready(function () {

    function topMenuOver() {

        $(this).find("ul.submenu").css("visibility", "visible");
        $(this).find("ul.submenu").css("z-index", "9");
        $(this).find("ul.submenu").animate({ "top": "0px" }, 1000);
    };

    function topMenuOut() {

        $(this).find("ul.submenu").css("z-index", "8");
        var menuHeight = $(this).find("ul.submenu").height() * -1;
        $(this).find("ul.submenu").animate({ "top": menuHeight }, 600);
    };


    var config = {
        sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
        interval: 100, // number = milliseconds for onMouseOver polling interval    
        over: topMenuOver, // function = onMouseOver callback (REQUIRED)    
        timeout: 400, // number = milliseconds delay before onMouseOut    
        out: topMenuOut // function = onMouseOut callback (REQUIRED)    
    };

    $("ul.topmenu li").hoverIntent(config);

});
