	//	VARIABLES PAR DEFAUT 
	var arrayOptInfos= Array();
	var map, cluster, eventListeners=[], markersArray=[], icon;
	

	//	DETECTION NAVIGATEUR ET AJOUT D4EVENEMENT ONLOAD ET ONUNLOAD
	(window.addEventListener) ? window.addEventListener( "load", myOnload, false )	:	window.attachEvent( "onload", myOnload );
	(window.addEventListener) ? window.addEventListener( "unload", GUnload, false )	:	window.attachEvent( "onunload", GUnload );
	
	
	
	//	FONCTION DE LOAD DE LA CARTE
	function myOnload() {
		
		if (GBrowserIsCompatible()) {																				
			
			//	PARAMETRES DE LA MAP
			map=new GMap2(document.getElementById('map'),{mapTypes: [G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP,G_PHYSICAL_MAP,G_SATELLITE_3D_MAP]});				// creation objet map vide
			map.setCenter(new GLatLng(46.721252, 2.509024), 5, G_NORMAL_MAP);										// setCenter sur centre de la france, niveau de zoom 5
																													// inutile en l'etat, mais sert si aucun resultat
			if(!detailAgence){ map.addControl(boutonRegrouper(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7,7)));	}			// grouper les agences oui/non			GSize(left, top)
			map.addControl(new GMenuMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(95, 7)));	// Map / Satellite / Hyprid 			GSize(left, top)
			map.addControl(new GSmallZoomControl3D(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 30)));	// barre de zoom de grande taille		GSize(left, top) : http://code.google.com/apis/maps/documentation/controls.html
			map.enableScrollWheelZoom();																			// active le zoom via la roulette
			//map.addControl(new GScaleControl());																	// affichage de l'echelle en miles
			GEvent.addListener(map, 'zoomend', function() { map.closeInfoWindow(); });								// ecouteur sur action fin zoom/dezoom -> ferme infobulle
			
			//	PARAMETRES DES MARQUEURS INDIVIDUELS
			icon = iconeVF(urlBase);
			
			//	SOUS FONCTION GERANT LES CLICKS SUR LES CLUSTERS
			function myClusterClick(args) {
				cluster.defaultClickAction=function(){
					map.setCenter(args.clusterMarker.getLatLng(), map.getBoundsZoomLevel(args.clusterMarker.clusterGroupBounds))
					delete cluster.defaultClickAction;
				}
				var html = infobulleGroupe(args);
				map.openInfoWindowHtml(args.clusterMarker.getLatLng(), html);
			}
			
			//	CREATION D'UN ClusterMarker A VIDE A QUI ON ASSIGNE LA FONCTION myClusterClick SUR L'EVENEMENT clusterMarkerClick (optionnel, peut etre retire)
			cluster=new ClusterMarker(map, {clusterMarkerTitle:'Cliquer pour voir les %count agences' , clusterMarkerClick:myClusterClick });
			
			//	ON CHARGE LES ELEMENTS A AFFICHER
			loadElementsMaps();
			
			// Si on a demande a afficher le moteur de recherche, on load sa fonction
			if (typeof searchForm != "undefined" && (searchForm)) { loadGeocodeur(); }
		}
	}
	
	
	//	FONCTION GERANT LA CREATION DE MARQUEUR INDIVIDUELS
	function newMarker(markerLocation, title, markerIcon, htmlbulle) {
		var marker=new GMarker(markerLocation, {title:title, icon:markerIcon});
		eventListeners.push(GEvent.addListener(marker, 'click', function() {
			marker.openInfoWindowHtml(htmlbulle);	// + infos sur options : http://code.google.com/apis/maps/documentation/reference.html#GInfoWindowOptions
		}));
		return marker;
	}


	
	
	// FONCTION GERANT L'AFFICHAGE GROUPE OU NON (appel via checkbox)
	function toggleClustering() {
		cluster.clusteringEnabled=!cluster.clusteringEnabled;
		cluster.refresh(true);
	}
	
	
	// FONCTION GERANT LE LOAD DES ELEMENTS VIA LA FONCTION GDownloadUrl('url_elements','fonction_retour');
	function loadElementsMaps(){
		
		processIt=function(file, code){
			if(code===200){
				markersArray=[];
				for(i=eventListeners.length-1; i>=0; i--){
					GEvent.removeListener(eventListeners[i]);
				}
				eventListeners=[];
				
				//	le parse natif du JSON est plus sur et plus rapide mais pas tous les navigateurs le reconnaissent ...
				var json = ( typeof JSON !== "undefined" ) ? JSON.parse(file)	:	eval('(' + file + ')');
				
				var marker;
				for (var i=0; i<json.agences.nbr; i++) {
					arrayOptInfos['url_'+i] 	= json.agences['agence_'+i].url;	// un array contenant les URL des agences
					arrayOptInfos['cp_'+i]		= json.agences['agence_'+i].cp;		// un array contenant les CP des agences
					arrayOptInfos['site_'+i]	= json.agences['agence_'+i].site;	// un array contenant les site actif des agences
					marker=newMarker(new GLatLng(json.agences['agence_'+i].lat, json.agences['agence_'+i].long), json.agences['agence_'+i].nom, iconeVF(urlBase), infobulle(json.agences['agence_'+i]));
					markersArray.push(marker);
				}
				cluster.removeMarkers();
				cluster.addMarkers(markersArray);
				cluster.fitMapToMarkers();
				map.savePosition();
				json=[];
				
			} else {
				GLog.write('Impossible de charger la liste d\'agences. Code erreur : '+code);
			}
			
			if (typeof forceCenter != "undefined" && (forceCenter)) { 
				// dans le cas ou l'on souhaite forcer le centrage et le zoom de la carte
				// une fois qu'on a tout charge, on force la carte sur le monde, en zoom 2
				map.setCenter(new GLatLng(46.721252, 2.509024), 2, G_NORMAL_MAP);										// setCenter sur centre de la france, niveau de zoom 2
			}
			
			if (typeof forceZoom != "undefined" && (forceZoom)) { 
				// dans le cas ou l'on souhaite forcer le zoom de la carte
				// une fois qu'on a tout charge, on force le zoom a 15
				map.setZoom(15);			// setZoom au niveau 15
			}

		};
		GDownloadUrl(urlJson, processIt);
		
	}
