

/**
 * Object that stores Keywords/Ajax functions throughout the BT Tradespace site.
 * @namespace Object that stores Keywords/Ajax functions throughout the BT Tradespace site.
 * @member BTT
 */

BTT.Keywords = {
		
	rootDir : '', 
	
	autoComplete : {
	
		init: function () {
	
			/* Configure keywordsURL for the static server */
			//var keywordsURL = "/pre-launch/js/json-samples/ajax-autocomplete.jsp";
				
			/* Configure keywords for the web server */
			var keywordsURL = (BTT.ctx ? BTT.ctx : '/ts') + "/utilities/ajax/suggestKeywords";
		
				$('div.JS_keywordsAutoComplete input').each(function (i) {

					var optionsWidth = $(this).width() + 8;
		
						$(this).autocomplete(keywordsURL, {	
							minChars: 0,
							width: optionsWidth,
							matchContains: true
						});
				}).change();
		}
	}
};



/* Initialise Keywords when the DOM is ready
-------------------------------- */
$(document).ready(function () {
	BTT.Keywords.autoComplete.init();
});

