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

function autoCompleteCity (my_field, my_lang, my_country)
{
	var elemId = my_field;
	var elemValue = document.getElementById(elemId);
	var lang = my_lang;
	var ctryId = my_country;
	AutoAssist.prototype.CSS_AutoAssist="AutoAssistSearch";
	var autoAssistWrapper = function() {
	    var tt = new AutoAssist(elemId, {setRequestOptions: function() {
	    		if(document.getElementById('url_redir')){
				document.getElementById('url_redir').value='';
			}
	    		if(document.getElementById('url_redir2')){
				document.getElementById('url_redir2').value='';
			}
	    		if(this.txtBox.value.length>=3){
				var pars = "keywords=" + this.txtBox.value + "&ctry_id=" + ctryId + "&lang=" + lang + "&champ=" + my_field;
				return { url: "http://www.cybevasion.com/autoassist/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);
}
