


        /*Add 10 markers to the map at random locations

        var bounds = map.getBounds();

        var southWest = bounds.getSouthWest();

        var northEast = bounds.getNorthEast();

        var lngSpan = northEast.lng() - southWest.lng();

        var latSpan = northEast.lat() - southWest.lat();

        for (var i = 0; i < 10; i++) {

          var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(),

            southWest.lng() + lngSpan * Math.random());

          map.addOverlay(createMarker(latlng, i));



        } */




    function load(adresses, texts, names) {

      if (GBrowserIsCompatible()) {

        var map = new GMap2(document.getElementById("map"));

		map.addControl(new GLargeMapControl());

		//map.addControl(new GMapTypeControl());

		var geocoder = new GClientGeocoder();

		// Create a base icon for all of our markers that specifies the

        // shadow, icon dimensions, etc.

        var baseIcon = new GIcon();

        baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		baseIcon.image = "img/immeuble.png";
		baseIcon.iconSize = new GSize(38, 40);
		baseIcon.shadowSize = new GSize(0, 0);
		baseIcon.iconAnchor = new GPoint(10, 30);
		baseIcon.infoWindowAnchor = new GPoint(15, 20);
		baseIcon.infoShadowAnchor = new GPoint(0, 0);
		var tooltip;
 //This function initializes the tooltips. Without it tooltips will not showup.
 function initTooltip() {
          tooltip = document.createElement("div");
	      map.getPane(G_MAP_FLOAT_PANE).appendChild(tooltip);
          tooltip.style.visibility="hidden";
 }
		initTooltip();


        // Creates a marker whose info window displays the letter corresponding

        // to the given index.

        function createMarker(point, texte, name, open) {

          // Create a lettered icon for this point using our icon class


		  //POUR ICONE CUSTOM
		  //var letteredIcon = new GIcon(baseIcon);

          //letteredIcon.image = "/images/marker.png";

			// Set up our GMarkerOptions object

			//markerOptions = { icon:letteredIcon };


          var marker = new GMarker(point, {icon:baseIcon});
          GEvent.addListener(marker, "click", function(){
            marker.openInfoWindowHtml(texte);
          });
		marker.tooltip = '<div class="tooltip">'+name+'</div>';
		GEvent.addListener(marker,"mouseover", function() {
			showTooltip(marker);
		});
		GEvent.addListener(marker,"mouseout", function() {
			tooltip.style.visibility="hidden"
		});
          map.addOverlay(marker);

		  /*if(open=="ok"){

			marker.openInfoWindowHtml(texte);

			}*/

        }

 // This shows the tooltip when the mouse hovers over a marker or a sidebar link.
	function showTooltip(marker) {
	   	tooltip.innerHTML = marker.tooltip;
		var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.fromDivPixelToLatLng(new GPoint(0,0),true),map.getZoom());
		var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
		var anchor=marker.getIcon().iconAnchor;
		var width=marker.getIcon().iconSize.width;
		var height=tooltip.clientHeight;
		var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(offset.x - point.x - anchor.x, offset.y - point.y -anchor.y - (1.2*height)));
		pos.apply(tooltip);
		tooltip.style.visibility="visible";
	    // Code From PdMarkers www.pixeldevelopment.com/pdmarker.asp
	    var b = 75;
		var c = b / 100;
		if (tooltip)
		{
			if(typeof(tooltip.style.filter)=='string'){tooltip.style.filter='alpha(opacity:'+b+')';}
			if(typeof(tooltip.style.KHTMLOpacity)=='string'){tooltip.style.KHTMLOpacity=c;}
			if(typeof(tooltip.style.MozOpacity)=='string'){tooltip.style.MozOpacity=c;}
			if(typeof(tooltip.style.opacity)=='string'){tooltip.style.opacity=c;}
		}
		// end of PdMarkers code
	}

		function showAddress(address,txt, name, zoom, critic) {
			geocoder.getLatLng(

				address,

				function(point) {

				  if (!point) {

					//alert(address + " not found");
					if(critic)
					{
						//document.getElementById("map").style.display='none';
					}

				  } else {
					map.setCenter(point, zoom);
					createMarker(point, txt, name, "ok");
				  }

				}

			);
		}
		for(i=0;i<adresses.length;i++)
		{
			showAddress(adresses[i], texts[i], names[i], (adresses.length==1?15:11), (adresses.length==1?true:false));
		}

      }

    }
