function submit_mobile_geocoder() { //if ($("#city").val().length > 2 && $("#state").val().length > 1) { document.getElementById("messageInput").value = ""; if (document.drc_locator_form.address.value.length > 1) { document.drc_locator_form.submit(); } else { document.getElementById("announcementdiv").innerHTML = "Please enter a starting location by entering a city and state and/or a valid zip code."; } } function searchByCurGeo(){ if (!navigator.geolocation) { document.getElementById("announcementdiv").innerHTML = "Unable to search by current geolocation because the services are not supported by your browser."; return false; } document.getElementById("announcementdiv").innerHTML = "Searching by current geolocation. Please wait..."; navigator.geolocation.getCurrentPosition(function( position ) { if( position.coords && position.coords.latitude && position.coords.longitude ){ document.getElementById("announcementdiv").innerHTML = "Searching by current geolocation (latitude/longitude): " + position.coords.latitude + "/" + position.coords.longitude + "..."; document.getElementById("latitude").value = position.coords.latitude; document.getElementById("longitude").value = position.coords.longitude; document.getElementById("announcementdiv").innerHTML = ""; document.getElementById("messageInput").value = "Searched by current geolocation (latitude/longitude): " + position.coords.latitude + "/" + position.coords.longitude + "."; document.drc_locator_form.submit(); } }, function(error){ var errors = [ 'Unknown', 'Permission denied', 'Position unavailable', 'Timeout' ]; document.getElementById("announcementdiv").innerHTML = "Error during search by current geolocation: " + errors[ error.code ] + "."; }, { enableHighAccuracy: true, timeout: 60000 } ); }