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_9() {
  if(GBrowserIsCompatible()) {
    if(!document.getElementById('wagmp_map_9')) return false;
    var map = new GMap2(document.getElementById('wagmp_map_9'));
    wagmp_map_9_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/traditionalflat/pacifica.png';
    icon_0.shadow = 'http://google.webassist.com/google/markers/traditionalflat/shadow.png';
    icon_0.iconSize = new GSize(34,35);
    icon_0.shadowSize = new GSize(34,35);
    icon_0.iconAnchor = new GPoint(9,23);
    icon_0.infoWindowAnchor = new GPoint(19,0);
    icon_0.printImage = 'http://google.webassist.com/google/markers/traditionalflat/pacifica.gif';
    icon_0.mozPrintImage = 'http://google.webassist.com/google/markers/traditionalflat/pacifica_mozprint.png';
    icon_0.printShadow = 'http://google.webassist.com/google/markers/traditionalflat/shadow.gif';
    icon_0.transparent = 'http://google.webassist.com/google/markers/traditionalflat/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>Main Camp</strong><br />We choose from one of several camp <br />sites along the shore of Pleasant Island.<br />Each one offers great inter-tidal viewing.</span>',
      full: '58.365823,-135.73007',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.365823',
      longitude: '-135.73007',
      markerStyle: 'Google Traditional (flat)',
      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_2') {
            map.setCenter(point_0, 13);
            map.addOverlay(marker_0);
            marker_0.openInfoWindowHtml(address_0.infowindowtext);
      }
      wagmp_map_9_obj.markers.push(marker_0);
      wagmp_map_9_obj.addresses.push(address_0);
      wagmp_map_9_obj.icons.push(icon_0);
      wagmp_map_9_obj.points.push(point_0);

    var icon_1 = new GIcon();
    icon_1.image = 'http://google.webassist.com/google/markers/traditionalflat/cabosunset.png';
    icon_1.shadow = 'http://google.webassist.com/google/markers/traditionalflat/shadow.png';
    icon_1.iconSize = new GSize(34,35);
    icon_1.shadowSize = new GSize(34,35);
    icon_1.iconAnchor = new GPoint(9,23);
    icon_1.infoWindowAnchor = new GPoint(19,0);
    icon_1.printImage = 'http://google.webassist.com/google/markers/traditionalflat/cabosunset.gif';
    icon_1.mozPrintImage = 'http://google.webassist.com/google/markers/traditionalflat/cabosunset_mozprint.png';
    icon_1.printShadow = 'http://google.webassist.com/google/markers/traditionalflat/shadow.gif';
    icon_1.transparent = 'http://google.webassist.com/google/markers/traditionalflat/cabosunset_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>Wilderness Isles</strong><br />Our Wilderness Isles trips are based on<br />Pleasant Island, only a short paddle <br />from the Gustavus Dock.</span>',
      full: '58.354369,-135.712051',
      isdefault: false,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.354369',
      longitude: '-135.712051',
      markerStyle: 'Google Traditional (flat)',
      markerColor: 'Cabo Sunset'      
    };
    
    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_2') {
            map.setCenter(point_1, 13);
            map.addOverlay(marker_1);
            marker_1.openInfoWindowHtml(address_1.infowindowtext);
      }
      wagmp_map_9_obj.markers.push(marker_1);
      wagmp_map_9_obj.addresses.push(address_1);
      wagmp_map_9_obj.icons.push(icon_1);
      wagmp_map_9_obj.points.push(point_1);

    var icon_2 = new GIcon();
    icon_2.image = 'http://google.webassist.com/google/markers/traditionalflat/cabosunset.png';
    icon_2.shadow = 'http://google.webassist.com/google/markers/traditionalflat/shadow.png';
    icon_2.iconSize = new GSize(34,35);
    icon_2.shadowSize = new GSize(34,35);
    icon_2.iconAnchor = new GPoint(9,23);
    icon_2.infoWindowAnchor = new GPoint(19,0);
    icon_2.printImage = 'http://google.webassist.com/google/markers/traditionalflat/cabosunset.gif';
    icon_2.mozPrintImage = 'http://google.webassist.com/google/markers/traditionalflat/cabosunset_mozprint.png';
    icon_2.printShadow = 'http://google.webassist.com/google/markers/traditionalflat/shadow.gif';
    icon_2.transparent = 'http://google.webassist.com/google/markers/traditionalflat/cabosunset_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>Wilderness Isles</strong><br />We start our Wilderness Isles trips<br />from the Gustavus Dock. It\'s only a<br />short paddle to Pleasant Island!</span>',
      full: '58.397568,-135.729003',
      isdefault: true,
      addressType: 'coordinates',
      loop: '',
      latitude: '58.397568',
      longitude: '-135.729003',
      markerStyle: 'Google Traditional (flat)',
      markerColor: 'Cabo Sunset'      
    };
    
    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_2') {
            map.setCenter(point_2, 11);
            map.addOverlay(marker_2);
            marker_2.openInfoWindowHtml(address_2.infowindowtext);
      }
      wagmp_map_9_obj.markers.push(marker_2);
      wagmp_map_9_obj.addresses.push(address_2);
      wagmp_map_9_obj.icons.push(icon_2);
      wagmp_map_9_obj.points.push(point_2);


  }
}