$().ready(function() {



	
	$("#bikeRemote").autocomplete("/js/jquery/autocomplete/search.php", {
		width: 460,		
		matchContains: true,
		selectFirst: false,			// the first autocomplete value will be automatically selected 
		max: 9, 					// Limit the number of items in the select box. Is also sent as a "limit" parameter with a remote request.
        //multiple: true, 
        //multipleSeparator: " ",
		formatItem: function(data, i, total) {
			// don't show the current month in the list of values (for whatever reason)
			//if ( data[0] == '1' ) 
				return(data[0]);
			//return data[0];
		}

	});
	$("#bikeRemote").result(function(event, data, formatted) {
		
		location.href = 'fahrrad-haendler.php?bundesland='+data[2]+'&ort='+unescape(data[3])+'&shop='+escape(data[4])+'&id='+data[1];
		if (data) {
			//alert(data[1]);
			$(this).parent().next().find("input").val(data[1]);
			//$("#result").html( "<p>Name: " + name + "<br/> Id: " + id + "<br/>  Code: " + code + "</p>");
		}
		
		
	});
	
	
	
	$("#clear").click(function() {
		$(":input").unautocomplete();
	});
});

