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_5() {
  if(GBrowserIsCompatible()) {
    if(!document.getElementById('wagmp_map_5')) return false;
    var map = new GMap2(document.getElementById('wagmp_map_5'));
    wagmp_map_5_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/yosemite.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/yosemite.gif';
    icon_0.mozPrintImage = 'http://google.webassist.com/google/markers/star/yosemite_mozprint.png';
    icon_0.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_0.transparent = 'http://google.webassist.com/google/markers/star/yosemite_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>Kalinin Bay</strong><br />Our base at Kalinin Bay is located on the northern<br /> coast of Kruzof Island. We’ll discover pristine Alaskan<br /> wilderness on Kruzof Island.</span>',
      full: '57.319942,-135.776853',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '57.319942',
      longitude: '-135.776853',
      markerStyle: 'Star',
      markerColor: 'Yosemite'      
    };
    
    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_5') {
            map.setCenter(point_0, 13);
            map.addOverlay(marker_0);
            marker_0.openInfoWindowHtml(address_0.infowindowtext);
      }
      wagmp_map_5_obj.markers.push(marker_0);
      wagmp_map_5_obj.addresses.push(address_0);
      wagmp_map_5_obj.icons.push(icon_0);
      wagmp_map_5_obj.points.push(point_0);

    var icon_1 = new GIcon();
    icon_1.image = 'http://google.webassist.com/google/markers/star/moab.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/moab.gif';
    icon_1.mozPrintImage = 'http://google.webassist.com/google/markers/star/moab_mozprint.png';
    icon_1.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_1.transparent = 'http://google.webassist.com/google/markers/star/moab_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>Magoun Islands</strong><br />Magoun Islands State Marine Park is located near<br /> Krestof Sound, approximately twelve miles<br /> northwest of Sitka. Attractions at this marine park<br /> include protected island sheltered bays, with<br /> opportunities for camping, hunting, fishing,<br /> exploring, and beach combing.</span>',
      full: '57.153561,-135.585364',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '57.153561',
      longitude: '-135.585364',
      markerStyle: 'Star',
      markerColor: 'Moab'      
    };
    
    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_5') {
            map.setCenter(point_1, 13);
            map.addOverlay(marker_1);
            marker_1.openInfoWindowHtml(address_1.infowindowtext);
      }
      wagmp_map_5_obj.markers.push(marker_1);
      wagmp_map_5_obj.addresses.push(address_1);
      wagmp_map_5_obj.icons.push(icon_1);
      wagmp_map_5_obj.points.push(point_1);

    var icon_2 = new GIcon();
    icon_2.image = 'http://google.webassist.com/google/markers/star/granitepine.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/granitepine.gif';
    icon_2.mozPrintImage = 'http://google.webassist.com/google/markers/star/granitepine_mozprint.png';
    icon_2.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_2.transparent = 'http://google.webassist.com/google/markers/star/granitepine_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>Sea Lion Cove</strong><br />The trail to Sea Lion Cove is a 1.25 mile hike through<br /> forest and muskeg, to a lovely white sand beach.<br /> The cove is on the Pacific Ocean, and big waves are<br /> always breaking. Locals come to here to ride the<br /> extreme surf of the outer coast. But it’s also a<br /> wonderful for beach coming, hiking, photography,<br /> relaxing in the sand, or just simply taking in the<br /> views.</span>',
      full: '57.301492,-135.834617',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '57.301492',
      longitude: '-135.834617',
      markerStyle: 'Star',
      markerColor: 'Granite Pine'      
    };
    
    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_5') {
            map.setCenter(point_2, 13);
            map.addOverlay(marker_2);
            marker_2.openInfoWindowHtml(address_2.infowindowtext);
      }
      wagmp_map_5_obj.markers.push(marker_2);
      wagmp_map_5_obj.addresses.push(address_2);
      wagmp_map_5_obj.icons.push(icon_2);
      wagmp_map_5_obj.points.push(point_2);

    var icon_3 = new GIcon();
    icon_3.image = 'http://google.webassist.com/google/markers/star/desertspice.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/desertspice.gif';
    icon_3.mozPrintImage = 'http://google.webassist.com/google/markers/star/desertspice_mozprint.png';
    icon_3.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_3.transparent = 'http://google.webassist.com/google/markers/star/desertspice_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>Mt. Edgecomb</strong><br />Majestic Mt. Edgecomb looms in the distance, a<br /> beautiful dormant volcano. The size and beauty<br /> of Mt. Edgecomb is mesmerizing.</span>',
      full: '57.054503,-135.750589',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '57.054503',
      longitude: '-135.750589',
      markerStyle: 'Star',
      markerColor: 'Desert Spice'      
    };
    
    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_5') {
            map.setCenter(point_3, 13);
            map.addOverlay(marker_3);
            marker_3.openInfoWindowHtml(address_3.infowindowtext);
      }
      wagmp_map_5_obj.markers.push(marker_3);
      wagmp_map_5_obj.addresses.push(address_3);
      wagmp_map_5_obj.icons.push(icon_3);
      wagmp_map_5_obj.points.push(point_3);

    var icon_4 = new GIcon();
    icon_4.image = 'http://google.webassist.com/google/markers/star/pacifica.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/pacifica.gif';
    icon_4.mozPrintImage = 'http://google.webassist.com/google/markers/star/pacifica_mozprint.png';
    icon_4.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_4.transparent = 'http://google.webassist.com/google/markers/star/pacifica_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>Sitka, Alaska</strong><br />Plan to arrive in Sitka, Alaska on a regularly<br /> scheduled Alaska Airlines flight, on the day prior to<br /> our trip departure. You will have the afternoon and<br /> evening free, to explore the shops in the scenic<br /> community of Sitka. We will provide you with a list of<br /> lodges, including the Westmark Sitka.</span>',
      full: '57.050208,-135.351392',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '57.050208',
      longitude: '-135.351392',
      markerStyle: 'Star',
      markerColor: 'Pacifica'      
    };
    
    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_5') {
            map.setCenter(point_4, 13);
            map.addOverlay(marker_4);
            marker_4.openInfoWindowHtml(address_4.infowindowtext);
      }
      wagmp_map_5_obj.markers.push(marker_4);
      wagmp_map_5_obj.addresses.push(address_4);
      wagmp_map_5_obj.icons.push(icon_4);
      wagmp_map_5_obj.points.push(point_4);

    var icon_5 = new GIcon();
    icon_5.image = 'http://google.webassist.com/google/markers/star/poppy.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/poppy.gif';
    icon_5.mozPrintImage = 'http://google.webassist.com/google/markers/star/poppy_mozprint.png';
    icon_5.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
    icon_5.transparent = 'http://google.webassist.com/google/markers/star/poppy_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>eXtreme Surfing Adventure</strong><br />On our seven-day adventure, we\'ll discover the<br /> heritage of Russian colonial Alaska, observe<br /> humpback whales and gray whales, and experience<br /> the breathtaking scenery of the Inside Passage.<br /> Whether you surf, body board, kayak, kite or wind<br /> surf, the line-up is yours.</span>',
      full: '57.189856,-135.520478',
      isdefault: true,
      addressType: 'coordinates',
      loop: '',
      latitude: '57.189856',
      longitude: '-135.520478',
      markerStyle: 'Star',
      markerColor: 'Poppy'      
    };
    
    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_5') {
            map.setCenter(point_5, 9);
            map.addOverlay(marker_5);
            marker_5.openInfoWindowHtml(address_5.infowindowtext);
      }
      wagmp_map_5_obj.markers.push(marker_5);
      wagmp_map_5_obj.addresses.push(address_5);
      wagmp_map_5_obj.icons.push(icon_5);
      wagmp_map_5_obj.points.push(point_5);


  }
}
