$().ready(function() { $("#whisper").autocomplete(regions, { minChars: 0, width: 190, autoFill: false, scrollHeight: 300, cacheLength: 0, scroll: true, max: 5, highlight : false, formatItem: function(row, i, max) { if(ie6===true) { $('select').hide(); } return row.usename; }, formatMatch: function(row, i, max) { return row.name; }, formatResult: function(row) { return row.usename; } }); $("#whisper").result(function(event, data, formatted) { if (typeof flights=="undefined") { flights = false; } $("#region_value").val(data["id"]); $('#region_type').val(data['type']); if(data['type']=='T' && flights!==true) { $('#region_value').val(data['id']); $('#uberregion').val(data['id']); } else if(data['type']=='T' && flights===true) { $('#region_value').val(data['uberregion']); $('#uberregion').val(data['uberregion']); } else { $('#uberregion').val(data['uberregion']); } $('#dest_hname').val(data['usename']); }); var box = $('#customselect'); var link = $('#whisper_dn'); /*link.click(function() { box.show(); return false; });*/ $('#whisper_dn').live('click', function() { $('#customselect').show(); return false; }); $('body').live('click', function() { $('#customselect').hide(); }); box.click(function(e) { e.stopPropagation(); }); }); function combosearch(dsr,name,rgc) { $('#region_value').val(dsr); $('#whisper').val(name); $('#uberregion').val(rgc); $('#customselect').hide(); }