//ready
$(document).ready(function(){

	//インクリメンタル検索の設定
    var onAutocompleteSelect = function(value, data) {
    		$('#product-find-form').attr('action', BASE_URL + data + '/');
			$('#product-find-form')[0].submit();
			return false;
    }

	var baseHeight = 20;	//$('div.doc-count:first').height();
	var listHeight = (baseHeight + 4) * 10 + 2;
	options = { serviceUrl: APP_URL + 'api/productsearch/?timest=' + getTimeStamp(),
				width: 350,
				maxHeight: listHeight,
				minChars: 0,
				delimiter: /(;)\s*/,
				onSelect: onAutocompleteSelect,
				deferRequestBy: 0, //miliseconds
				fnFormatResult: formatResult,
				align: 'right',
				offsetLeft: 20,
				offsetTop: 0,
				noCache: false //set to true, to disable caching
			};


	//インクリメンタル検索項目として初期化
  	var ac = $('#kword1').autocomplete(options);
  	$('#kword1').focus(function(){
  			ac.getSuggestions($('#kword1').val());
  		});

});


