<script type="text/javascript">
	//<![CDATA[
	/* 
	 * This example is from the book _Ajax: The Definitive Guide_ by Anthony T. Holdener III.
	 * Written by Anthony T. Holdener III.  Copyright (C) 2008 O'Reilly Media, Inc.
	 * You may study, use, modify, and distribute this example for any purpose.
	 * This example is provided WITHOUT WARRANTY either expressed or implied.
	 */
	/* Example 16-6. Submitting a search from hints. */

	/**
	 * This function, executeSearch, sends a search request to the server
	 * for the passed /p_searchString/ and places the results in the /innerHTML/
	 * of the <div> element /myResults/.
	 *
	 * @param {String} p_searchString The string that is to be searched for.
	 * @return Returns false so that the click event does not follow through.
	 * @type Boolean
	 * @see Ajax#Request
	 */
	function executeSearch(p_searchString) {
		/* Is there anything to search for? */
		if (p_searchString != '')
			new Ajax.Request('search.php', {
				method: 'post',
				parameters: { searchString: p_searchString },
				onSuccess: function(xhrResponse) {
					/* Did we get any results? */
					if (xhrResponse.responseText == 0)
						$('myResults').innerHTML = '0 results found.';
					else
						$('myResults').innerHTML = xhrResponse.responseText;
				}
			});
		return (false);
	}
	//]]>
</script>