Index: extensions/edit_gmaps/admin/js/JScript.js
===================================================================
--- extensions/edit_gmaps/admin/js/JScript.js	(revision 8501)
+++ extensions/edit_gmaps/admin/js/JScript.js	(revision 9377)
@@ -80,18 +80,28 @@
 
             google.maps.event.addListener(marker,
-        'dragend',
-        function () {
-            updateMarkerStatus('Drag ended');
-            geocodePosition(marker.getPosition());
-           
-            }
+                                            'dragend',
+                                            function () {
+
+                                             
+                                     
+                                              // getElevation({ latLng: marker.getPosition() });
+                                                geocodePosition(marker.getPosition());
+                                                updateMarkerStatus('Drag ended');
+                                                getElevation({ 'latLng': marker.getPosition() });
+                                                document.Envoie.alt.value = coordinates.ALT;
+
+                                            }
         );
 
-
-
-		        // Update current position info.    
+       // styleIcon = new StyledIcon(StyledIconTypes.BUBBLE, { color: "#cccccc", text: "Drag Me!" });
+       // var styleMaker1 = new StyledMarker({ styleIcon: styleIcon, position: new google.maps.LatLng(37.383477473067, -121.880502070713), map: map, draggable: true });
+
+       // google.maps.event.addDomListener(styleMaker1, "dragend", getElevation);
+                                            // Update current position info.    
+
 		       updateMarkerPosition(LatLng);
 		       geocodePosition(LatLng);
-	      
+		       getElevation({ 'latLng': marker.getPosition() });
+		       document.Envoie.alt.value = coordinates.ALT;
 	          return false;
     
@@ -109,6 +119,52 @@
                 document.Envoie.lat.value=latLng.lat() ;
                 document.Envoie.lon.value = latLng.lng();
-               
-                
+                dms_frac = dec2dms(latLng.lng());
+                if (dms_frac.Degre < 0)
+                    document.Envoie.lonRef.value = "W";
+                else
+                    document.Envoie.lonRef.value = "E";
+                document.Envoie.lonDMS.value = Math.abs(dms_frac.Degre) +"/1" + " " + dms_frac.Minute +"/1" + " " +    dms_frac.Numerator + "/" + dms_frac.Denominator;
+                dms_frac = dec2dms(latLng.lat());
+                if (dms_frac.Degre < 0)
+                    document.Envoie.latRef.value = "S";
+                else
+                    document.Envoie.latRef.value = "N";
+                document.Envoie.latDMS.value = Math.abs(dms_frac.Degre) + "/1" + " " + dms_frac.Minute + "/1" + " " + dms_frac.Numerator + "/" + dms_frac.Denominator;
+                update_datas();
+            }
+
+
+                function update_datas() {
+                n= jQuery(document.EditJPEG);
+
+                jQuery.each(n[0], function (i) {
+
+
+                    n00 = this;
+                    n0 = n00.id;
+                    n1 = n00.name;
+                    n2 = jQuery(n00).val();
+                    try {
+                        if (n0 == "alt") {
+                            n3 = dec2frac(document.Envoie[n0].value);
+                            n3 = n3.Numerator + "/" + n3.Denominator;
+                            jQuery(this).val(n3);
+                        }
+                        else {
+                            n3 = document.Envoie[n0].value;
+                            jQuery(this).val(n3);
+                        }
+                    }
+                    catch (e) {
+                        n3 = n0;
+                    }
+
+
+
+                }
+                )
+
+                   
+
                 }
            
@@ -119,11 +175,43 @@
             }
 
