function setUpPlacesPageAutoComplete() {

    // by place name - autocomplete
    $("#placesByName").autocomplete("/llint/ajax/places.htm", {minChars: 3,selectOnly:true}).result(submitPlacesSpecifiedItem);

    function submitPlacesSpecifiedItem (e, row) {
        // update searchVesselId field with vesselId
        var placeId = row[1];
        $("#searchPlaceId").val(placeId);
        // submit the form
        $("#placeNameAdvancedSearch").submit();
    }

    //by authority name - autocomplete
    $("#authoritiesByName").autocomplete("/llint/ajax/places.htm", {minChars: 3,selectOnly:true}).result(submitAuthoritiesSpecifiedItem);

    function submitAuthoritiesSpecifiedItem (e, row) {
        // update searchVesselId field with vesselId
        var placeId = row[1];
        $("#searchAuthorityId").val(placeId);
        // submit the form
        $("#authorityNameAdvancedSearch").submit();
    }


}

addLoadEvent(setUpPlacesPageAutoComplete);
