$(function () {

    //Fix Errors - http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup/

    //Remove outline from links
    $("a").click(function () {
        $(this).blur();
    });

    //When mouse rolls over
    $("#NavMenu li").mouseover(function () {
        if (this.innerHTML.toUpperCase().indexOf('<DIV>') == -1)
            return;

        var code = $('p', this).parent().html().toUpperCase();
        var cnt = code.split(/<P>/g).length - 1;

        var menuHeight = (25 * cnt);
        if (this.value != "")
            menuHeight = this.value;

        $(this).stop().animate({ height: (35 + menuHeight) + 'px' }, { queue: false, duration: 600, easing: 'easeOutBounce' })
    });

    //When mouse is removed
    $("#NavMenu li").mouseout(function () {
        if (this.innerHTML.toUpperCase().indexOf('<DIV>') == -1)
            return;

        $(this).stop().animate({ height: '30px' }, { queue: false, duration: 600, easing: 'easeOutBounce' })
    });

});
