﻿$(document).ready(function() {
    if ($.browser.msie && $.browser.version < 7) return;
    // hover effect for main menu
    $('#mnu li').removeClass('highlight')
    $('#mnu li a').append('<span class="hover" />').each(function() {
        var $span = $('> span.hover', this).css('opacity', 0);
        $(this).hover(function() {
            // on hover
            $span.stop().fadeTo(0, 1);
        }, function() {
            // off hover
            $span.stop().fadeTo(0, 0);
        });
    });

    // animate submenu in/out
    $("#mnu li").mouseover(function() { //When trigger is clicked...  

        //Following events are applied to the subnav itself (moving subnav up and down)
        $(this).find("ul#submnu").stop().slideDown('medium').show('medium', function() {
            $(this).height('auto');
        }); //Drop down the subnav on click  
        $(this).hover(function() { },
        function() {
            $(this).find("ul#submnu").stop().slideUp('medium'); //When the mouse hovers out of the subnav, move it back up  
        });
    });
});
