function geoLocCH(el, loc, st) {
	st.innerHTML = (el.value=='')? '' : (loc.value==''? '<span class="invalid">!</span>':'<span class="valid">+</span>');
}
function initAutocomplete(frm_name, contextPath, stId, uri, locId, geoId) {
	if (uri == null || uri == '') {
		uri = 'ajax/geoLocationData';
	}
	if (locId == null) {
		locId = 'locationId';
	}
	if (geoId == null) {
		geoId = 'geoName';
	}
	if (stId == null) {
		stId = 'geoLocation_st';
	}
	var frm = document.forms[frm_name];
	var loc = frm.elements[locId];
	var geo = frm.elements[geoId];
	var st = document.getElementById(stId);
	new Autocomplete(
	    geo,
	    function() {
	        return contextPath + uri + '?find='+this.value;
	    },
	    function() {
	        this.hide();
	        loc.value='';
	        geoLocCH(this.text, loc, st);
	    },
	    function(data,matched) {
	        if (!matched) {
	            this.text.value=data.value;
	        }
	        loc.value = data.id_location;
	        geoLocCH(this.text, loc, st);
	    },
	    { width:'auto', frequency:0.36, minChars:2, delimChars:',', size:10, select_first:1 }
	);
	geoLocCH(geo, loc, st);
}