jQuery(function(a){var b={cache:true};a("input[autocomplete]:not([autocomplete=off]):not(.jqInitedAutocomplete, .jqTextboxList), .jqUIAutocomplete").livequery(function(){var f=a(this),c={},e,g=f.attr("autocomplete"),d=a.extend({source:g},b,f.metadata());if(d.cache&&typeof(d.source)==="string"){d._source=d.source;d.source=function(j,h){var i=j.term,k=i;if(typeof(d.extraParams)!="undefined"){a.each(d.extraParams,function(l,n){var m=typeof n=="function"?n(f):n;j[l]=m;k+=";"+l+"="+m})}if(k in c){a.log("AUTOCOMPLETE: found "+i+" in cache");h(c[k]);return}a.log("AUTOCOMPLETE: requesting '"+i+"' from "+d._source);e=a.ajax({url:d._source,dataType:"json",data:j,success:function(m,l,n){c[k]=m;a.log("AUTOCOMPLETE: caching "+i);if(n===e){a.log("AUTOCOMPLETE: got data for '"+i+"' from backend");h(m)}else{a.log("AUTOCOMPLETE: throwing away results for '"+i+"'")}},error:function(n,l,m){alert("Error: "+l);h()}})}}f.removeClass("jqUIAutocomplete").autocomplete(d)})});