$(document).ready(function() {	
	$('#inputNumber').hide();
	$('#inputString').val('');
	
	$('#submitKeyword').hide();
	$('#inputKeyword').val('');
});

function lookup(inputString) {
	$('#inputNumber').hide();
	
	if(inputString.length == 0) {
		// Hide the suggestion box.
		$('#suggestions').hide();
	} else {
		$.post("_search_number.php", {queryString: ""+inputString+""}, function(data){
			if(data.length >0) {
				$('#noSuggestions').hide();
				$('#suggestions').show();
				$('#autoSuggestionsList').html(data);
			} else {
				$('#noSuggestions').show();
				$('#suggestions').hide();
			}
		});
	}
}


function lookupKeyword(inputKeyword) {
	$('#inputKeyword').hide();
	
	if(inputKeyword.length == 0) {
		// Hide the suggestion box.
		$('#resultsKeyword').html("");
		$('#submitKeyword').hide();	
		
	} else {
		$.post("_search_keyword.php", {queryString: ""+inputKeyword+""}, function(data){
			if(data.length >0) {
				
				$('#resultsKeyword').html("Total results available: "+data);
				if (Number(data)>0) {
					$('#submitKeyword').show();	
				} else {
					$('#submitKeyword').hide();	
				}
				
				
			} else {
				$('#resultsKeyword').html("");
				
			}
		});
	}
}

function fill(thisValue) {
	$('#inputString').val(thisValue);
	setTimeout("$('#suggestions').hide();", 200);
	$('#inputNumber').show();
}

