"function() { var contentString = '<h3 style='margin:0'>Princesa Isabel Vinhos</h3><br> <strong>Phone: </strong>(1) 356-5634<br> <strong>Fax: </strong><br> <br> <strong>Address:</strong><br> Estrada da saúde n. 58<br> Lisboa, 1756<br> Portugal'; var infowindow = new google.maps.InfoWindow({ content: contentString }); // Access this gMarker's map, set the center // to its position and zoom this.getMap().setCenter(this.getPosition()); this.getMap().setZoom(8); infowindow.open(this.getMap(), this); }"
"function() { ... infowindow.open(this.getMap(), this); // ...now hide all the points from this map, except this one... allMarkers = this.getMap().markers; for(index = 0, length = allmarkers.length; index < length; index++){ allMarkers[index].gMarker.setVisible(false); } this.setVisible(true); // ...and add the closest three to the map osGoogleMap.addMarker(this.getMap().mapId, 'NearPOI1', {position: new google.maps.LatLng("+Lat1+","+Long1+")}); osGoogleMap.addMarker(this.getMap().mapId, 'NearPOI2', {position: new google.maps.LatLng("+Lat2+","+Long2+")}); osGoogleMap.addMarker(this.getMap().mapId, 'NearPOI3', {position: new google.maps.LatLng("+Lat3+","+Long3+")}); }"
"function() { var contentString = '<p style=\'width:200px; margin:0;\'><h3 style=\'margin:0\'>"+MarkerTitle+"</h3><br><strong>Address:</strong><br>"+markerAddress+"</p>'; var infowindow = new google.maps.InfoWindow({ content: contentString }); // Access this gMarker's map, set the center // to its position and zoom this.getMap().setCenter(this.getPosition()); this.getMap().setZoom(8); infowindow.open(this.getMap(), this); }"
"function() { var contentString = '<h3 style=\'margin:0\'>Princesa Isabel Vinhos</h3><br>'+ '<strong>Phone: </strong>(1) 356-5634<br>'+ '<strong>Fax: </strong><br>'+ '<br>'+ '<strong>Address:</strong><br>'+ 'Estrada da saúde n. 58<br>'+ 'Lisboa, 1756<br>'+ 'Portugal'; var infowindow = new google.maps.InfoWindow({ content: contentString }); // Access this gMarker's map, set the center // to its position and zoom this.getMap().setCenter(this.getPosition()); this.getMap().setZoom(8); infowindow.open(this.getMap(), this); }"
function createMarker(name, latlng) { var marker = new google.maps.Marker({position: latlng, map: map}); google.maps.event.addListener(marker, "click", function() { if (infowindow) infowindow.close(); infowindow = new google.maps.InfoWindow({content: name}); infowindow.open(map, marker); } ); return marker; }
//Right here is how I access the bubble to close it. I get document by Id and then back out a few parent nodes to get to the actual bubble. if(document.getElementById('content')){ var info_window = document.getElementById('content').parentNode.parentNode.parentNode.parentNode.parentNode; //document.getElementById('content').close(); } var infowindow; if (info_window){ info_window.removeChild(document.getElementById('content').parentNode.parentNode.parentNode.parentNode); } //right here we create a div with an id of "content" so we can find the info bubble later to close it. var contentString = '<div id=\'content\'>' + '<p style=\'width:200px; margin:0;\'><h3 style=\'margin:0\'>"+MarkerTitle+"</h3><br><strong>Address:</strong><br>"+markerAddress+"</p></div>'; if (infowindow) infowindow.close(); infowindow = new google.maps.InfoWindow({ content: contentString }); //Decided not to center the marker because then the map gets jerky trying to center on the yesco locations //this.getMap().panTo(this.getPosition()); //No Zooming is nessesary for the same reason as the centering issue var zoom = this.getMap().getZoom(); //if(this.getMap().getZoom() < 12){ // this.getMap().setZoom(12); //} infowindow.open(this.getMap(), this); var latInput = document.getElementById('"+latInput.Id+"'); latInput.value = "+locationLat_+"; var lngInput = document.getElementById('"+lngInput.Id+"'); lngInput.value = "+locationLng_+"; var BusinessNameField = document.getElementById('"+BusinessNameField.Id+"'); BusinessNameField.value = '"+MarkerTitle+"'; var AddressField = document.getElementById('"+AddressField.Id+"'); AddressField.value = '"+markerAddress+"'; document.getElementById('"+submitLatLng.Id+"').click();