      var map = null;
      var agence = new Array;
	  var latdep = '';
	  var longdep = '';
	  var depzoom = '';
	  var ladresse = '';
	  var tagence = '';
	  var i = 0;
	  
	  function EventMouseWheel()
	  {
		  return true;
	  }
      function loadinfocarte()
	  {
		  
	  	map.DeleteAllShapes();
		for(x in agence)
			AddPushpin(agence[x][0], agence[x][1], agence[x][2], agence[x][3]);
			
	  }
      function AddPushpin(loca, titre, desc, ag)
      {
         var shape = new VEShape(VEShapeType.Pushpin, loca);

		 var icon = "<div style='font-size:10px;font-family: Arial, Helvetica, sans-serif;color:#000000;font-weight:bold;text-align:center;width:34px;padding-left:3px;padding-top:2px;height:25px;background-repeat:no-repeat;background-image: URL(images/pointeur2.png)'>" + titre + "</div>";
			
         //Set the icon
         shape.SetCustomIcon(icon);
         shape.SetTitle(desc);
		 shape.SetDescription(ag);

		 //shape.SetDescription(desc);
		 
         //Set the info box
         map.ClearInfoBoxStyles();
		 shape.SetZIndex(999);
         
         //Add the shape the the map
         map.AddShape(shape);

      }
	  
	  function carteclick(e)
      {
         if(e.elementID != null)
		 {
		 	 var ville = map.GetShapeByID(e.elementID).GetTitle();
             window.location.href = "list_agence.php?departement=" + departement+"&ville=" + ville; 
         }
		 else
           return false;
      }
	  function loadinfocarte2()
	  {
	  	map.DeleteAllShapes();
		var tabtmp = new Array();
		var point = "";
		
		for(x in agence)
		{
			if(agence[x][3] != "true")
				point = "<div style='font-size:10px;font-family: Arial, Helvetica, sans-serif;color:#000000;font-weight:bold;text-align:center;width:34px;padding-left:3px;padding-top:2px;height:25px;background-repeat:no-repeat;background-image: URL(images/pointeur3.png)'></div>";
			else
				point = "<div style='font-size:10px;font-family: Arial, Helvetica, sans-serif;color:#000000;font-weight:bold;text-align:center;width:16px;padding-left:3px;padding-top:2px;height:22px;background-repeat:no-repeat;background-image: URL(images/pointeurrose.png)'></div>";
				
			var tmp = new VEShapeLayer();
			tmp.SetTitle(agence[x][1]+"|"+agence[x][2]);
			tmp.SetDescription(point);
			tabtmp[x] = tmp;
			map.Find(null,agence[x][0],null,tabtmp[x],0,1,true,true,false,false,FindCallBack);
		}
		map.SetCenterAndZoom((new VELatLong(latdep,longdep)), depzoom);
	  }

	function FindCallBack(shapeLayer, results, positions, moreResults, e)
	{
		var tabtmp = new Array();
		
		if(positions != null && positions.length > 0)
		{	
			tabtmp = shapeLayer.GetTitle().split('|');
			latlong = new VELatLong(positions[0].LatLong.Latitude,positions[0].LatLong.Longitude);
			shape = new VEShape(VEShapeType.Pushpin,latlong);
			shape.SetTitle(tabtmp[0]);
			shape.SetDescription(tabtmp[1]);
			map.ClearInfoBoxStyles();
			shape.SetZIndex(999);
			shape.SetCustomIcon(shapeLayer.GetDescription());
			map.AddShape(shape); 
		
		}
	}

	  function carteclick2(e)
      {
         if(e.elementID != null)
		 {
		 	 var ville = map.GetShapeByID(e.elementID).GetTitle();
             window.location.href = "list_agence.php?departement=" + departement+"&ville=" + ville; 
         }
		 else
           return false;
      }
	  function loaddonnee()
	  {
		// Mise à jour de la variable de session
		var xhr_object = null;
		
		map = new VEMap('map_inner');
		map.SetDashboardSize(VEDashboardSize.Tiny);
		map.HideScalebar();
		
		if(window.XMLHttpRequest)
			xhr_object = new XMLHttpRequest();
		else if(window.ActiveXObject)
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		else {
			alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
			return;
	   	}
		xhr_object.open("POST", "localisationagence2.php", true);
		xhr_object.onreadystatechange = function()
        {
        	if (xhr_object.readyState == 4)
            { 
				if(xhr_object.responseText != "")
				{ 
					map.LoadMap();
					map.AttachEvent("onmousewheel", EventMouseWheel);
					map.AttachEvent("onclick", carteclick);
					eval(xhr_object.responseText);
					map.SetCenterAndZoom((new VELatLong(latdep,longdep)), depzoom);
					loadinfocarte();
				}
			}
		}
		xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		var data = 'departement=' + departement;
		xhr_object.send(data);
	}
    function loaddonnee2()
	{
		// Mise à jour de la variable de session
		var xhr_object = null;
		
		map = new VEMap('map_inner');
		map.SetDashboardSize(VEDashboardSize.Tiny);
		map.HideScalebar();
		
		if(window.XMLHttpRequest)
			xhr_object = new XMLHttpRequest();
		else if(window.ActiveXObject)
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		else {
			alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
			return;
	   	}
		xhr_object.open("POST", "localisationagence3.php", true);
		xhr_object.onreadystatechange = function()
        {
        	if (xhr_object.readyState == 4)
            { 
				if(xhr_object.responseText != "")
				{ 
					map.LoadMap();
					map.AttachEvent("onmousewheel", EventMouseWheel);
					//map.AttachEvent("onclick", carteclick2);
					eval(xhr_object.responseText);
					loadinfocarte2();
				}
			}
		}
		xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		var data = 'departement=' + departement + '&ville=' + ville;
		xhr_object.send(data);
	}
