function loadMap() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(45.580, -111.038), 9, G_HYBRID_MAP); 

    // Watch for window resizing and make sure to resize the map
    if (window.attachEvent) {
      window.attachEvent("onresize", function() {map.checkResize()});
    } else {
      window.addEventListener("resize", function() {map.checkResize()}, false);
    }

    loadPoints(map);
  }
} 

function addMarker(map, divID, name, lat, lng, html) {
  // Start by creating the map point
  var point = new GLatLng(lat,lng);

  // Create a marker which opens the info when clicked, if available
  var marker;
  if (html) {
    marker = new GMarker(point, {title:name});
    GEvent.addListener(marker, "click", function() {
	marker.openInfoWindowHtml(html);
      });
  } else if (document.getElementById(divID)) {
    marker = new GMarker(point, {title:name});
    GEvent.addListener(marker, "click", function() {
	// Clone the element so when the window is closed it is not removed
	var content = document.getElementById(divID).cloneNode(true);
	// remove the ID attribute so that there are no duplicate IDs
	content.removeAttribute("id");
	marker.openInfoWindow(content);
      });
  } else {
    marker = new GMarker(point, {clickable:false,title:name});
  }

  // Add the overlay to the map
  map.addOverlay(marker);
}

// vim: set ts=8 sts=2 sw=2 noet:
