$(function(){
	moreInfoPanel = $("div#moreinfo");
	moreInfoPanel.hide();
	
	resultsPane = $("#results-pane");
	resultsPane.hide();
	
	$("a.toggle").click(function() {
		moreInfoPanel.animate({
  			height: 'toggle'
		}, "fast");
		return false;
	});
	
	refineSearch = $("#search-filter-box h3");
	filterPanel = $("#search-filter-box .filter-options");
	filterPanelCloseLink = $("#search-filter-box a.close-filter-options"); 
	
	refineSearch.click (function() {
		filterPanel.animate({
  			height: 'toggle'
		}, "fast");
		return false;
	});
	
	filterPanelCloseLink.click (function() {
		filterPanel.animate({
  			height: 'toggle'
		}, "fast");
		return false;
	});
    
    $("#searchbox").keyup(function() {
    	if($.trim($("#searchbox").val()) == "") {
				resultsPane.hide();
		}
		else {
			$.post("/search/data.php", {q: $("#searchbox").val()}, function(data) {
				resultsPane.show();
				$("#results-pane").html(data);
			});
		}
	});
	
	window.setTimeout(function() {
		$("#invalid-access").animate( { backgroundColor: 'white' }, 1000).slideUp("fast");
	},3000);
});