-
-       
-
-
-        function geocodePosition(pos) {
-            geocoder.geocode({ 'latLng': pos },
-               function (results, status) {
+            function getElevation(event) {
+                var elevator = new google.maps.ElevationService();
+                var locations = [];
+
+                // Retrieve the clicked location and push it on the array
+                var clickedLocation = event.latLng;
+                locations.push(clickedLocation);
+
+                // Create a LocationElevationRequest object using the array's one value
+                var positionalRequest = {
+                    'locations': locations
+                }
+
+                // Initiate the location request
+                if (elevator) {
+                    elevator.getElevationForLocations(positionalRequest, function (results, status) {
+                        if (status == google.maps.ElevationStatus.OK) {
+
+                            // Retrieve the first result
+                            if (results[0]) {
+                                coordinates.ALT = results[0].elevation;
+                                document.Envoie.alt.value = coordinates.ALT;
+                                update_datas();
+                                   //styleIcon.set("text", "Elevation: " + results[0].elevation + "m");
+                            } else {
+                               // alert("No results found");
+                            }
+                        } else {
+                            alert("Elevation service failed due to: " + status);
+                        }
+                    });
+                }
+            }
+
+
+
+            function geocodePosition(pos) {
+                     geocoder.geocode({ 'latLng': pos },
+                    function (results, status) {
                    /* Si le géocodage inversé a réussi */
                    if (status == google.maps.GeocoderStatus.OK) {
@@ -198,5 +286,5 @@
 
         coordinates = { ADRESSE: jQuery("#match").val(),
-                        LAT:0,LON:0,ZOOM: 18 
+                        LAT:0,LON:0,ZOOM: 18 ,ALT:0
                        };
         codeAddress();
@@ -212,5 +300,5 @@
         if (Code != 13) return true;
         coordinates = { ADRESSE: jQuery("#match").val(),
-                        LAT:0,LON:0,ZOOM: 18 
+            LAT: 0, LON: 0, ZOOM: 18, ALT: 0
                        };
         codeAddress();
@@ -221,2 +309,63 @@
 });
 
+
+
+
+  // DECIMAL TO FRACTION
+  //
+  function dec2frac( valeur_decimal ) {
+     decimal = valeur_decimal.toString() ;
+      num = '';
+      den = 1;
+      dec = false;
+
+      // find least reduced fractional form of number
+      for( i = 0, ix =   decimal.length  ; i < ix; i++ )
+      {
+      // build the denominator as we 'shift' the decimal to the right
+      if( dec ) den *= 10;
+
+      // find the decimal place/ build the numberator
+      if( decimal.charAt(i) == '.' ) dec = true;
+      else num += decimal.charAt(i);
+      }
+      num = parseInt(num);
+  
+      // whole number, just return it
+      if( den == 1 ) return num;
+
+      num2 = num;
+      den2 = den;
+      rem  = 1;
+      // Euclid's Algorithm (to find the gcd)
+      while( num2 % den2 ) {
+      rem = num2 % den2;
+      num2 = den2;
+      den2 = rem;
+      }
+      if( den2 != den ) rem = den2;
+      ret1 = { Numerator: (num / rem), Denominator: (den / rem) };
+      // new Array()
+    // ret1->Numerator =(num / rem ) ;
+    // ret1->Denominator=(den / rem);
+
+      // now $rem holds the gcd of the numerator and denominator of our fraction
+      return ret1;
+      
+  }
+
+function dec2dms(l) {
+    sign = 1;
+    if (l < 0) { sign = -1; }
+    l = Math.abs(Math.round(l * 1000000.))
+    d = Math.floor(l / 1000000) * sign;
+    m = Math.floor(((l / 1000000) - Math.floor(l / 1000000)) * 60);
+    s = Math.floor(((((l / 1000000) - Math.floor(l / 1000000)) * 60) - Math.floor(((l / 1000000) - Math.floor(l / 1000000)) * 60)) * 100000) * 60 / 100000;
+    frac_s = dec2frac(s);
+    s2 = (frac_s.Numerator / frac_s.Denominator);
+    return { dms: d + "° " + m + "' " + s + "''",
+        Degre:d, Minute:m,Sec:s,
+        Numerator: frac_s.Numerator,
+        Denominator:frac_s.Denominator};
+}
+
