$(document).ready(function() {
		$("div.search_button").click(
			function(){ 
				$("div#panel").animate({ height: "100px" }).animate({ height: "75px" }, "fast"); 
				$("div.search_button").toggle();
			}); 
		
		$("div#hide_button").click(
			function(){
				$("div#panel").animate({ height: "0px" }, "fast");
				$("#searchform").resetForm();
				$("#searchResults").slideUp();
			});
		
		//submit the form and return results of form submission to target class div
		var options = {
			target: "#searchResults", // target element(s) to be updated with server response
			success: function() {
				$("div#panel").animate({ height: "500px"});
				$("#searchResults").slideDown();
				$("#indicator").animate({ opacity: "0" });
			}
		};

		// bind to the form's submit event
		$("#searchform").submit(function() {
			$("#indicator").animate({ opacity: "1" });
			$("#searchResults").slideUp();
			// inside event callbacks 'this' is the DOM element so we first
			// wrap it in a jQuery object and then invoke ajaxSubmit
			$(this).ajaxSubmit(options);
			// !!! Important !!!
			// always return false to prevent standard browser submit and page navigation
			return false;
		});	
		
// close document			
});

