$(document).ready(function() {
		$("#api").autocomplete({
			source: function(req, add){ 
	                //pass request to server  
	                $.getJSON("library/code/php/dbquery_api.php?callback=?", req, function(data) { 
	                    //create array for response objects  
	                    var suggestions = []; 
	                    //process response  
	                    $.each(data, function(i, val){  
	                    suggestions.push(val.name);  
	                });  
	                //pass array to callback  
	                add(suggestions);  
	            });  
	        },
			
			width: 260,
			matchContains: true,
			//mustMatch: true,
			minLength: 5,			
			highlight: true,
			//multiple: true,
			//multipleSeparator: ",",
			selectFirst: false
		});
		$("#county").autocomplete({
			source: function(req, add){ 
	                //pass request to server  
	                $.getJSON("library/code/php/dbquery_county.php?callback=?", req, function(data) { 
	                    //create array for response objects  
	                    var suggestions = []; 
	                    //process response  
	                    $.each(data, function(i, val){  
	                    suggestions.push(val.name);  
	                });  
	                //pass array to callback  
	                add(suggestions);  
	            });  
	        },
			
			width: 260,
			matchContains: true,
			//mustMatch: true,
			minLength: 1,			
			highlight: true,
			//multiple: true,
			//multipleSeparator: ",",
			selectFirst: false
		});
		$("#countyaoi").autocomplete({
			source: function(req, add){ 
	                //pass request to server  
	                $.getJSON("library/code/php/dbquery_county.php?callback=?", req, function(data) { 
	                    //create array for response objects  
	                    var suggestions = []; 
	                    //process response  
	                    $.each(data, function(i, val){  
	                    suggestions.push(val.name);  
	                });  
	                //pass array to callback  
	                add(suggestions);  
	            });  
	        },
			
			width: 260,
			matchContains: true,
			//mustMatch: true,
			minLength: 1,			
			highlight: true,
			//multiple: true,
			//multipleSeparator: ",",
			selectFirst: false
		});
		$("#company").autocomplete({
			source: function(req, add){ 
	                //pass request to server  
	                $.getJSON("library/code/php/dbquery_company.php?callback=?", req, function(data) { 
	                    //create array for response objects  
	                    var suggestions = []; 
	                    //process response  
	                    $.each(data, function(i, val){  
	                    suggestions.push(val.name);  
	                });  
	                //pass array to callback  
	                add(suggestions);  
	            });  
	        },
			
			width: 260,
			matchContains: true,
			//mustMatch: true,
			minLength: 1,			
			highlight: true,
			//multiple: true,
			//multipleSeparator: ",",
			selectFirst: false
		});
	});	
