function create_marker(lat, lng, name) { var marker_options = { map: map_canvas, position: new google.maps.LatLng(lat, lng), zIndex: 0 }; var marker = new google.maps.Marker(marker_options); var infowindow = new google.maps.InfoWindow({ content: name }); marker.addListener("click", function() { infowindow.open(map_canvas, marker); }); }