
// MMSN template
// Copyright exorbyte GmbH, 2008. All rights reserved.

function snSetup($) {

	function myCallback(event, data, formatted) {
	  // handle the selection
	  formatted = formatted.replace(/<\/?[^>]+(>|$)/g, "");
	  $("#suggest1").val(formatted);
	  document.search.source.value = 'exorbyte'; 
	  document.search.submit(); 
	  //return true;
	  //location.assign("/servlet/weikatec.search.SearchServletMmx?query="+formatted+"&source=exorbyte");
	}

	$("#suggest1").result(myCallback);
 
	// To send the input value to the proxy script for use in eg the Keywords
	// field, simply add 'Keywords: getInputValue' to the list of extraParams
	// in the call to autocomplete() below.
	function getInputValue() {
		return $("#suggest1").val();
	}

	function formatHead() {
	  return "<span class='sn_header'>Einige Vorschläge zu Ihrem Suchbegriff: <!-- em>'" + $("#suggest1").val() + "'</em --></span>";
	}


	function formatRow(row) {
		var inHtml =  row.SN_value + "&nbsp;("+ row.Extension +")";
		inHtml += "<!-- " + row.Bias + " -->";
		return inHtml;
	}

	$("#suggest1").autocomplete("/mmsn", {
		max: 10,
		extraParams: { Bias: 100, mm_port: 22004, mm_host: "busca4.weikatec.com" },
		formatItem: formatRow,
	        formatHeader: formatHead,
			      showLogo: false,
			      width:368,
		highlight: false
	});
	//}).focus();
	
}


