if(addresses && addresses !== "null" && addresses!== "undefined" && addresses != '') {$.getJSON('https://maps.googleapis.com/maps/api/geocode/json?address='+addresses[0]+'&key=AIzaSyBifoXV7fJYd0zKY_qTuIE1GH38-hhm-qQ', null, function (data) { var p = data.results[0].geometry.location; lat =p.lat; log = p.lng; //alert(log); var map; var elevator; var myOptions = { zoom: 11, center: new google.maps.LatLng(lat, log), mapTypeId: 'terrain' }; map = new google.maps.Map($('#map_canvas')[0], myOptions); var infowindow = new google.maps.InfoWindow(); for (var x = 0; x < addresses.length; x++) { $.getJSON('https://maps.googleapis.com/maps/api/geocode/json?address='+addresses[x]+'&key=AIzaSyBifoXV7fJYd0zKY_qTuIE1GH38-hhm-qQ', null, function (data) { var p = data.results[0].geometry.location var latlng = new google.maps.LatLng(p.lat, p.lng); var marker = new google.maps.Marker({ position: latlng, map: map }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(''+data.results[0].formatted_address+'Get Directions'); infowindow.open(map, this); }); }); } }); }}); }); {/exp:channel:entries}