function WAMapRef(mapObj)  {
  this.obj = mapObj;
  this.directions = false;
  this.icons = [];
  this.markers = [];
  this.addresses = [];
  this.points = [];
  this.getPointByAddress = getPointByAddressFunc;
  return this;
}

function waitForGeo()  {
  var startDate = new Date();
  var endDate = new Date();
  while ((endDate-startDate) < 200)  {
    endDate = new Date();
  }
}

function WAMapPoint(theMarker, theAddress, theIcon)  {
  this.icon = theIcon;
  this.marker = theMarker;
  this.address = theAddress;
  return this;
}

function getPointByAddressFunc(value,attname)  {
  if (!attname) attname = "street";
  for (var x=0; x < this.addresses.length; x++) {
    if (eval("this.addresses[x]."+attname) == value)  {
      return WAMapPoint(this.markers[x],this.addresses[x],this.icons[x]);
    }
  }
  return false;
}


function wagmp_map_2() {
  if(GBrowserIsCompatible()) {
    if(!document.getElementById('wagmp_map_2')) return false;
    var map = new GMap2(document.getElementById('wagmp_map_2'));
    wagmp_map_2_obj = new WAMapRef(map);
    map.enableContinuousZoom();
    map.enableDoubleClickZoom();
    map.addControl(new GLargeMapControl());
    map.addControl(new GScaleControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new GOverviewMapControl());
    var geocoder = new GClientGeocoder();
    
    var fromAddress = {
      enabled: false,
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      full: ''
    };

    var icon_0 = new GIcon();
    icon_0.image = 'http://google.webassist.com/google/markers/star/pacifica.png';
    icon_0.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_0.iconSize = new GSize(29,39);
    icon_0.shadowSize = new GSize(29,39);
    icon_0.iconAnchor = new GPoint(15,15);
    icon_0.infoWindowAnchor = new GPoint(19,7);
    icon_0.printImage = 'http://google.webassist.com/google/markers/star/pacifica.gif';
    icon_0.mozPrintImage = 'http://google.webassist.com/google/markers/star/pacifica_mozprint.png';
    icon_0.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_0.transparent = 'http://google.webassist.com/google/markers/star/pacifica_transparent.png';
    
    var address_0 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>Bartlett Cove</strong><br />Plan to arrive in Gustavus, Alaska on a regularly<br /> scheduled Alaska Airlines flight, on the day before<br /> our trip begins. We will provide you with a list of<br /> lodges, and we highly recommend the Gustavus Inn.</span>',
      full: '58.455397,-135.886675',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.455397',
      longitude: '-135.886675',
      markerStyle: 'Star',
      markerColor: 'Pacifica'      
    };
    
    var point_0 = new GLatLng(address_0.latitude, address_0.longitude);
      var marker_0 = new GMarker(point_0, icon_0);
      GEvent.addListener(marker_0, 'click', function() {
        marker_0.openInfoWindowHtml(address_0.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_0' != 'address_8') {
            map.setCenter(point_0, 13);
            map.addOverlay(marker_0);
            marker_0.openInfoWindowHtml(address_0.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_0);
      wagmp_map_2_obj.addresses.push(address_0);
      wagmp_map_2_obj.icons.push(icon_0);
      wagmp_map_2_obj.points.push(point_0);

    var icon_1 = new GIcon();
    icon_1.image = 'http://google.webassist.com/google/markers/star/deepjungle.png';
    icon_1.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_1.iconSize = new GSize(29,39);
    icon_1.shadowSize = new GSize(29,39);
    icon_1.iconAnchor = new GPoint(15,15);
    icon_1.infoWindowAnchor = new GPoint(19,7);
    icon_1.printImage = 'http://google.webassist.com/google/markers/star/deepjungle.gif';
    icon_1.mozPrintImage = 'http://google.webassist.com/google/markers/star/deepjungle_mozprint.png';
    icon_1.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_1.transparent = 'http://google.webassist.com/google/markers/star/deepjungle_transparent.png';
    
    var address_1 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>Adams Inlet</strong><br />We\'ll explore the spectacular wilderness of Adams<br /> Inlet. Otters, black and brown bears, wolves and moose<br /> can often be observed along the shoreline.</span>',
      full: '58.852165,-136.02396',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.852165',
      longitude: '-136.02396',
      markerStyle: 'Star',
      markerColor: 'Deep Jungle'      
    };
    
    var point_1 = new GLatLng(address_1.latitude, address_1.longitude);
      var marker_1 = new GMarker(point_1, icon_1);
      GEvent.addListener(marker_1, 'click', function() {
        marker_1.openInfoWindowHtml(address_1.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_1' != 'address_8') {
            map.setCenter(point_1, 13);
            map.addOverlay(marker_1);
            marker_1.openInfoWindowHtml(address_1.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_1);
      wagmp_map_2_obj.addresses.push(address_1);
      wagmp_map_2_obj.icons.push(icon_1);
      wagmp_map_2_obj.points.push(point_1);

    var icon_2 = new GIcon();
    icon_2.image = 'http://google.webassist.com/google/markers/star/nautica.png';
    icon_2.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_2.iconSize = new GSize(29,39);
    icon_2.shadowSize = new GSize(29,39);
    icon_2.iconAnchor = new GPoint(15,15);
    icon_2.infoWindowAnchor = new GPoint(19,7);
    icon_2.printImage = 'http://google.webassist.com/google/markers/star/nautica.gif';
    icon_2.mozPrintImage = 'http://google.webassist.com/google/markers/star/nautica_mozprint.png';
    icon_2.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_2.transparent = 'http://google.webassist.com/google/markers/star/nautica_transparent.png';
    
    var address_2 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>Muir Point</strong><br />When John Muir explored Glacier Bay in 1879, <br />the glaciers were within a mile or two of this point.</span>',
      full: '58.818408,-136.08764',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.818408',
      longitude: '-136.08764',
      markerStyle: 'Star',
      markerColor: 'Nautica'      
    };
    
    var point_2 = new GLatLng(address_2.latitude, address_2.longitude);
      var marker_2 = new GMarker(point_2, icon_2);
      GEvent.addListener(marker_2, 'click', function() {
        marker_2.openInfoWindowHtml(address_2.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_2' != 'address_8') {
            map.setCenter(point_2, 13);
            map.addOverlay(marker_2);
            marker_2.openInfoWindowHtml(address_2.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_2);
      wagmp_map_2_obj.addresses.push(address_2);
      wagmp_map_2_obj.icons.push(icon_2);
      wagmp_map_2_obj.points.push(point_2);


    var icon_4 = new GIcon();
    icon_4.image = 'http://google.webassist.com/google/markers/star/tahitisea.png';
    icon_4.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_4.iconSize = new GSize(29,39);
    icon_4.shadowSize = new GSize(29,39);
    icon_4.iconAnchor = new GPoint(15,15);
    icon_4.infoWindowAnchor = new GPoint(19,7);
    icon_4.printImage = 'http://google.webassist.com/google/markers/star/tahitisea.gif';
    icon_4.mozPrintImage = 'http://google.webassist.com/google/markers/star/tahitisea_mozprint.png';
    icon_4.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_4.transparent = 'http://google.webassist.com/google/markers/star/tahitisea_transparent.png';
    
    var address_4 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>Goose Cove</strong><br />Picturesque Goose Cove is a lovely place to camp.<br /> Be sure to look for signs of wildlife!</span>',
      full: '58.961251,-136.102366',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.961251',
      longitude: '-136.102366',
      markerStyle: 'Star',
      markerColor: 'Tahiti Sea'      
    };
    
    var point_4 = new GLatLng(address_4.latitude, address_4.longitude);
      var marker_4 = new GMarker(point_4, icon_4);
      GEvent.addListener(marker_4, 'click', function() {
        marker_4.openInfoWindowHtml(address_4.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_4' != 'address_8') {
            map.setCenter(point_4, 13);
            map.addOverlay(marker_4);
            marker_4.openInfoWindowHtml(address_4.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_4);
      wagmp_map_2_obj.addresses.push(address_4);
      wagmp_map_2_obj.icons.push(icon_4);
      wagmp_map_2_obj.points.push(point_4);

    var icon_5 = new GIcon();
    icon_5.image = 'http://google.webassist.com/google/markers/star/cabosunset.png';
    icon_5.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_5.iconSize = new GSize(29,39);
    icon_5.shadowSize = new GSize(29,39);
    icon_5.iconAnchor = new GPoint(15,15);
    icon_5.infoWindowAnchor = new GPoint(19,7);
    icon_5.printImage = 'http://google.webassist.com/google/markers/star/cabosunset.gif';
    icon_5.mozPrintImage = 'http://google.webassist.com/google/markers/star/cabosunset_mozprint.png';
    icon_5.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_5.transparent = 'http://google.webassist.com/google/markers/star/cabosunset_transparent.png';
    
    var address_5 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>Riggs Glacier</strong><br />The beautiful Riggs Glacier is only a short<br /> paddle from our campsite in McBride Bay.</span>',
      full: '59.07533,-136.166954',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '59.07533',
      longitude: '-136.166954',
      markerStyle: 'Star',
      markerColor: 'Cabo Sunset'      
    };
    
    var point_5 = new GLatLng(address_5.latitude, address_5.longitude);
      var marker_5 = new GMarker(point_5, icon_5);
      GEvent.addListener(marker_5, 'click', function() {
        marker_5.openInfoWindowHtml(address_5.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_5' != 'address_8') {
            map.setCenter(point_5, 13);
            map.addOverlay(marker_5);
            marker_5.openInfoWindowHtml(address_5.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_5);
      wagmp_map_2_obj.addresses.push(address_5);
      wagmp_map_2_obj.icons.push(icon_5);
      wagmp_map_2_obj.points.push(point_5);

    var icon_6 = new GIcon();
    icon_6.image = 'http://google.webassist.com/google/markers/star/desertspice.png';
    icon_6.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_6.iconSize = new GSize(29,39);
    icon_6.shadowSize = new GSize(29,39);
    icon_6.iconAnchor = new GPoint(15,15);
    icon_6.infoWindowAnchor = new GPoint(19,7);
    icon_6.printImage = 'http://google.webassist.com/google/markers/star/desertspice.gif';
    icon_6.mozPrintImage = 'http://google.webassist.com/google/markers/star/desertspice_mozprint.png';
    icon_6.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_6.transparent = 'http://google.webassist.com/google/markers/star/desertspice_transparent.png';
    
    var address_6 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>McBride Glacier</strong><br />From an idyllic campsite, we\'ll explore McBride<br /> Glacier. We\'ll hike along the shore of McBride Bay,<br /> and observe the magnificent tidewater McBride<br /> Glacier. Working our way around the pack ice, we<br /> explore the bay, hoping to catch a glimpse of<br /> thundering ice breaking off the face of the glacier.<br /> Harbor seals and timber wolves keep a close eye on<br /> us, as we walk silently along the shore. We\'ll hike up<br /> the lateral moraine of the glacier, to photograph an<br /> unforgettable bouquet of wildflowers.</span>',
      full: '59.035344,-136.123008',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '59.035344',
      longitude: '-136.123008',
      markerStyle: 'Star',
      markerColor: 'Desert Spice'      
    };
    
    var point_6 = new GLatLng(address_6.latitude, address_6.longitude);
      var marker_6 = new GMarker(point_6, icon_6);
      GEvent.addListener(marker_6, 'click', function() {
        marker_6.openInfoWindowHtml(address_6.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_6' != 'address_8') {
            map.setCenter(point_6, 13);
            map.addOverlay(marker_6);
            marker_6.openInfoWindowHtml(address_6.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_6);
      wagmp_map_2_obj.addresses.push(address_6);
      wagmp_map_2_obj.icons.push(icon_6);
      wagmp_map_2_obj.points.push(point_6);

    var icon_7 = new GIcon();
    icon_7.image = 'http://google.webassist.com/google/markers/star/granitepine.png';
    icon_7.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_7.iconSize = new GSize(29,39);
    icon_7.shadowSize = new GSize(29,39);
    icon_7.iconAnchor = new GPoint(15,15);
    icon_7.infoWindowAnchor = new GPoint(19,7);
    icon_7.printImage = 'http://google.webassist.com/google/markers/star/granitepine.gif';
    icon_7.mozPrintImage = 'http://google.webassist.com/google/markers/star/granitepine_mozprint.png';
    icon_7.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_7.transparent = 'http://google.webassist.com/google/markers/star/granitepine_transparent.png';
    
    var address_7 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>North Sandy Cove</strong><br />North Sandy Cove is a very rich ecosystem full of<br /> black bears, moose, wolves, and a plentiful marine<br /> environment. We explore another intertidal zone,<br /> which is home to hundreds of sea stars, sea<br /> cucumbers, spiny sea urchins, sponges, periwinkles<br /> and whelks.</span>',
      full: '58.721575,-135.990142',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.721575',
      longitude: '-135.990142',
      markerStyle: 'Star',
      markerColor: 'Granite Pine'      
    };
    
    var point_7 = new GLatLng(address_7.latitude, address_7.longitude);
      var marker_7 = new GMarker(point_7, icon_7);
      GEvent.addListener(marker_7, 'click', function() {
        marker_7.openInfoWindowHtml(address_7.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_7' != 'address_8') {
            map.setCenter(point_7, 13);
            map.addOverlay(marker_7);
            marker_7.openInfoWindowHtml(address_7.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_7);
      wagmp_map_2_obj.addresses.push(address_7);
      wagmp_map_2_obj.icons.push(icon_7);
      wagmp_map_2_obj.points.push(point_7);

        var icon_3 = new GIcon();
    icon_3.image = 'http://google.webassist.com/google/markers/star/yosemite.png';
    icon_3.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_3.iconSize = new GSize(29,39);
    icon_3.shadowSize = new GSize(29,39);
    icon_3.iconAnchor = new GPoint(15,15);
    icon_3.infoWindowAnchor = new GPoint(19,7);
    icon_3.printImage = 'http://google.webassist.com/google/markers/star/yosemite.gif';
    icon_3.mozPrintImage = 'http://google.webassist.com/google/markers/star/yosemite_mozprint.png';
    icon_3.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_3.transparent = 'http://google.webassist.com/google/markers/star/yosemite_transparent.png';
    
    var address_3 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>Seebree Cove</strong><br />Seebree Cove is at the center of Glacier Bay. We may<br /> see whales, sea lions, porpoises and seals here. In<br /> the early evening we can explore the intertidal zone, <br />home to hundreds of sponges, periwinkles, whelks, sea stars,<br /> sea cucumbers and urchins. Eagles, terns, sea gulls,<br /> oyster catchers, puffins, and numerous other shore<br /> birds nest in the area.</span>',
      full: '58.766064,-136.170300',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.766064',
      longitude: '-136.170300',
      markerStyle: 'Star',
      markerColor: 'Yosemite'      
    };
    
    var point_3 = new GLatLng(address_3.latitude, address_3.longitude);
      var marker_3 = new GMarker(point_3, icon_3);
      GEvent.addListener(marker_3, 'click', function() {
        marker_3.openInfoWindowHtml(address_3.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_3' != 'address_8') {
            map.setCenter(point_3, 13);
            map.addOverlay(marker_3);
            marker_3.openInfoWindowHtml(address_3.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_3);
      wagmp_map_2_obj.addresses.push(address_3);
      wagmp_map_2_obj.icons.push(icon_3);
      wagmp_map_2_obj.points.push(point_3);

    var icon_8 = new GIcon();
    icon_8.image = 'http://google.webassist.com/google/markers/star/pacifica.png';
    icon_8.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
    icon_8.iconSize = new GSize(29,39);
    icon_8.shadowSize = new GSize(29,39);
    icon_8.iconAnchor = new GPoint(15,15);
    icon_8.infoWindowAnchor = new GPoint(19,7);
    icon_8.printImage = 'http://google.webassist.com/google/markers/star/pacifica.gif';
    icon_8.mozPrintImage = 'http://google.webassist.com/google/markers/star/pacifica_mozprint.png';
    icon_8.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_8.transparent = 'http://google.webassist.com/google/markers/star/pacifica_transparent.png';
    
    var address_8 = {
      street: '',
      city: '',
      state: '',
      zip: '',
      country: '',
      infowindow: 'custom',
      infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>Glacier Bay Explorer</strong><br />Experience the raw power and stunning beauty<br /> of this dynamic region at a time when few others are<br /> in the area. Glacier Bay\'s fascinating geology,<br /> abundant wildlife, and breathtaking scenery are the<br /> setting for an unforgettable wilderness experience.</span>',
      full: '58.749747,-136.205064',
      isdefault: true,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.749747',
      longitude: '-136.205064',
      markerStyle: 'Star',
      markerColor: 'Pacifica'      
    };
    
    var point_8 = new GLatLng(address_8.latitude, address_8.longitude);
      var marker_8 = new GMarker(point_8, icon_8);
      GEvent.addListener(marker_8, 'click', function() {
        marker_8.openInfoWindowHtml(address_8.infowindowtext);
      });
      if(!fromAddress.enabled || 'address_8' != 'address_8') {
            map.setCenter(point_8, 9);
            map.addOverlay(marker_8);
            marker_8.openInfoWindowHtml(address_8.infowindowtext);
      }
      wagmp_map_2_obj.markers.push(marker_8);
      wagmp_map_2_obj.addresses.push(address_8);
      wagmp_map_2_obj.icons.push(icon_8);
      wagmp_map_2_obj.points.push(point_8);


  }
}
