// function used for autoComplete City field in search forms
// params:
// villeID - the field name/id where the city is inserted
// langValue - the value of the language used (i.e. <input type="hidden" name="language" id="language" value="<language>">)
// ctryIdValue - the value of the countryID used (i.e. <input type="hidden" name="ctryId" id="ctryId" value="<countyID>">)
// lafValue - the value of the laf used (i.e. <input type="hidden" name="laf" id="laf" value="<laf>">)

function autoCompleteCity (villeID, langValue, ctryIdValue, lafValue)
{
	var elemId = villeID;
	var elemValue = document.getElementById(elemId);
	var lang = langValue;
	var ctryId = ctryIdValue;
	var laf = lafValue;

	AutoAssist.prototype.CSS_AutoAssist="AutoAssistSearch";
	var autoAssistWrapper = function() {
	    var tt = new AutoAssist(elemId, {setRequestOptions: function() {
			var pars = "type=search&name=" + this.txtBox.value + "&ctry_id="+ctryId+"&lang="+lang+"&laf="+laf;
			return { url: "/autoCompleteCity.php", parameters: pars };
		}});
	}
	AutoAssist.prototype.show= function() {
			//document.getElementById('hs_date').style.visibility='hidden'
			var p = Position.cumulativeOffset(this.txtBox);
			this.floatDiv.style.top = p[1] + this.txtBox.offsetHeight + "px";
			this.floatDiv.style.left = p[0]+ "px";
			this.status = "show";
			Element.show(this.floatDiv);
		},

	AutoAssist.prototype.hide=function() {
			//document.getElementById('hs_date').style.visibility='visible'
			this.status = "none";
			Element.hide(this.floatDiv);
		}
	Event.observe(window, "load", autoAssistWrapper);
}
