jQuery(document).ready(function() 
{
    $('input[name*="txbFlightFrom"], input[name*="txbFliteTo"], input[name*="txbHotelCity"], input[name*="txbCarPickUpCity"]').autocomplete(
    {
        minLength: 2,
        delay:300,
        source: function( request, response ) 
                {
                    $.ajax(
                    {
                        url: "http://" + location.hostname + "/AjaxRequest.aspx",   
                        dataType: "text",
                        data: 
                        {
                            "function": "GetCities",
                            "url": "http://ytbtravel.neatgroup.com/ytbtravel/PrepareAirportNameList?DD=YTBTRAVEL&toLocation=" + request.term + "&product=AHC&referrerId=YTB1555",
                        },
                        success: function(data) 
                        {
                            jQuery('#_AUTOCOMPLETE').html(data);
                            
                            var list = [];
                            jQuery('#_AUTOCOMPLETE a').each(function(index)
                            {
                                list.push($(this).text())  ;
                            })
                            
                            response(list) 
                        }
                    });
                }
    });
});    
