"; document.getElementById('bus_type_auto_complete').innerHTML = out; }else{ document.getElementById('bus_type_auto_complete').style.display="none"; } } } function autocomplete_loc(){ if(myTrim(document.getElementById('location_search').value)!="" && myTrim(document.getElementById('location_search').value).length>1){ autocomplete_loc_get(document.getElementById('location_search').value); }else{ document.getElementById('location_auto_complete').style.display="none"; } } function autocomplete_loc_hide(){ document.getElementById('location_auto_complete').style.display="none"; } function autocomplete_loc_get(request){ var xmlhttp = new XMLHttpRequest(); var url = "/autocomplete_location.php?location="+encodeURIComponent(request); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var myArr = JSON.parse(xmlhttp.responseText); autocomplete_loc_populate(myArr); } }; xmlhttp.open("GET", url, true); xmlhttp.send(); function autocomplete_loc_populate(arr) { if(arr.length>0){ document.getElementById('location_auto_complete').style.display="block"; var out = '