From GamingWiki
Line 45: | Line 45: | ||
* Add a marker to the map | * Add a marker to the map | ||
*/ | */ | ||
− | function addMarker(latlng, title, | + | function addMarker(latlng, title, descId) { |
var marker = new google.maps.Marker({position:latlng, map: map, title:title}); | var marker = new google.maps.Marker({position:latlng, map: map, title:title}); | ||
− | |||
− | |||
− | |||
google.maps.event.addListener(marker, "click", function() { | google.maps.event.addListener(marker, "click", function() { | ||
− | infowindow.setContent( | + | infowindow.setContent(document.getElementById(descId)); |
infowindow.open(map,marker); | infowindow.open(map,marker); | ||
}); | }); | ||
Line 58: | Line 55: | ||
* Add a marker with a lat/lng pair | * Add a marker with a lat/lng pair | ||
*/ | */ | ||
− | function addMarkerByLatLng(lat, lng, title, | + | function addMarkerByLatLng(lat, lng, title, descId) { |
var latlng = new google.maps.LatLng(lat, lng); | var latlng = new google.maps.LatLng(lat, lng); | ||
− | addMarker(latlng, title, | + | addMarker(latlng, title, descId); |
} | } | ||
Line 66: | Line 63: | ||
* Add markers by address | * Add markers by address | ||
*/ | */ | ||
− | function addMarkerByAddress(address, title, | + | function addMarkerByAddress(address, title, descId) { |
if (geocoder) { | if (geocoder) { | ||
geocoder.geocode({'address':address}, function(results, status) { | geocoder.geocode({'address':address}, function(results, status) { | ||
if (status == google.maps.GeocoderStatus.OK) { | if (status == google.maps.GeocoderStatus.OK) { | ||
var latlng = results[0].geometry.location; | var latlng = results[0].geometry.location; | ||
− | addMarker(latlng, title, | + | addMarker(latlng, title, descID); |
} else { | } else { | ||
alert(address + " not found: "+results[0]+"; "+status); | alert(address + " not found: "+results[0]+"; "+status); | ||
Line 87: | Line 84: | ||
// Woolen mill | // Woolen mill | ||
− | addMarkerByLatLng(44.242524,-76.482053, | + | addMarkerByLatLng(44.242524,-76.482053, "The Woolen Mill", "descWoolenMill"); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
// Queen's Library | // Queen's Library | ||
− | addMarkerByLatLng(44.228188,-76.496108, | + | addMarkerByLatLng(44.228188,-76.496108, "Joseph S. Stauffer Library", "descLibrary"); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
// Tir nan Og | // Tir nan Og | ||
− | addMarkerByAddress( | + | addMarkerByAddress("200 Ontario St Kingston Ontario K7L 2Y9", "Tir Nan Og Irish Pub", "descTirNanOg"); |
− | |||
− | |||
− | |||
} | } | ||