$(document).ready(function(){
	$("a").focus(function(){
		this.blur();
	})
	
	
	$("#searchForm").submit(function(){
		if ($("#searchTerms").val() == ""){
			return false;
		}
	})
	
//	$("#searchTerms").focus();
	
	$("#viewControlButton").css("display","none");
	$("#viewLimit").removeClass("padRight");
	
	$("#viewSort,#viewLimit").change(function(){
		location.href = '/' + $("#jumpPage").val() + '?_sid=' + $("#_sid").val() + '&row=' + $("#row").val() + '&limit=' + $("#viewLimit").val() + '&sort=' + $("#viewSort").val() + '&srch_terms=' + $("#searchTerms").val() + '&srch_type=' + $("#searchType").val();
//		location.href = "/" + $("#_sname").val() + '/' + $("#_sid").val() + '/' + $("#row").val() + '.' + $("#viewLimit").val() + '.' + $("#viewSort").val() + '.' + $("#searchTerms").val() + '&srch_type=' + $("#searchType").val();
	})
	
	$("#searchTerms").autocomplete("/dyn/autocomp.php", {
		width: 260,
		selectFirst: false,
		extraParams: {
    	srch_type: function() { return $("#searchType").val(); }
		}
	});
	
	$("#searchTerms").result(function(event, data, formatted) {
		if (data) {
			$(this).parent().next().find("input").val(data[1]);
		}
	});	
	
	$("#searchType").change(function(){
		$("#searchTerms").flushCache();
	})

//	$("#searchTerms").autocomplete("/dyn/autocomp.php");
});