
$.fn.pause = function(duration) {
	$(this).stop().animate({ dummy: 1 }, duration);
	return this;
};

function mouseleft() {
	$("#nav-bar").triggerHandler("mouseleave");
	
}

$(document).ready(function(){
	var selectedInput = null;
	
	var maxLI = 0;
	$("#nav li ul").each(function(){
	   var h = $(this).height();
	   if(h > maxLI)
	        maxLI = h;
	});
	
	$("#nav-bar").mouseenter(
		function () {
			$(this).stop().pause(60).animate({ height: (maxLI+50)+"px" }, 600, "easeOutQuart" );
	}).mouseleave(
		function () {
			if (selectedInput == null) {
				$(this).stop().pause(60).animate({ height:"30px" }, 600, "easeOutQuart" );
			}
		}
	);

});
