//----------------------
// slide navigation
//----------------------

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

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

//slide open navigation on over (add focus someday)
$(document).ready(function(){
	var selectedInput = null;
	
	$("#query").focus(function() {
		selectedInput = this;
	});
	$("#query").blur(function() {
		selectedInput = null;
	});
	$("#nav-bar").click(
		function () {
			$("#query").unbind("blur", mouseleft);
			$(this).stop().pause(60).animate({ height:"25em" }, 600, "easeOutQuart" );
		}).mouseleave(
		function () {
			$("#query").bind("blur", mouseleft);
			if (selectedInput == null) {
				$(this).stop().pause(60).animate({ height:"35px" }, 600, "easeOutQuart" );
			}
		}
	);
});

//slide open navigation on over (add focus someday)
/*
$(document).ready(function(){
	$("#nav-bar").hover(
		function () {
			$(this).stop().pause(60).animate({ height:"19em" }, 400, "easeOutQuart" );
		},
		function () {
			$(this).stop().pause(60).animate({ height:"35px" }, 400, "easeOutQuart" );
		}
	);
});
*/


