﻿$.fn.pause = function (duration) {
    $(this).stop().animate({ dummy: 1 }, duration);
    return this;
};

$(document).ready(function () {
    $(".nav").css({ height: "37px" });


    $(".nav").children().children().each(function (index) {
        $(this).children("a").html($(this).children("a").html().replace(" ", "<br />"));
    });

    var height = 0;
    $(".nav").children().children().each(function (index) {
        if ($(this).height() > height) {
            height = $(this).height();
        }
    });

    $(".nav").children().children().each(function (index) {
        $(this).children('ul').css({ height: (height - 40) + "px" });
    });

    $(".nav").mouseenter(
		function () {


		    $(this).stop().pause(80).animate({ height: height + 25 + "px" }, {
		        duration: 800,
		        specialEasing: {
		            width: 'linear',
		            height: 'easeInOutSine'
		        }
		    });
		}).mouseleave(
		function () {
		    $(this).stop().pause(80).animate({ height: "37px" }, {
		        duration: 500,
		        specialEasing: {
		            width: 'linear',
		            height: 'easeInOutSine'
		        }
		    });
		}
	);
});
