﻿$(document).ready(function() {
						   
						   
	$('form').submit(function(e) {
			fullname = $('#inputString').val();
			$('#loading').show();
						
			$.ajax({
            type: 'post',
            url: 'family/view-public-tribute.php',
            data: 'fullname=' + fullname,
			success: function(response) {
                $('#publictribute').fadeIn('1000').empty().append(response);

			$('#loading').hide();
			$('#publictribute').show();
			
			

			
            }
			
			});
			
			return false;	   
		});			   
						   
						   
	$("#inputString").focus(function() {
					
					$("#inputString").val("");
					
					$("#inputString").css("color", "#009966");
					$('#publictribute').hide();
	});
	
	$("#inputString").keyup(function(inputString) {
	//test the length of the input box this is a self refrence to the input object on which you clicked
	$('#loading').hide();
	mysearch = $(this).val();
	if($(this).val().length == '0') {
		
			// Hide the suggestion box.
			$('#suggestions').hide();
			
		} else {
				//alert($(this).val().length) debug the string from the input box for search;
				$.post("family/get-details.php", {queryString: ""+mysearch+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
					
					
				}
				return false;
			});
		}
	
	});
	
$("#inputString").keydown(function(inputString) {	
$('#loading').show();

});
						   
});
//function lookup(inputString) {
		
//} // lookup
	
function fill(thisValue) {
		$('#inputString').val(thisValue);
		$('#loading').hide();
		setTimeout("$('#suggestions').hide();", 1000);
		
}

