var icon = new GIcon();
icon.image = "http://www.immo-diffusion.fr/images/epingle.png";
icon.iconSize = new GSize(30, 30);
icon.iconAnchor = new GPoint(15, 27);
icon.infoWindowAnchor = new GPoint(10, 30);

var iconLg = new GIcon();
iconLg.image = "http://www.immo-diffusion.fr/image/immo-diffusion_bas.png";
iconLg.iconSize = new GSize(80, 51);
iconLg.iconAnchor = new GPoint(15, 27);
iconLg.infoWindowAnchor = new GPoint(10, 30);


function createMarker(point, legende, icon) {
var marker = new GMarker(point, icon);
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(legende);
});
return marker;
}

function TextualZoomControl() {
    }
    TextualZoomControl.prototype = new GControl();

    TextualZoomControl.prototype.initialize = function(map) {
      var container = document.createElement("div");

      var zoomInDiv = document.createElement("div");
      this.setButtonStyle_(zoomInDiv);
      container.appendChild(zoomInDiv);
      zoomInDiv.appendChild(document.createTextNode("Zoom In"));
      GEvent.addDomListener(zoomInDiv, "click", function() {
        map.zoomIn();
      });

      var zoomOutDiv = document.createElement("div");
      this.setButtonStyle_(zoomOutDiv);
      container.appendChild(zoomOutDiv);
      zoomOutDiv.appendChild(document.createTextNode("Zoom Out"));
      GEvent.addDomListener(zoomOutDiv, "click", function() {
        map.zoomOut();
      });

      map.getContainer().appendChild(container);
      return container;
    }

    // By default, the control will appear in the top left corner of the
    // map with 7 pixels of padding.
    TextualZoomControl.prototype.getDefaultPosition = function() {
      return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
    }

    // Sets the proper CSS for the given button element.
    TextualZoomControl.prototype.setButtonStyle_ = function(button) {
      button.style.textDecoration = "underline";
      button.style.color = "#FF9900";
      button.style.backgroundColor = "#FF9900";
      button.style.font = "small Arial";
      button.style.border = "1px solid #FF9900";
      button.style.padding = "2px";
      button.style.marginBottom = "3px";
      button.style.textAlign = "center";
      button.style.width = "6em";
      button.style.cursor = "pointer";
    }

    var map = null;
    var geocoder = null;

    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
        geocoder = new GClientGeocoder();
      }
    }


function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              document.getElementById("map").innerHTML='<div align="center" class="Article">Affichage du plan indisponible...</div>';
            } else {
              map.setCenter(point, 8);
              var marker = new GMarker(point);
              map.addOverlay(marker);
            }
          }
        );
      }
    }
    function LinkPointFocus(address, Link) {
map.setMapType(G_HYBRID_MAP);
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (point) {
              map.setCenter(point, 5);
              var marker = createMarker(point, Link, iconLg);
              map.addOverlay(marker);
            }
          }
        );
      }
    }
    function LinkPoint(address, Link) {
map.setMapType(G_HYBRID_MAP);
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (point) {
              map.setCenter(point, 5);
              var marker = createMarker(point, Link, icon);
              map.addOverlay(marker);
            }
          }
        );
      }
    }
    function LinkPointMap(address, Link) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (point) {
              map.setCenter(point, 5);
              var marker = createMarker(point, Link, icon);
              map.addOverlay(marker);
            }
          }
        );
      }
    }
    function LinkPointSat(address, Link) {
map.setMapType(G_SATELLITE_MAP);
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (point) {
              map.setCenter(point, 5);
              var marker = createMarker(point, Link, icon);
              map.addOverlay(marker);
            }
          }
        );
      }
    }

    function showAddress2(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              document.getElementById("map").innerHTML='<div align="center" class="Article">Affichage du plan indisponible...</div>';
            } else {
              map.setCenter(point, 7);

              var marker = new GMarker(point);
              map.addOverlay(marker);
            }
          }
        );
      }
    }