var nameHint = nameHint || '';  // this var should have been set in /javascript/LocationsList, but we'll make sure here
Event.addBehavior({
  "#ftl:focus" : function(e) {
    if (this.value === nameHint) {
      this.clear();
    }
  },
  "#ftl:blur" : function(e) {
	if (this.value === '') {
	  this.value = nameHint;
	}
  }
});

Event.onReady(function() {
  var ftl = $('ftl');
  if (ftl.value === '') {
    ftl.value = nameHint;
  };
  new Autocompleter.Local(
    "ftl", 
    "namecomplete", 
    LocationsList,
    {
      choices: LocationsList.length,
      fullSearch: true,
	  minChars:3,
	  partialChars: 3,
      afterUpdateElement : function (input, li) { 
        input.addClassName('set'); 
      }
	  ,onShow: (typeof showAutocomplete !== 'undefined') ? showAutocomplete : null
    }
  );
}); // Event.onReady(function())

function doDestinationSearch(frm) {
	frm.target = "_blank";
	return true;
}