CB(document).ready(function() {
	setTimeout(function(){
		CB('.typeahead').each(function(index,elem){
			addAutoCompleterFunction(elem);
		});
	},2000);
});

function addAutoCompleterFunction(elem){
	var aulist=CB(elem).attr('au-list');
	var listData=cb_autocompleter.getAutocompleterVals(aulist);
	CB(elem).autocomplete({ source: listData });
}

function obj_Autocompleter(id){
	var list={};
	list.id=id;
	list.vals=[];
	list.addVals=function(listval){
		list.vals.push(listval);
	}
	list.getVals=function(){
		return list.vals;
	}
	return list;
}

function obj_AutocompleterList(){
	var autocompleter={};
	autocompleter.list=new Array();
	autocompleter.add=function(ac){
		autocompleter.list.push(ac);
	}
	autocompleter.getAutocompleterVals=function(id){
		ret='';
		CB(autocompleter.list).each(function(index,elem){		
			if (elem.id!=null && elem.id!='' && elem.id==id){
				ret=elem.getVals();
				return ;				
			}				
		});	
		return ret;
	}
	return autocompleter;
}