');// resolveresolve(position.coords.latitude + "," + position.coords.longitude);}, function() {// ignore failed geolocation servicevapModGeolocationFailed(Joomla.JText._('VAPGEOLOCATIONERR1'), false);// reject with errorreject(Joomla.JText._('VAPGEOLOCATIONERR1'));});} else {// Browser doesn't support GeolocationvapModGeolocationFailed(Joomla.JText._('VAPGEOLOCATIONERR2'), true);// reject with errorreject(Joomla.JText._('VAPGEOLOCATIONERR2'));}}function vapModGetAddressCoordinates(resolve, reject) {var addr = [];jQuery('#vap-modcountries-sel,#vap-modstates-sel,#vap-modcities-sel,#vap-modzip-text').each(function() {var part = jQuery(this).val();if (part.length) {if (jQuery(this).is('select')) {// obtain text instead of IDpart = jQuery(this).find('option[value="' + part + '"]').text();}addr.push(part);}});if (jQuery('#vap-modcountries-sel').length == 0) {// country disabled, try to retrieve the name of the default country// add default country nameaddr.push('France');}addr = addr.join(', ');if (!addr) {// reject due to empty addressreject('empty address');}var geocoder = new google.maps.Geocoder();geocoder.geocode({'address': addr}, function(results, status) {if (status == 'OK') {var coord = {lat: results[0].geometry.location.lat(),lng: results[0].geometry.location.lng()};// register coordinates of searched addressjQuery('#vap-modemp-form').append('');// resolve requestresolve(coord.lat + "," + coord.lng);} else {// raise errorvapModGeolocationFailed(Joomla.JText._('VAPGEOLOCATIONERR1'), false);// reject with errorreject(Joomla.JText._('VAPGEOLOCATIONERR1'));}});}function vapModGeolocationFailed(message, disable) {alert(message);jQuery('#vap-modnearby-check').prop('checked', false).prop('disabled', disable).trigger('change');}