/**
* jQuery autocomplete
* See also bng/pi1/fe_index.php
*/
	// Format each item in the autocomplete drop-down. Row is array with different info from server (ajax)
	function formatItem(row) {
		return row[0] + " (" + row[1] + ")";
	}
	// Format the what is put in search field when the user selects an item of the dropdown.
	function formatResult(row) {
		return row[0];
	}
	
	// Call the plugin with different options
	// Documentation: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
	var $j = jQuery.noConflict();
	$j(document).ready(function() {
		$j("#tags").autocomplete("http://" + top.location.host, {
				inputClass: 		"ac_input",
				resultsClass:		"ac_results",
				loadingClass:		"ac_loading",
				minChars:			2,
				delay: 				400,
				matchCase: 			false,
				matchSubset: 		true,
				matchContains: 		false,
				cacheLength: 		10,
				mustMatch: 			false,
				selectFirst: 		true,
				max: 				10,
				autoFill: 			false,
				width: 				145,
				
				multiple: 			true,
				matchContains: 		true,
				multipleSeparator:	';',
			    
				formatResult: 		formatResult,
				extraParams: {
					eID: 			"tagcomplete"
				}
		});	
		
		$j("#ulTags").autocomplete("http://" + top.location.host, {
				inputClass: 		"ac_input",
				resultsClass:		"ac_results",
				loadingClass:		"ac_loading",
				minChars:			2,
				delay: 				400,
				matchCase: 			false,
				matchSubset: 		true,
				matchContains: 		false,
				cacheLength: 		10,
				mustMatch: 			false,
				selectFirst: 		true,
				max: 				10,
				autoFill: 			false,
				width: 				145,
				
				multiple: 			true,
				matchContains: 		true,
				multipleSeparator:	';',
			    
				formatResult: 		formatResult,
				extraParams: {
					eID: 			"tagcomplete"
				}
		});
  		
  
	});