/* Google Maps  */// Eric Quillévéré  27/05/2009/*jsl:import js_rewrite.js *//*jsl:import infobulles/infobulle.js */var mapGoogle=null;var mapGoogle_longi_min=null;var mapGoogle_longi_max=null;var mapGoogle_lati_min=null;var mapGoogle_lati_max=null;var mapGoogle_infobulles=Array();var mapGoogle_listePoints=Array();function ZoomControl(){};function googleMaps_cree(idObjet, opt_affSatellite, opt_affMiniZoom) 	{	if (nonDef(opt_affSatellite)) opt_affSatellite=true;	if (nonDef(opt_affMiniZoom)) opt_affMiniZoom=true;		if (GBrowserIsCompatible()) 		{		window.onunload=GUnload;		mapGoogle = new GMap2(document.getElementById(idObjet));				if (mapGoogle)			{			//mapGoogle.addControl(new GLargeMapControl()); new GMapTypeControl()  GLargeMapControl3D			if (opt_affMiniZoom)				{				var controlPosition = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 10));				mapGoogle.addControl(new GSmallMapControl(),controlPosition);				}										// Carte satellite			if (opt_affSatellite)				{				mapGoogle.addMapType(G_PHYSICAL_MAP);				mapGoogle.setMapType(G_PHYSICAL_MAP);							}						//utilisation de la molette pour le zoom			mapGoogle.enableScrollWheelZoom();			// échelle des distances			mapGoogle.addControl(new GScaleControl());									// Permet l'ajout d'un control zoom personnalisé			/*			ZoomControl.prototype = new GControl();			ZoomControl.prototype.initialize = googleMaps_zoomPersonnel2;			*/			}		}	}	// Ajoute un control zoom personnalisé	function googleMaps_zoomPersonnel()	{	mapGoogle.addControl(new ZoomControl());	ZoomControl.prototype.getDefaultPosition = function() 		{		return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(25, 25));		}	;	}/*function googleMaps_zoomPersonnel2(map) 	{	var container = document.createElement("div");	var zoomInDiv = obj_Cree('div', container);	//this.setButtonStyle_(zoomInDiv);	zoomInDiv.appendChild(document.createTextNode("Zoom In"));	zoomInDiv.innerHTML = '<b>Test</b>'; 	GEvent.addDomListener(zoomInDiv, "click", function() 		{		map.zoomIn();		});	map.getContainer().appendChild(container);	return container;		}					*/		// Calcule le zoom par rapport aux points ajoutés	function googleMaps_centrerCarte() 	{	if (mapGoogle)		{		var bounds = new GLatLngBounds;		bounds.extend(new GLatLng(mapGoogle_longi_min, mapGoogle_lati_min));		bounds.extend(new GLatLng(mapGoogle_longi_max, mapGoogle_lati_max));		var zoom = mapGoogle.getBoundsZoomLevel(bounds);				//Calcul du centre		mapGoogle.setCenter(new GLatLng((mapGoogle_longi_max-mapGoogle_longi_min)/2, (mapGoogle_lati_max-mapGoogle_lati_min)/2), zoom);		var clat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) /2;		var clng = (bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) /2;		mapGoogle.setCenter(new GLatLng(clng,clat)); 					}	}	// Cache les points d'un certain typefunction googleMaps_afficheCachePoint(opt_type, opt_cacher, opt_supprimer)	{	if (nonDef(opt_type)) opt_type=0;	if (nonDef(opt_cacher)) opt_cacher=false;	if (nonDef(opt_supprimer)) opt_supprimer=false;			for (var i=0;i<mapGoogle_listePoints.length;i++)		{		var point=mapGoogle_listePoints[i];		if (point[1]==opt_type || opt_type===0)			{			if (opt_supprimer)				point[0].remove();			else if (opt_cacher)				point[0].hide();			else				point[0].show();			}		}	}	// Ajoute un pointfunction googleMaps_ajoutePoint(textePoint, latitude, longitude,	img_aff, tailleX_aff, tailleY_aff,	txt_hover, titre_hover, opt_fonctionClic,	opt_centrerSurPoint,	opt_calculZoom,	opt_typePoint, opt_appelPageClic, opt_messageChargement, opt_estVisible) 	{	if (nonDef(opt_centrerSurPoint)) opt_centrerSurPoint=false;	if (nonDef(opt_calculZoom)) opt_calculZoom=false;	if (nonDef(opt_appelPageClic)) opt_appelPageClic='';	if (nonDef(opt_estVisible)) opt_estVisible=true;		if (mapGoogle)		{		var point = new GLatLng(latitude, longitude);		if (opt_centrerSurPoint) mapGoogle.setCenter(point);				//Pour le calcul du zoom		if (opt_calculZoom)			{			if (longitude<mapGoogle_longi_min || mapGoogle_longi_min===null) mapGoogle_longi_min=longitude;			if (longitude>mapGoogle_longi_max || mapGoogle_longi_max===null) mapGoogle_longi_max=longitude;			if (latitude<mapGoogle_lati_min || mapGoogle_lati_min===null) mapGoogle_lati_min=latitude;			if (latitude>mapGoogle_lati_max || mapGoogle_lati_max===null) mapGoogle_lati_max=latitude;			}					var icon = new GIcon();		icon.image = img_aff ;		icon.iconSize=new GSize(tailleX_aff, tailleY_aff);		icon.iconAnchor=new GPoint(tailleX_aff, tailleY_aff);		icon.infoWindowAnchor = new GPoint(5, 1);				var marker = new GMarker(point, {icon:icon, title:textePoint});		mapGoogle.addOverlay(marker);		if (!opt_estVisible) marker.hide();		if (!nonDef(opt_typePoint))			tab_Ajoute(mapGoogle_listePoints, Array(marker, opt_typePoint));		// Fonction spéciale sur clic		if (!nonDef(opt_fonctionClic))			GEvent.addListener(marker, 'click', opt_fonctionClic);		else if (opt_appelPageClic!=='')			{			GEvent.addListener(marker, 'click', function()				{				marker.openExtInfoWindow( mapGoogle, 'custom_info_window_red', opt_messageChargement,		              { ajaxUrl: opt_appelPageClic, 		                beakOffset: 3, paddingY:20		              }		            ); 						}				);			}					GEvent.addListener(marker, "mouseover", function() 			{			if (window.Bulle_Final)				{				new Bulle(marker,titre_hover,txt_hover,null,null,20,10,0, null, null, null, null);				mapGoogle_infobulles.push();				}						});								GEvent.addListener(marker, "mouseout", function() 			{			if (window.Bulle_Final)				Bulle_Final(marker);			});											}	}
