var autocompletionAjax={MIN_CHARS:1,LOADING_CLASSNAME:"loader-simple",init:function(parameters){parameters.each(function(value,index){this.addAutocompletion(value)}.bind(this))},addAutocompletion:function(parameters){new Autocomplete(parameters.applyOnId,{parentId:parameters.parentId,serviceUrl:parameters.requestUrl,minChars:this.MIN_CHARS,maxHeight:parameters.height,width:parameters.width,deferRequestBy:parameters.timeBeforeRequest,hint:parameters.hint,notFoundSuggestion:function(instanceId,text){var url='<a href="javascript://" onclick=';
url+="Autocomplete.instances["+instanceId+'].el.fire("autocomplete:addinstitution","");>';url+="Adauga &quot;"+text+"&quot; in baza de date</a>";return url},onSelect:function(value,_parentId){if(parameters.childId){if(parameters.childValueOnChange){$(parameters.childId).value=parameters.childValueOnChange;$(parameters.childId+"_value").value=parameters.childHiddenValueOnChange}else{$(parameters.childId).value=""
}this.getAutocompleteById(parameters.childId).options.parentId=_parentId}$(parameters.applyOnId+"_value").value=_parentId}.bind(this)});$(parameters.applyOnId).removeClassName(this.LOADING_CLASSNAME)},getAutocompleteById:function(elementId){var found=null;Autocomplete.instances.each(function(value,i){if(value.id==elementId){found=value}}.bind(this));return found},getAutocompleteIndexById:function(elementId){var found=null;
Autocomplete.instances.each(function(value,i){if(value.id==elementId){found=i}}.bind(this));return found}};
