	var map;
    var geocoder;
	var nom;
	var marques_coord1=new Array();
	var marques_coord2=new Array();
	var marques_nom=new Array();
	var marques_nombre;
	var curi = 0;
	var curzoom = 11;
	var curz = 1;
	marques_nombre=0;
	var baseIcon = new GIcon();
	var marquez;
	var red = new GIcon(baseIcon, 'http://labs.google.com/ridefinder/images/mm_20_red.png', null, 'http://labs.google.com/ridefinder/images/mm_20_shadow.png');
	var green = new GIcon(baseIcon, 'http://labs.google.com/ridefinder/images/mm_20_green.png', null, 'http://labs.google.com/ridefinder/images/mm_20_shadow.png');
	var blue = new GIcon(baseIcon, 'http://labs.google.com/ridefinder/images/mm_20_blue.png', null, 'http://labs.google.com/ridefinder/images/mm_20_shadow.png');


    function addMarqueurToMap(point3,html) {
      //map.clearOverlays();
        var marker = new GMarker(point3);
        map.setCenter(point3,curzoom);
        map.addOverlay(marker);
       marker.openInfoWindowHtml(html);
    }
    function addMarqueurToMap2(point3,html,z) {
      //map.clearOverlays();
      	curz = z;
        markerz = CreationDuMarqueur(point3,html)
        map.setCenter(point3,z);
        map.addOverlay(markerz);
    }


    function addAddressToMap(response) {
      //map.clearOverlays();
      /*$('test').innerHTML+= ' # '+response.Status.code+' # ';*/
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        map.setCenter(point,curz);
      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.

    function showLocation(z) {
      var address = document.forms[1].q.value;
      curz = z;
      geocoder.getLocations(address, addAddressToMap);
    }


    function CreationDuMarqueur(pointm,html) {
		var markerm = new GMarker(pointm);
		GEvent.addListener(markerm, 'click', function() {
			map.setCenter(markerm.getPoint(),14);
			markerm.openInfoWindowHtml(html);
		});
		GEvent.addListener(markerm, 'infowindowclose', function() {
			map.setCenter(pointm, curz);
		});
		return markerm;
	}
	function showAddress(address) {
	  geocoder.getLatLng(
	    address,
	    function(point) {
	      if (!point) {

	      } else {
	        markero = CreationDuMarqueur(point);
	        map.addOverlay(markero);
	      }
	    }
	  );
	}

   // findLocation() is used to enter the sample addresses into the form.

    function findLocation(address,z) {
      document.forms[1].q.value = address;
      showLocation(z);
    }
    function openShop(x,y,html){
	    Shadowbox.open({
	        player:     'html',
	        content:    '',
	        height:     500,
	        width:      700,
	        options:    {
	            onFinish: function(item){
	                if(GBrowserIsCompatible()){
	                    map = new GMap2(document.getElementById('shadowbox_content'));
	                    geocoder = new GClientGeocoder();
						map.addControl(new GSmallMapControl());
	                    map.addControl(new GMapTypeControl());
	                    nx = parseFloat(x);
	                    ny = parseFloat(y);
	                    point = new GLatLng(nx,ny);
	                    /*var marker = new GMarker(point);
      					map.addOverlay(marker);*/
						addMarqueurToMap(point,html);
	                    map.setCenter(point, 14);
	                }
	            }
	        }
	    });

	};
	function openCity(city){
	    Shadowbox.open({
	        player:     'html',
	        content:    '',
	        height:     500,
	        width:      700,
	        options:    {
	            onFinish: function(item){
	                if(GBrowserIsCompatible()){
	                    map = new GMap2(document.getElementById('shadowbox_content'));
	                    geocoder = new GClientGeocoder();
						map.addControl(new GSmallMapControl());
	                    map.addControl(new GMapTypeControl());

						findLocation(city,11);
	                    for(var i = 0; i < marques_nombre; i++){
	                    	curi=i;
	                    	addMarqueurToMap2(new GLatLng(marques_coord1[i],marques_coord2[i]), marques_nom[i],curzoom);
	                    }
	                    /*findLocation(dept,11);*/


	                }
	            }
	        }
	    });

	};
	function openDept(dept){
	    Shadowbox.open({
	        player:     'html',
	        content:    '',
	        height:     500,
	        width:      700,
	        options:    {
	            onFinish: function(item){
	                if(GBrowserIsCompatible()){
	                    map = new GMap2(document.getElementById('shadowbox_content'));
	                    geocoder = new GClientGeocoder();
						map.addControl(new GSmallMapControl());
	                    map.addControl(new GMapTypeControl());
						curzoom=9;
						findLocation(dept,9);

	                    for(var i = 0; i < marques_nombre; i++){
	                    	curi=i;
	                    	addMarqueurToMap2(new GLatLng(marques_coord1[i],marques_coord2[i]), marques_nom[i],9);
	                    }
	                    findLocation(dept,9);

	                    curzoom=11;
	                }
	            }
	        }
	    });

	};
	function test(dept){
	    Shadowbox.open({
	        player:     'html',
	        content:    '',
	        height:     500,
	        width:      700,
	        options:    {
	            onFinish: function(item){
	                $('shadowbox_content').innerHTML = 'Coucou';
	            }
	        }
	    });

	};


