$(document).ready(function () {

	$('input[name=query]').autoComplete({
		ajax: '/search/searchAC',
		autofill: true,
		spinner : function (event, state){
			if(state.active){
				$('input[name=query]').css('background', '#FFFFFF url(/webcontent/images/ajax-loader.gif) no-repeat right');
				$('input[name=query]').css('background-color', 'FFFFFF');
				$('input[name=query]').css('font-family', 'century gothic');
			}
			else{
				$('input[name=query]').css('background', '#FFFFFF url(/webcontent/images/dropdown_bg.jpg) repeat-x');
				$('input[name=query]').css('background-color', 'FFFFFF');
				$('input[name=query]').css('font-family', 'century gothic');
			}
		},
		// Add a delay as autofill takes some time
		delay: 200,
		ajaxCache: false,
		useCache: false
	});
})

