function fill(name, id)
{
    this.filled = true;
    jQuery('#customerSearch').attr('value',name);
    jQuery('#customerId').attr('value',id);
    jQuery('#suggestions').hide();
}

(function($jQ) {

	var filled = false;

	function lookup(inputString) {
		if(inputString.length == 0) {
		    // Hide the suggestion box.
		    $jQ('#suggestions').hide();
		} else {
		    $jQ.post("index.php?c_=gbOffer_Controller&m_=getCustomers", {queryString: ""+inputString+""}, function(data){
		        if(data.length >0) {
		            $jQ('#suggestions').show();
		            $jQ('#autoSuggestionsList').html(data);
		        }
		    });
		}
	} // lookup

	$jQ(document).ready(function(){

		var cs = $jQ("#customerSearch");

		cs.focus();

		$jQ("#customerSearch").keypress(function (e) {

			$jQ(this).stopTime();

			$jQ(this).oneTime(500, function() {
			lookup(this.value);

		  });

		});

	});

} ) (jQuery);
