$(document).ready(function() {

	var map;
	
  if (GBrowserIsCompatible()) { // Initialize the map
  
    map = new GMap2(document.getElementById("map"));
    map.setMapType(G_SATELLITE_MAP);
    map.addControl(new GSmallZoomControl());
    map.setCenter(new GLatLng(65.06286750655632, -18.56689453125), 5); 
    
    // load the map data from xml
    
    $.ajax({
      type: "GET",
      url: "../xml/outro.xml",
      dataType: "xml",
      success: function(data, textStatus) { 
        $("marker", data).each(function() {
          // configure the marker icon
          var letterIcon = new GIcon(G_DEFAULT_ICON);
          var order = String($(this).attr("order"));
          letterIcon.image = "http://www.google.com/mapfiles/marker" + order + ".png"; // set up the GMarkerOptions object
          markerOptions = {
            icon: letterIcon
          };
          var lat = parseFloat($(this).attr("lat"));
          var lng = parseFloat($(this).attr("lng"));
          var point = new GLatLng(lat, lng); // create the marker
          var marker = new GMarker(point, markerOptions);
          map.addOverlay(marker);
        });
      },
      error: function(XMLHTTPRequest, textStatus, errorThrow) {
        alert("There was an error retrieving the marker information.");
      }
    });
  }
});

$(document.body).unload(function() {
  if (GBrowserIsCompatible()) {
    GUnload();
  }
  
});