			
			
			// /////////////////////////
			// GOOGLE MAP CUSTOM
			// /////////////////////////
			function initializeGmap(){
				// lancement de la map
				$("#gmap").gmap3(
				
					// init
					{
						action: 'init',
						options:{
							center:[45.646720, 5.869293],
							zoom:16,
							mapTypeControl: false,
							mapTypeId: google.maps.MapTypeId.ROADMAP,
							mapTypeControlOptions: { 
								mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'style1']
							},
							navigationControl: false,
							scrollwheel: true,
							streetViewControl: false
							
						}
					},
					
					// création de style gris
					{
                        action: 'addStyledMap',
                        id: 'style1',
                        options:{name: 'Style 1'},
                        style : [ 
							{featureType: "water",elementType: "all",stylers: [{ hue: "#65b2df" }, { saturation: 30 }, { lightness: -16 }]},
							{featureType: "transit",elementType: "all",stylers: [{ saturation: -100 }]},
							{featureType: "road",elementType: "all",stylers: [{ saturation: -100 }]},
							// {featureType: "poi",elementType: "all",stylers: [{ saturation: -100 }]},
							{featureType: "poi",elementType: "all",stylers: [{ visibility: "off" }]},
							// {featureType: "landscape",elementType: "all",stylers: [{ saturation: -100 }]}
							{featureType: "landscape.man_made",elementType: "all",stylers: [ { visibility: "simplified" }, { saturation: -100 }, { hue: "#1f1f1f" },{ lightness: -50 }]},
							{featureType: "landscape.natural",elementType: "all",stylers: [{ saturation: -100 }]},
							]
                    },
					
					// create a new style and active it after having created the map
                    {
                        action: 'setStyledMap',
                        styledmap:{id: 'style1', options:{name: 'Style 1'}}
                    },
					
					// ajout bulle
					{
						action: 'addMarker',
						// address: "12, allée du lac de Garde 73375 Le Bourget du Lac",
						address: '45.646720, 5.869293',
						marker:{
							options:{
								icon:new google.maps.MarkerImage("img/gmap-salut.png", new google.maps.Size(102, 113), new google.maps.Point(0, 0), new google.maps.Point(117, 104))
							}
						}
					}
				);
			}
			
			// /////////////////////////
			// GOOGLE EARTH
			// /////////////////////////
			google.load("earth", "1");
			// var ge = null;
			function gEarthInit() {
				if(typeof(window.gearthRunning) == 'undefined' || !window.gearthRunning){
					// alert('demarrage de gearth');
					google.earth.createInstance("gearth", gEarthInitCallback, gEarthFailureCallback);
					window.gearthRunning=true;
				}
			}

			function gEarthInitCallback(object) {
				// alert('initcallback');
				
				ge = object;
				ge.getWindow().setVisibility(true);
				
				// activer les batiments
				ge.getLayerRoot().enableLayerById(ge.LAYER_BUILDINGS, true);
				
				// fly
				var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
				var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
				/*
				// camera DEPLACE DANS LE LOAD KML
				camera.setLatitude(45.64694);
				camera.setLongitude(5.869544);
				camera.setAltitude(2.66228);
				// lookAt.setRange(200.0);
				camera.setTilt(89.35);
				camera.setRoll(-1.48);
				camera.setHeading(-161.6);

				// Update the view in Google Earth
				ge.getView().setAbstractView(camera);
				*/
				
				// import 3d
				// fetch the KML
				var url = 'http://sketchup.google.com/' +
						'3dwarehouse/download?mid=c0649bc30f1824d059c2b466bddf32a5&rtyp=ks&fn=hb8-2&ctyp=other&ts=1310974262000';
				google.earth.fetchKml(ge, url, finishedLoadingKml);
			}

			function gEarthFailureCallback(object) {
				// alert('Désolé, erreur de lancement de l\'application sur ce navigateur');
			}
			
			function gEarthInfos() {
				camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
				alert('getTilt : '+camera.getTilt() +" \n "+
				'getRoll : '+camera.getRoll() +" \n "+
				'getLatitude : '+camera.getLatitude() +" \n "+
				'getLongitude : '+camera.getLongitude() +" \n "+
				'getAltitude : '+camera.getAltitude() +" \n "+
				'getHeading : '+camera.getHeading());
			}
			
			  // in this sample we will attempt
			  // to fetch a  KML file and show it

			function finishedLoadingKml(object) {
				if (!object) {
				  // wrap alerts in API callbacks and event handlers
				  // in a setTimeout to prevent deadlock in some browsers
				  setTimeout(function() {
					alert('Bad or null KML.');
				  }, 0);
				  return;
				}
				ge.getFeatures().appendChild(object);
				// camera
				camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
				camera.setLatitude(45.64722);
				camera.setLongitude(5.869791);
				camera.setAltitude(4.9755);
				// lookAt.setRange(200.0);
				camera.setTilt(89.4204);
				camera.setRoll(-1.4793);
				camera.setHeading(-156.7232);

				// Update the view in Google Earth
				ge.getView().setAbstractView(camera);
			  }
			  
			 
			  // google.earth.fetchKml(ge, url, finished);
			
			/*
			// jquery
			$(document).ready(function() {	
				// démarrage du gearth
				gEarthInit();
			});
			*/
