var $j = jQuery.noConflict();

$j().ready(function() {

	function findValueCallback(event, data, formatted) {
		$j("<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
	}
	
	function formatItem(row) {
		return row[0] + " (<strong>id: " + row[1] + "</strong>)";
	}
	function formatResult(row) {
		return row[0].replace(/(<.+?>)/gi, '');
	}
	
	$j("#ctl0_searchtxt").autocomplete("/index.php?page=SearchKeyword", {
		width: 348,
		selectFirst: false
	}),

	$j("#ctl0_searchtxtbottom").autocomplete("/index.php?page=SearchKeyword", {
		width: 348,
		selectFirst: false
	});	
});

function changeOptions(){
	var max = parseInt(window.prompt('Please type number of items to display:', jQuery.Autocompleter.defaults.max));
	if (max > 0) {
		$j("#suggest1").setOptions({
			max: max
		});
	}
}

function changeScrollHeight() {
    var h = parseInt(window.prompt('Please type new scroll height (number in pixels):', jQuery.Autocompleter.defaults.scrollHeight));
    if(h > 0) {
        $j("#suggest1").setOptions({
			scrollHeight: h
		});
    }
}

