
	var GOOGLE_M = false;
	var xxx = 0;
	var lat;
	var long;
	var zoom;
	var flash;
	var xMouse;
	var yMouse;
	var moveSListener;
	var moveListener;
	var moveEListener;
	var difX = 0;
	var difY = 0;
	var map;
	var IE = document.all?true:false;
	var geocoder;
	var googleMapEnable = true;
	var mouseX = 0;
	var mouseY = 0;
	var initMapOk = false;
	var timeoutInit;
	var onloadOk = false;
	
	function onloadie()	{
			load();
			//move();
			//detectAntiPopup('Ce site utilise des popups mais votre navigateur en interdit l\'usage. Afin de profiter pleinement de toutes les fonctionnalites du système de cartographie veuillez autoriser les popups pour ce site.');
	}
	document.onunload=GUnload();
		
	var winNom="title";
	function ouvrirFenetre(theURL,w,h) {
		var windowprops ="top=0,left=0,toolbar=no,location=no,status=no, menubar=no,scrollbars=no, resizable=yes,width=" + w + ",height=" + h;
		window.open(theURL,winNom,windowprops);
	}

	/*
	if (!IE) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = getMouseXY;

	function getMouseXY(e) {
		if (IE) { //pour IE
			mouseX = event.clientX + document.body.scrollLeft;
			mouseY = event.clientY + document.body.scrollTop;
		}
		else { //pour netscape
			mouseX = e.pageX;
			mouseY = e.pageY;
		}
		if (mouseX < 0){mouseX = 0;}
		if (mouseY < 0){mouseY = 0;}

		return true;
	}
	*/
	
	function recMaps(lat,long,ville,state,pays) {
		
		GsetCenterAndZoom(lat,long,-1);
	}

	function LookupLocation(){
		var s = document.createElement("script");
		query="street="+document.getElementById('rue').value+"&city="+document.getElementById('ville').value+"&state="+document.getElementById('state').value+"&country="+document.getElementById('pays').value;
		s.src="http://www.localsearchmaps.com/geo/?"+query+"&cb=recMaps";
		s.type = "text/javascript";
		document.getElementsByTagName( "head" )[0].appendChild(s);
	}
	function CBE(error) {
	        document.getElementById('message').innerHTML=error;
	}

	function detectNavigator() {
		if(navigator.appName.indexOf("Microsoft") != -1) {
			flash = window.def9;
		}else {
			flash = window.document.def9;
		}
	}
	
	function initFlash() {
		detectNavigator();
		//alert("initFlash");
		timeoutInit = setInterval ("initMap()", 1000 );
	}
	
	function initMap() {
		//alert("--- initMap - "+initMapOk);
		if(initMapOk) { 
			//alert("ok ok");
			flash.ASCartoStart(); 
			clearInterval(timeoutInit);
		}
	}

	function load() {
		//alert("--- load déjà fait : "+onloadOk);
		if(!onloadOk) {
			onloadOk = true;
			detectNavigator();
	
			if (GBrowserIsCompatible()) {
				
				map = new GMap2(document.getElementById("mapGGL"));
				GEvent.addListener(map, "load", function() {
					initMapOk = true;
				});
				map.setCenter(new GLatLng(0,0), 0);
	
				map.setMapType(G_HYBRID_MAP);
				geocoder = new GClientGeocoder();
				addListeners();
				
				//positionne le point et zoom de départ	
				//flash.ASCartoStart();
				//flash.ASInitPosition();
			}
	
		}
	}

	function JSSetMapTypeGgl(type) {
		
		switch(type) {

			case 0:map.setMapType(G_NORMAL_MAP);break;
			case 1:map.setMapType(G_SATELLITE_MAP);break;
			case 2:map.setMapType(G_HYBRID_MAP);break;
			
		}
	}

	function showAddress(address) {
		
		if (geocoder) {
		    geocoder.getLatLng(address, function(point) {
					if (!point) {
						alert("showAddress:"+address + " not found");
					}
					else {

						if (googleMapEnable) map.setCenter(point);
						flash.ASDragGoogleMaps(point.lat(),point.lng());

					}
				}
			);

		}
	}

	function getGeocode(address) { /// ? ExternalInterface
		
		var obj;
		var lat = 0;
		var lng = 0;

		xxx++;
		if (geocoder) {
		    geocoder.getLatLng(address, function(point) {
					if (!point) {
						alert("getGeocode:"+address + " not found");
						obj.lat = 999;
						obj.lng = 999;
					}
					else {
												
						lat = point.lat();
						lng = point.lng();
						alert("kk:"+lat+" "+lng);
					}
				}
			);

		}

		obj = new String(lat+" "+lng);
		alert(obj+" "+lat+" "+lng+" "+xxx);
		return obj;
	}

	function addListeners() {
	
		moveSListener = GEvent.addListener(map,"movestart", movStart);
		moveListener = GEvent.addListener(map,"move",move);
		moveEListener = GEvent.addListener(map, "moveend",movEnd);
	}
	
	function movStart() {

		 var mapCenterF = map.getCenter();
		 flash.ASDragGoogleMaps(mapCenterF.lat(),mapCenterF.lng());
	}
	
	function move() {
		var mapCenterF = map.getCenter();
		flash.ASDragGoogleMaps(mapCenterF.lat(),mapCenterF.lng());
	}

	function movEnd() {
		
		var mapCenterF = map.getCenter();
		flash.ASDragGoogleMaps(mapCenterF.lat(),mapCenterF.lng());
		
	}	
	function JSZoomIn() {
		
		map.zoomIn();
	}

	function JSZoomOut() {
		
		map.zoomOut();
	}
	
	function JSSetCenter(lat,lng) {
		map.setCenter(new GLatLng(lat,lng));
	}

	function JSrefreshGooglemaps(dx,dy,zoom) {
		
		map.panTo(new GLatLng(dy,dx));
		map.setZoom(zoom);
	}

	function JSRemoveGoogleMaps() {

		document.getElementById('mapGGL').style.visibility = 'hidden';

	}

	function JSReajouteGoogleMaps(lat,lng) {
		
		document.getElementById('mapGGL').style.visibility = 'visible';
		map.setCenter(new GLatLng(lat,lng));
		
	}

	function JSResizeGoogleMap(h,w) {
		document.getElementById('mapGGL').style.width = w;
		document.getElementById('mapGGL').style.height = h;
	}