// initialize the jquery code
$(document).ready(function(){
	//autocomplete
	function findValueCallback(event, data, formatted){
		$("<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
	}

	function formatItem(row){
		return row[0] + " (<strong>id: " + row[1] + "</strong>)";
	}

	function formatResult(row){
		return row[0].replace(/(<.+?>)/gi, '');
	}

	// ADD AUTOCOMPLETE ATTRIBUTE TO FORMS WITH AUTOCOMPLETEOFF CLASS
	$('form.autocompleteOff').each( function() {
		$(this).attr('autocomplete','off');
	});
	$("#location").autocomplete('/includes/zip_response.cfm', {
		width: 270,
		matchContains: true,
		formatResult: formatResult
	});
});