commit 7f9aab46527fc167ca5e3e4de05fa21fdad8f6c6
Author: Victor Pongnian <marc.souviron@vous-et-nous.com>
Date:   Thu Aug 22 17:41:56 2013 +0200

    Version réaliée pour la sage de Victor Pongnian

diff --git a/class/index.php b/class/index.php
old mode 100644
new mode 100755
diff --git a/class/site_point.class.php b/class/site_point.class.php
old mode 100644
new mode 100755
index 7e3a5e5..1a5de01
--- a/class/site_point.class.php
+++ b/class/site_point.class.php
@@ -9,9 +9,12 @@ class site_point {
   public function __construct($dir) {
     $this->base_dir = $dir;
     $dir_fd = opendir($this->base_dir);
+  
     while (false !== ($file = readdir($dir_fd))) {
+    	
        if (preg_match('/(.*)_[0-9]+_[0-9]+_[0-9]+\.jpg$/', $file, $reg)) {
 	 $this->prefix = $reg[1];
+	 
 	 break;
        }
     }
@@ -20,7 +23,7 @@ class site_point {
     $pfname = $this->base_dir.'/'.$this->prefix.'.params';
     if (is_file($pfname)) {
       $this->params = @parse_ini_file($pfname);
-    }
+    } 
   }
   
   public function get_params() {
@@ -65,20 +68,20 @@ class site_point {
     $lon2 = $lon * M_PI/180;
 
     $dLat = $lat2-$lat1;
-    $dLon = $lon2-$lon1;
+    $dLon = $lon2-$lon1; 
     
-    $a = sin($dLat/2) * sin($dLat/2) + sin($dLon/2) * sin($dLon/2) * cos($lat1) * cos($lat2); 
+    $a = sin($dLat/2) * sin($dLat/2) + sin($dLon/2) * sin($dLon/2) * cos($lat1) * cos($lat2);  // 
     $angle = 2 * atan2(sqrt($a), sqrt(1-$a));
     $d = $angle * $rt;                    // distance du point en Kms
     
     $y = sin($dLon)*cos($lat2);
     $x = cos($lat1)*sin($lat2) - sin($lat1)*cos($lat2)*cos($dLon);
     $cap = atan2($y, $x);                 // cap pour atteindre le point en radians
-
+    
     $e = atan2(($alt2 - $alt1)/1000 - $d*$d/(2*$rt), $d);  // angle de l'élévation en radians
     //    printf("%s, %s, %s, %s\n",$lat1, $this->params['latitude'], $lat, $dLat);
-
-    return array($d, $cap*180/M_PI, $e*180/M_PI);   // les résultats sont en degrés
+	
+    return array($d, $cap*180/M_PI, $e*180/M_PI, $rapport);   // les résultats sont en degrés
   }
   
 }
diff --git a/class/sites_dir.class.php b/class/sites_dir.class.php
old mode 100644
new mode 100755
index 9e732f0..1f5e2a9
--- a/class/sites_dir.class.php
+++ b/class/sites_dir.class.php
@@ -4,10 +4,19 @@ class sites_dir {
 
   public function __construct($dir) {
     $this->base_dir = $dir;
-  }
+    }
   
   public function get_sites() {
-    $dir_fd = opendir($this->base_dir);
+	try
+	{
+	    $dir_fd = opendir($this->base_dir);
+	}
+	catch(Exception $e)
+	{
+		die('Erreur : '.$e->getMessage());
+	}
+	     
+ 
     $point_list = array();
     while (false !== ($point_dir = readdir($dir_fd))) {
       $pt = new site_point($this->base_dir.'/'.$point_dir);
@@ -15,5 +24,9 @@ class sites_dir {
     }
     return $point_list;
   }
+  
+  public function get_dir() {
+  	return $this->base_dir;
+  }
 
 }
diff --git a/css/all.css b/css/all.css
old mode 100644
new mode 100755
index a3a6706..92a473e
--- a/css/all.css
+++ b/css/all.css
@@ -41,8 +41,14 @@ legend {
     border:solid #F00 1px;
     border-radius:0.5em;
     padding:0 1em;
+    text-shadow:2px 2px 2px #000, -2px -2px 2px #000;
 }      
 
+legend:hover {
+    color:#FF0;
+    cursor:default;
+}
+
 fieldset#control {
     text-shadow:2px 2px 2px #000, -2px -2px 2px #000;
     color:#FFF;
@@ -59,13 +65,19 @@ fieldset#control {
 input {
     vertical-align:middle;
 }
+
+
 input[type="number"] {
     border-radius:1em;
     display:block;
     float:right;
 }
 
-#res>:not(ul), #control, #params, #info {
+#locadraw input[type="number"] {
+    width:10ex;
+}
+
+#res>:not(ul), #control, #params, #info ,#addParams ,#adding, #loca{
     user-select:none;
     -khtml-user-select:none;
     -o-user-select:none;
@@ -74,7 +86,7 @@ input[type="number"] {
 }
 
 div#params {
-    padding:0.2em 0.5em;
+    padding:0.2em 1.3em;
     border-radius:0.5em;
     background-color:rgba(128,128,128,0.5);
     border:solid #00F 1px;
@@ -85,6 +97,7 @@ div#params {
 }
 
 div#params em {
+	
     display:block;
     float:right;
     background-color:#88F;
@@ -97,6 +110,141 @@ div#params em:nth-child[2] {
     display:inline;
 }
 
+span#loca{
+	text-shadow:2px 2px 2px #000, -2px -2px 2px #000;
+    color:#FFF;
+    float:left;
+    position:absolute;
+    bottom:1em;
+    left:1em;
+    cursor:pointer;
+    padding:0.2em 0.5em;
+    padding:0 1em; 
+}
+
+
+div#addParams  {
+	text-shadow:2px 2px 2px #000, -2px -2px 2px #000;
+    color:#FFF;
+    float:left;
+    position:absolute;
+    top:1em;
+    right:2em;
+    
+    border:solid #F00 1px;
+    border-radius:0.5em;
+    padding:0.2em 0.5em;
+    background-color:#F88; 
+    padding:0 1em; 
+   
+}
+
+div#addParams label {
+        
+    border-radius:0.5em;
+    padding:0 1em;
+}
+
+div#addParams label:hover {
+	 color: #FF0; 
+     
+}
+
+fieldset#locadraw {
+    
+    color:#FFF;
+    float:left;
+    position:absolute;
+    bottom:1em;
+    left:1em;
+    background-color:rgba(128,128,128,0.5);
+    border:solid #F00 1px;
+    border-radius:0.5em;
+    padding:0 1em;
+    visibility:hidden;
+}
+
+fieldset#adding {
+    
+    color:#FFF;
+    float:left;
+    position:absolute;
+    top:1em;
+    right:2em;
+    background-color:rgba(128,128,128,0.5);
+    border:solid #F00 1px;
+    border-radius:0.5em;
+    padding:0 1em;
+    visibility: hidden;
+}
+
+
+
+form#form_param label {
+	
+    margin-right: 15px;
+    width: 0.5em;
+    padding:0.3em 0.5em;
+    min-height: 1px;
+    text-align: left;
+    text-shadow:2px 2px 2px #000, -2px -2px 2px #000;
+}
+ 
+
+input:focus {
+  border-color: rgba(82, 168, 236, 0.75);
+  -moz-box-shadow: 0 0 8px rgba(82, 168, 236, 0.5);
+  -webkit-box-shadow: 0 0 8px rgba(82, 168, 236, 0.5);
+  box-shadow: 0 0 8px rgba(82, 168, 236, 0.5);
+}
+ 
+.correct {
+  border-color: rgba(68, 191, 68, 0.75);
+}
+ 
+.correct:focus {
+  border-color: rgba(68, 191, 68, 0.75);
+  -moz-box-shadow: 0 0 8px rgba(68, 191, 68, 0.5);
+  -webkit-box-shadow: 0 0 8px rgba(68, 191, 68, 0.5);
+  box-shadow: 0 0 8px rgba(68, 191, 68, 0.5);
+}
+ 
+.incorrect {
+  border-color: rgba(191, 68, 68, 0.75);
+}
+ 
+.incorrect:focus {
+  border-color: rgba(191, 68, 68, 0.75);
+  -moz-box-shadow: 0 0 8px rgba(191, 68, 68, 0.5);
+  -webkit-box-shadow: 0 0 8px rgba(191, 68, 68, 0.5);
+  box-shadow: 0 0 8px rgba(191, 68, 68, 0.5);
+} 
+
+/*p#chsignInfo {
+color:#F00;
+font-size: 12px;
+margin:1.02em 1em;
+background-color: #CCC;
+border-radius: 4px;
+padding:2px;
+}*/
+
+.answer {
+  margin:0.2em 0;
+  display:block;
+}
+
+.answer input {
+  border-radius:0.5rem;
+  padding:0.2em 0.7em;
+}
+
+.form_button {
+    background-color:rgba(128,128,128,0.9);
+    /*background: url(button.png) no-repeat top;*/
+    display:inline-block;
+}
+
 .validators {
     text-align:center;
     background-color:#CCC;
diff --git a/images/tsf.ico b/images/tsf.ico
deleted file mode 100644
index 537417b..0000000
Binary files a/images/tsf.ico and /dev/null differ
diff --git a/index.php b/index.php
old mode 100644
new mode 100755
index d222849..c4c63ef
--- a/index.php
+++ b/index.php
@@ -3,34 +3,54 @@
 <head>
   <meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
   <title>Liste des panoramas</title>
-  <link rel="stylesheet" media="screen" href="css/all.css" />
+  <link rel="stylesheet" media="screen" href="css/index_style.css" />
   <script src="js/pano.js"></script>
 </head>
 <body>
-  <h1>Liste des panoramas</h1>   
-  <?php
-   require 'class/site_point.class.php';
-   require 'class/sites_dir.class.php';
-   echo '<ul>';
-   if(isset($_GET['dir']) && is_dir($_GET['dir'])) {
-     $base_dir = $_GET['dir'];
-   } else {
-     $base_dir = 'tiles';
-   }
-
-   $dir = new sites_dir($base_dir);
-
-   foreach($dir->get_sites() as $pt) {
-     $params = $pt->get_params();
-     if (isset($params['titre'])) {
-       $cmt = $params['titre'];
-     } else {
-       $cmt = sprintf('fichier <samp>%s/%s</samp>', $pt->get_name(), $pt->get_prefix());
-     }
-     printf ('<li><a href="panorama.php?dir=%s&amp;panorama=%s">%s</a></li>'."\n", $base_dir, $pt->get_name(), $cmt);
-   }
-   echo '</ul>';
-  ?>
+	<img id="top" src="images/top.png" alt="">
+	<div id="index_container">
+		<h1><img src="images/tetaneutral.png" /></h1>
+	  	<h2>Liste des panoramas</h2>
+		   <?php
+		  
+		   require 'class/site_point.class.php';
+		   require 'class/sites_dir.class.php';
+		   
+		   echo '<div id="containerList">';
+		   echo '<ul>';
+		 
+		   if(isset($_GET['dir']) && is_dir($_GET['dir'])) {
+		     $base_dir = $_GET['dir']; 
+		   } else {
+		    $base_dir='tiles';
+		   }
+		   
+		   $dir = new sites_dir($base_dir);
+		 
+		   
+		   foreach($dir->get_sites() as $pt) {
+		   
+		     $params = $pt->get_params();
+		     if (isset($params['titre'])) {
+		       $cmt = $params['titre'];
+		      
+		     } else {
+		       $cmt = sprintf('fichier <samp>%s/%s</samp>', $pt->get_name(), $pt->get_prefix());
+		     }
+		     
+		     printf ('<li><a href="panorama.php?dir=%s&amp;panorama=%s">%s</a></li>'."\n", $base_dir, $pt->get_name(), $cmt);
+		   }
+		   ?>
+		</div>
+	</div>
+   <div id="interaction">
+   
+   <li><a href="./envoyer.php" title="Envoyer une image sur le site">Ajouter un panorama</a></li>
+   <li><a href="./creerPano.php" title="Générer un panorama à partir d\'une image déjà envoyée">Générer un panorama</a></li>
+ 
+   </div>
+   </ul>
+ <img id="bottom" src="images/bottom.png" alt="">
   <p><a href="http://validator.w3.org/check?uri=referer">page xHTML validé !</a></p>
 </body>
 </html>
diff --git a/js/pano.js b/js/pano.js
old mode 100644
new mode 100755
index d4c40fd..38ec503
--- a/js/pano.js
+++ b/js/pano.js
@@ -1,4 +1,4 @@
-if (img_prefix == undefined) var img_prefix = './tiles/ttn_mediatheque/mediatheque_70';
+if (img_prefix == undefined) var img_prefix = 'http://pano.tetaneutral.net/data/tsf2/vpongnian/tiles/ttn_mediatheque/mediatheque_70';
 if (to_cap == undefined) var to_cap = 0;
 if (to_ele == undefined) var to_ele = 0;
 if (to_zoom == undefined) var to_zoom = 0;
@@ -8,6 +8,7 @@ if (cap_max == undefined) var cap_max = cap_min+360;
 if (ref_points == undefined) var ref_points = new Array();
 if (image_loop == undefined) var image_loop = true;
 
+
 var debug_mode = false;
 var canvas;
 var cntext;
@@ -31,9 +32,11 @@ var is_located = false;
 var point_colors = {'pano_point' : '255,128,128',
 		    'ref_point'  : '128,128,255',
 		    'loc_point'  : '128,255,128',
+		    'temporary'  : '255,255,128',
 		    'unlocated'  : '255,255,255'};
 var test = {x:0, y:0, i:100};
 
+
 function nmodulo(val, div) {                // pour obtenir un modulo dans l'espace des nombres naturels N.
     return Math.floor((val%div+div)%div);   // il y a peut être plus simple, mais en attendant .... 
 }
@@ -165,6 +168,83 @@ function drawDecorations(ox, oy, tx, ty, twidth, theight) {
     if (twidth) {
 	cntext.restore();
     }
+    
+}
+
+function insert_drawn_point(lat,lon,alt) {
+	
+	var rt = 6371;  // Rayon de la terre
+    var alt1 = document.getElementById('pos_alt').childNodes[0].nodeValue;
+    var lat1 = document.getElementById('pos_lat').childNodes[0].nodeValue*Math.PI/180;
+    var lon1 = document.getElementById('pos_lon').childNodes[0].nodeValue*Math.PI/180;
+    var alt2 = alt;
+    var lat2 = lat*Math.PI/180;
+    var lon2 = lon*Math.PI/180;
+    
+    var dLat = lat2-lat1;
+    var dLon = lon2-lon1; 
+   
+    var a = Math.sin(dLat/2)*Math.sin(dLat/2) + Math.sin(dLon/2)*Math.sin(dLon/2)*Math.cos(lat1)*Math.cos(lat2);  // 
+    var angle = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
+    var d = angle*rt;                    // distance du point en Kms
+   
+    var y = Math.sin(dLon) * Math.cos(lat2);
+    var x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon);
+    var cap = Math.atan2(y,x);                 // cap pour atteindre le point en radians
+    var e = Math.atan2((alt2 - alt1)/1000 - d*d/(2*rt),d);  // angle de l'élévation en radians
+    
+    return {d:d, cap:cap*180/Math.PI, ele:e*180/Math.PI};   // les résultats sont en degrés
+}
+
+localate_point = function () {
+	
+    var lat = document.getElementById("loca_latitude").value;
+    var lon = document.getElementById("loca_longitude").value;
+    var alt = document.getElementById("loca_altitude").value;
+    if (lat == '' || isNaN(lat) || lat <= -90 || lat > 90) {
+	alert("La latitude "+lat+"n'est pas correcte");
+	return;
+    }
+    if (lat == '' || isNaN(lon) || lon <= -180 || lon > 180) {
+	alert("La longitude "+lon+"n'est pas correcte");
+	return;
+    }
+    if (lat == '' || isNaN(alt) || alt < -400) {
+	alert("l'altitude "+alt+"n'est pas correcte");
+	return;
+    }
+	    var opt_ced = new Array();
+	    opt_dce = insert_drawn_point(lat,lon,alt);
+	    // -----Première solution : afficher dynamiquement le point !
+	    var d = opt_dce.d;
+	    var cap = opt_dce.cap;
+	    var ele = opt_dce.ele;
+	    
+	    display_temp(d, cap, ele);
+	   
+}
+
+function display_temp(d,cap,ele) {
+   
+    point_list[point_list.length] = new Array("point temporaire", d,cap,ele, "temporary");
+    reset_zooms();
+    putImage(last.x, last.y);
+}
+
+function arrayUnset(array, value){
+    array.splice(array.indexOf(value), 1);
+}
+
+erase_point = function() {
+	
+	for (var i=0; i<point_list.length; i++) {
+		if(point_list[i][0] == "point temporaire"){
+			arrayUnset(point_list,point_list[i]);
+			loop = erase_point();
+		}	
+	}	
+	reset_zooms();
+    putImage(last.x, last.y);   
 }
 
 function get_file_name(x, y, z) { // recherche du fichier correspondant au zoom et à la position
@@ -181,10 +261,11 @@ function get_file_name(x, y, z) { // recherche du fichier correspondant au zoom
 }
 
 function keys(key) {
+	
     hide_links();
     evt = key || event;
-    evt.preventDefault();
-    evt.stopPropagation();
+    //evt.preventDefault();
+    //evt.stopPropagation();
     if (!key) {
 	key = window.event;
 	key.which = key.keyCode;
@@ -192,7 +273,7 @@ function keys(key) {
 //    alert(key);
 //    if (!evt.shiftKey) return;
     switch (key.which) {
-    case 66: // b
+    /*case 66: // b
 	alert(key.pageX);
 	test.x=tile.width*(ntiles.x-3);
 	test.y=0;
@@ -202,7 +283,7 @@ function keys(key) {
 	test.x=0;
 	test.y=tile.height*(ntiles.y-3);
 	putImage(test.x, test.y);
-	return;
+	return;*/
     case 36: // home
 	putImage(0, zm.im.height/2);
 	return;
@@ -440,12 +521,15 @@ function tzoom(zv) {
 	    if (ref_points[lbl] != undefined) {
 		typ = 'ref_point';
 		if (!is_located) rxy = {x:ref_points[lbl].x*this.im.width, y:ref_points[lbl].y*this.im.height}
-	    } else if(lnk == '' && is_visible) {
+	    } else if(lnk == '' && is_visible && lbl != 'point temporaire') {
 		typ = 'loc_point';
+	    }else if(is_visible && lbl =='point temporaire') {
+	    typ = 'temporary';
+	    
 	    } else if(is_visible) {
 		typ = 'pano_point';
 		lnk += '&to_zoom='+this.value;
-	    }
+	    } 
 	    this.pt_list[i]['type'] = typ;
 	    this.pt_list[i]['cap'] = cap;
 	    this.pt_list[i]['ele'] = ele;
@@ -700,6 +784,8 @@ function clean_canvas_events(e) {
     speed.y = 0;
 }
 
+
+
 canvas_set_size = function() {
     canvas.style.border = border_width+"px solid red";
     canvas.width = window.innerWidth-2*border_width;
@@ -713,7 +799,41 @@ canvas_resize = function() {
     putImage(last.x, last.y);
 }
 
+
+
+function paramIn(e) {
+	
+	 e = e || window.event; 
+	 var relatedTarget = e.relatedTarget || e.fromElement; 
+	 
+	 while (relatedTarget != adding && relatedTarget.nodeName != 'BODY' && relatedTarget != document && relatedTarget != localisation) {
+	        relatedTarget = relatedTarget.parentNode;
+	 }
+	 
+	 if (relatedTarget != adding && relatedTarget != localisation) {
+		 document.removeEventListener('keydown', keys, false);
+	 }
+}
+
+function paramOut(e) {
+	 
+    e = e || window.event; 
+    var relatedTarget = e.relatedTarget || e.toElement; 
+ 
+    while (relatedTarget != adding && relatedTarget.nodeName != 'BODY' && relatedTarget != document && relatedTarget != localisation) {
+        relatedTarget = relatedTarget.parentNode;
+    }
+ 
+    if (relatedTarget != adding && relatedTarget != localisation) {
+    	document.addEventListener('keydown', keys, false);
+    }
+ 
+}
+
 window.onload = function() {
+	
+	localisation = document.getElementById("locadraw");
+	adding = document.getElementById("adding");
     canvas = document.getElementById("mon-canvas");
     cntext = canvas.getContext("2d");
     canvas_set_size();
@@ -746,9 +866,17 @@ window.onload = function() {
     elvtn_control.onclick = change_angle;
 
     change_angle();
-
+    loca_temp = document.getElementById("loca_button");
+    loca_temp.onclick = localate_point;
+    loca_erase = document.getElementById("loca_erase");
+    loca_erase.onclick = erase_point;
     canvas.addEventListener('mousedown', onImageClick, false);
-    addEventListener('keydown', keys, false);
+    document.addEventListener('keydown', keys, false);
     canvas.addEventListener('mousewheel', wheel_zoom, false);
     window.onresize = canvas_resize;
+    adding.addEventListener('mouseover',paramIn,false);
+    adding.addEventListener('mouseout',paramOut,false);
+    localisation.addEventListener('mouseover',paramIn,false);
+    localisation.addEventListener('mouseout',paramOut,false);
+      
 };
diff --git a/js/pano_array.js b/js/pano_array.js
deleted file mode 100644
index b0e50a2..0000000
--- a/js/pano_array.js
+++ /dev/null
@@ -1,604 +0,0 @@
-if (img_prefix == undefined) var img_prefix = './tiles/ttn_mediatheque/mediatheque_70';
-if (to_cap == undefined) var to_cap = 0;
-if (to_ele == undefined) var to_ele = 0;
-if (cap == undefined) var cap = 0;
-if (elevation == undefined) var elevation = 0;
-if (cap_min == undefined) var cap_min = cap;
-if (cap_max == undefined) var cap_max = cap_min+360;
-if (ref_points == undefined) var ref_points = new Array();
-if (image_loop == undefined) var image_loop = true;
-
-var canvas;
-var cntext;
-var point_list = new Array();
-var zoom;
-var to_zoom;
-var zooms = new Array();
-var prev_zm;
-var zm;
-var tile = {width:256, height:256};
-var ntiles = {x:228, y:9};
-var border_width = 5;
-var imageObj = new Array();
-
-var last  = {x:0,y:0};
-var shift = {x:0,y:0};
-var mouse = {x:0,y:0};
-var speed = {x:0,y:0};
-var canvas_pos = {x:0,y:0};
-var tmt;
-
-var test = {x:0, y:0, i:100};
-
-function nmodulo(val, div) {                // pour obtenir un modulo dans l'espace des nombres naturels N.
-    return Math.floor((val%div+div)%div);   // il y a peut être plus simple, mais en attendant .... 
-}
-
-function fmodulo(val, div) {                // pour obtenir un modulo dans l'espace des nombres réels positifs.
-    return (val%div+div)%div;               // il y a peut être plus simple, mais en attendant .... 
-}
-
-function distort_canvas(p, x, y) {
-    if (p == 0) distort = 0;
-    else {
-	cntext.save();
-	distort++;
-        cntext.clearRect(0, 0, canvas.width, 2*canvas.height);
-	var ratio = (canvas.width-2*distort)/canvas.width;
-	var shift = canvas.height/2*(1-ratio);
-	cntext.scale(1, ratio);
-	if (p == 1) cntext.translate(0, 0);
-	else if (p == -1) cntext.translate(0, 0);
-	draw_image(x, y);
-	cntext.restore();
-	document.getElementById('res').innerHTML = 'distort : ' + distort + ' shift ' + shift + ' ratio : ' + ratio + '<br/>';
-    }
-}
-
-function draw_image(ox, oy) {
-    ox = nmodulo(ox-canvas.width/2, zm.im.width);        // pour placer l'origine au centre du canvas 
-    oy = Math.floor(oy-canvas.height/2);                             // pas de rebouclage vertical
-
-    cntext.clearRect(0, 0, canvas.width, canvas.height);
-    cntext.fillStyle = "rgba(128,128,128,0.8)";
-    
-    if (canvas.height > zm.im.height) {
-	var fy = Math.floor((oy+canvas.height/2-zm.im.height/2)/(tile.height*zm.ntiles.y))*zm.ntiles.y;
-	if (fy < 0) fy = 0; 
-	var ly = fy + zm.ntiles.y;
-    } else {
-	var fy = Math.floor(oy/tile.height);
-	var ly = Math.floor((oy+canvas.height+tile.height-1)/tile.height+1);
-	if (fy < 0) fy = 0; 
-	if (ly > zm.ntiles.y) ly = zm.ntiles.y; 
-    }
-
-    for (var j=fy; j<ly; j++) {
-	var delta_y = (Math.floor(j/zm.ntiles.y) - Math.floor(fy/zm.ntiles.y)) * (tile.height - zm.last_tile.height);
-	var dy = j*tile.height - oy - delta_y;
-	var ny = j%ntiles.y;
-	var wy = zm.tile.width;
-	if (ny == zm.ntiles.y - 1) wy = zm.last_tile.height;
-
-	var cpx = 0;
-	var i = 0;
-	var Nx = zm.ntiles.x;
-	while (cpx < ox+canvas.width) {
-	    var cur_width = zm.tile.width;
-	    if (i%Nx == zm.ntiles.x-1) cur_width = zm.last_tile.width;
-	    if (cpx >= ox-cur_width) {
-		var nx = i%Nx;
-		load_image(nx, ny, cpx-ox, dy, ox, oy);
-	    }
-	    cpx += cur_width;
-	    i++;
-	}
-    }
-    drawDecorations(ox, oy);
-}
-
-function load_image(nx, ny, ox, oy, x, y) {
-    var idx = nx+'-'+ny+'-'+zoom;
-    if (imageObj[idx] && imageObj[idx].complete) {
-	draw_tile(idx, ox, oy); // l'image est déja en mémoire, on force le dessin sans attendre.
-    } else {
-	var fname = get_file_name(nx, ny, zoom);
-	imageObj[idx] = new Image();
-	imageObj[idx].src = fname;
-	var ts = zm.get_tile_size(nx, ny);
-	cntext.fillRect(ox, oy, ts.width, ts.height);
-	var dx = shift.x;
-	var dy = shift.y;
-	imageObj[idx].addEventListener('load', function() {draw_tile_del(zoom, dx, dy, idx, ox, oy, x, y)}, false);
-    }
-}
-
-function draw_tile_del(ezoom, dx, dy, idx, ox, oy, x, y) {
-    if (ezoom == zoom && dx == shift.x && dy == shift.y) {
-	draw_tile(idx, ox, oy);
-	drawDecorations(x, y);
-    }
-}
-
-function draw_tile(idx, ox, oy) {
-    var img = imageObj[idx];
-    cntext.drawImage(img, ox, oy);
-}
-
-function drawDecorations(ox, oy) {
-    var wgrd = zm.im.width/360;
-    var od = ((ox+canvas.width/2)/wgrd)%360;
-    var el = (zm.im.height/2 - (oy+canvas.height/2))/wgrd;
-//    document.getElementById('angle_ctrl').value = od.toFixed(2);
-//    document.getElementById('elvtn_ctrl').value = el.toFixed(2);
-    cntext.fillStyle = "rgba(0,128,128,0.9)";
-    cntext.strokeStyle = "rgb(255,255,255)";
-    cntext.lineWidth = 1;
-    cntext.fillRect(canvas.width/2-5, canvas.height/2-5, 10, 10);
-    cntext.strokeRect(canvas.width/2-5, canvas.height/2-5, 10, 10);
-    document.getElementById('res').innerHTML = '';
-    for(var i = 0; i < zm.pt_list.length; i++) {
-	var cx = nmodulo(zm.pt_list[i]['xc'] - ox, zm.im.width);
-	var cy = zm.pt_list[i]['yc'] - oy;
-	if (zm.pt_list[i]['lnk'] != undefined) cntext.fillStyle = "rgba(255,128,128,0.5)";
-	else cntext.fillStyle = "rgba(128,255,128,0.5)";
-	cntext.beginPath();
-	cntext.arc(cx, cy, 20, 0, 2*Math.PI, true);
-	cntext.fill();
-	document.getElementById('res').innerHTML += 'cx : ' + cx + ' cy ' + cy + ' lnk : ' + zm.pt_list[i]['lnk'] + '<br/>';
-    }
-
-    //cntext.font = "20pt Arial";
-    //cntext.fillRect(0, 0, 200, 20);
-    //cntext.fillStyle = "rgb(255,0,0)";
-    //cntext.fillText(od.toFixed(2), 5, 20);
-    //for (i=0; i<canvas.width/wgrd; i++) {
-	//cntext.strokeRect(i*wgrd, 0, wgrd, 20);
-    //}
-}
-
-function get_file_name(x, y, z) { // recherche du fichier correspondant au zoom et à la position
-    var prm = [z, x, y];
-    var fname = img_prefix;
-    for (var i = 0; i < prm.length; i++) {
-	fname += '_';
-	if (prm[i] < 10) fname += '00';
-	else if (prm[i] < 100) fname += '0';
-	fname += prm[i];
-    }
-    fname += '.jpg';
-    return fname;
-}
-
-function keys(key) {
-    event.preventDefault();
-    event.stopPropagation();
-    if (!key) {
-	key = event;
-	key.which = key.keyCode;
-    }
-    evt = key || event;
-//    alert(key);
-//    if (!evt.shiftKey) return;
-    switch (key.which) {
-    case 36: // home
-	test.x=0;
-	test.y=0;
-	putImage(test.x, test.y);
-	return;
-    case 66: // b
-	alert(key.pageX);
-	test.x=tile.width*(ntiles.x-3);
-	test.y=0;
-	putImage(test.x, test.y);
-	return;
-    case 67: // c
-	test.x=0;
-	test.y=tile.height*(ntiles.y-3);
-	putImage(test.x, test.y);
-	return;
-    case 35: // end
-	test.x=tile.width*(ntiles.x-3);
-	test.y=tile.height*(ntiles.y-3);
-	putImage(test.x, test.y);
-	return;
-    case 39: // left
-	test.x+=test.i;
-	putImage(test.x, test.y);
-	return;
-    case 40: // up
-	test.y+=test.i;
-	putImage(test.x, test.y);
-	return;
-    case 37: // right
-	test.x-=test.i;
-	putImage(test.x, test.y);
-	return;
-    case 38: // down
-	test.y-=test.i;
-	putImage(test.x, test.y);
-	return;
-    case 33: // pageup
-	test.y=0;
-	putImage(test.x, test.y);
-	return;
-    case 34: // pagedown
-	test.y=tile.height*(ntiles.y-3);
-	putImage(test.x, test.y);
-	return;
-    default:
-	//alert(key.which)
-	return;
-    }
-}
-
-function onImageClick(e) {
-    shift.x = last.x;
-    shift.y = last.y;
-    speed.x = 0;
-    speed.y = 0;
-    mouse.x = e.pageX;
-    mouse.y = e.pageY;
-    clearTimeout(tmt);  //arrêt de l'éffet eventuel d'amorti en cours.
-    canvas.addEventListener('mousemove', stickImage, false);
-    canvas.addEventListener('mouseup', launchImage, false);
-    //canvas.addEventListener('mouseout', launchImage, false);
-    canvas.style.cursor='move';
-    //document.onmousemove = stickImage;
-    document.onmouseup = launchImage;
-    hide_links();
-}
-
-
-function stickImage(e) {
-    var xs = mouse.x - e.pageX + shift.x;
-    var ys = mouse.y - e.pageY + shift.y;
-    speed.x = xs - last.x;  //mémorisation des vitesses horizontales
-    speed.y = ys - last.y;  //et verticales lors de ce déplacement
-    putImage(xs, ys);
-}
-
-function launchImage(e) {
-    distort_canvas(0);
-    canvas.removeEventListener('mousemove', stickImage, false);
-    show_links();
-    //document.onmousemove = null;
-    shift.x = e.pageX - mouse.x + shift.x;
-    shift.y = e.pageY - mouse.y + shift.y;
-    tmt = setTimeout(inertialImage, 100);
-}
-
-function putImage(x, y) { // est destiné à permettre l'effet d'amortissement par la mémorisation de la position courante.
-    if (!zm.is_updated) return; 
-    if (x >= zm.im.width) {   // rebouclage horizontal
-	shift.x -= zm.im.width;
-	x -= zm.im.width;
-    } else if (x < 0) {
-	shift.x += zm.im.width;
-	x += zm.im.width;
-    }
-    if (y >= zm.im.height) {   // pas de rebouclage vertical mais blocage
-	//distort_canvas(1, x, y);
-	shift.y = zm.im.height-1;
-	y = zm.im.height-1;
-    } else if (y < 0) {
-	//distort_canvas(-1, x, y);
-	shift.y = 0;
-	y = 0;
-    }
-
-    draw_image(x, y);
-    last.x = x;
-    last.y = y;
-}
-
-function inertialImage() {
-    speed.x *= 0.9;
-    speed.y *= 0.9;
-    if (Math.abs(speed.x) > 2 || Math.abs(speed.y) > 2) {
-	putImage(last.x+speed.x, last.y+speed.y);
-	tmt = setTimeout(inertialImage, 100);
-    }
-}
-
-function tri_ref_points(v1, v2) {
-    return v1['x'] - v2['x'];
-}
-
-
-
-function tzoom(zv) {
-    this.ref_pixels = new Array;
-    this.value = zv;
-    this.ntiles = {x:0,y:0};
-    this.tile = {width:0,height:0};
-    this.last_tile = {width:0,height:0};
-    this.max_tile = {width:0,height:0};
-    this.im = {width:0,height:0};
-    this.pt_list = new Array();
-    this.is_updated = false;
-
-    this.refresh = function() {
-	this.im.visible_width = this.tile.width*(this.ntiles.x-1)+this.last_tile.width;
-	this.is_updated = true;
-
-	this.im.width = this.im.visible_width;
-	this.im.height = this.tile.height*(this.ntiles.y-1)+this.last_tile.height;
-	if (this.last_tile.width > this.tile.width) this.max_tile.width = this.im.last_tile.width;
-	else this.max_tile.width = this.tile.width;
-	if (this.last_tile.height > this.tile.height) this.max_tile.height = this.im.last_tile.height;
-	else this.max_tile.height = this.tile.height;
-
-	this.ref_pixels[0] = new Array();    // Attention il faut compter un intervalle de plus !
-	ord_pts = new Array();
-	i=0;
-	for(var label in ref_points) {
-	    ord_pts[i] = ref_points[label]
-	}
-	ord_pts = ord_pts.sort(tri_ref_points);
-
-	for (var i=0; i < ord_pts.length; i++) {
-	    this.ref_pixels[i+1] = new Array();
-	    if (i != ord_pts.length-1) {
-		this.ref_pixels[i+1]['ratio_x'] = (ord_pts[i+1]['x'] - ord_pts[i]['x'])/fmodulo(ord_pts[i+1]['cap'] - ord_pts[i]['cap'], 360)*this.im.width;
-		this.ref_pixels[i+1]['ratio_y'] = (ord_pts[i+1]['y'] - ord_pts[i]['y'])/fmodulo(ord_pts[i+1]['ele'] - ord_pts[i]['ele'], 360);
-	    }
-	    this.ref_pixels[i+1]['x'] = Math.floor(ord_pts[i]['x']*this.im.width);
-	    this.ref_pixels[i+1]['cap'] = ord_pts[i]['cap'];
-	    this.ref_pixels[i+1]['y'] = Math.floor(ord_pts[i]['y']*this.im.height);
-	    this.ref_pixels[i+1]['ele'] = ord_pts[i]['ele'];
-	}
-	if (image_loop == true) {
-	    var dpix = this.im.width;
-	    var dangle = 360;
-	    if (ord_pts.length > 1) {
-		dpix = zm.im.width - this.ref_pixels[this.ref_pixels.length-1]['x'] + this.ref_pixels[1]['x'];
-		dangle = fmodulo(this.ref_pixels[1]['cap'] - this.ref_pixels[this.ref_pixels.length-1]['cap'], 360);
-	    }
-	    this.ref_pixels[0]['ratio_x'] = dpix/dangle;
-	    this.ref_pixels[ord_pts.length]['ratio_x'] = this.ref_pixels[0]['ratio_x'];
-	    this.ref_pixels[ord_pts.length]['ratio_y'] = this.ref_pixels[0]['ratio_y'];
-	    dpix = this.im.width - this.ref_pixels[ord_pts.length]['x'];
-	    this.ref_pixels[0]['cap'] = this.ref_pixels[ord_pts.length]['cap'] + dpix / this.ref_pixels[0]['ratio_x'];
-	} else {
-	    this.ref_pixels[0]['ratio_x'] = this.ref_pixels[1]['ratio_x'];
-	    this.ref_pixels[ord_pts.length]['ratio_x'] = this.ref_pixels[ord_pts.length-1]['ratio_x'];
-	    this.ref_pixels[0]['ratio_y'] = this.ref_pixels[1]['ratio_y'];
-	    this.ref_pixels[ord_pts.length]['ratio_y'] = this.ref_pixels[ord_pts.length-1]['ratio_y'];
-	    this.ref_pixels[0]['cap'] = this.ref_pixels[1]['cap'] - this.ref_pixels[1]['x'] / this.ref_pixels[1]['ratio_x'];
-	}
-	this.ref_pixels[0]['x'] = 0;
-	this.ref_pixels[0]['y'] = 0;
-	this.ref_pixels[0]['ele'] = 0;
-
-
-	for (var i=0; i<point_list.length; i++) {
-	    this.pt_list[i] = new Array();
-	    this.pt_list[i]['angle'] = point_list[i][2];
-	    this.pt_list[i]['label'] = point_list[i][0];
-	    this.pt_list[i]['xc'] = Math.floor(this.get_pxx(point_list[i][2], 360));
-//	    var tmp = fmodulo(point_list[i][2], 360);
-//	    this.pt_list[i]['xc'] = Math.floor(tmp * this.im.width/360);
-	    this.pt_list[i]['yc'] = Math.floor(this.im.height/2 - (point_list[i][3] + elevation) * this.im.width/360);
-	    if (point_list[i][4] != '') this.pt_list[i]['lnk'] = point_list[i][4]+'&to_zoom='+zv;
-	}
-    }
-    
-    this.get_tile_size = function(nx, ny) {
-	var res = {width:0, height:0};
-	if (nx == this.ntiles.x-1) res.width = this.last_tile.width;
-	else res.width = this.tile.width;
-	if (ny == this.ntiles.y-1) res.height = this.last_tile.height;
-	else res.height = this.tile.height;
-	return res;
-    }
-    
-    this.get_cap = function(px) {                         // recherche du cap à partir d'un pixel.
-	for (var i=0; i < this.ref_pixels.length; i++) {
-	    if (i == this.ref_pixels.length - 1 || px < this.ref_pixels[i+1]['x']) {
-		return fmodulo(this.ref_pixels[i]['cap']+(px-this.ref_pixels[i]['x'])/this.ref_pixels[i]['ratio_x'], 360);
-	    }
-	}
-    }
-    
-    this.get_pxx = function(cap) {                        // recherche du pixel à partir d'un cap.
-	var dcap = fmodulo(cap-this.ref_pixels[0]['cap'], 360);
-	for (var i=0; i < this.ref_pixels.length; i++) {
-	    if (i == this.ref_pixels.length - 1 || dcap < fmodulo(this.ref_pixels[i+1]['cap']-this.ref_pixels[0]['cap'], 360)) {
-		return this.ref_pixels[i]['x'] + this.ref_pixels[i]['ratio_x']*fmodulo(cap - this.ref_pixels[i]['cap'], 360);
-	    }
-	}
-    }
-}
-
-function wheel_zoom (event) {
-    var zshift = {x:0, y:0};
-    if (event.pageX != undefined && event.pageX != undefined) {
-	zshift.x = event.pageX-canvas.width/2-canvas_pos.x;
-	zshift.y = event.pageY-canvas.height/2-canvas_pos.y;
-    }
-    event.preventDefault();
-    if (event.wheelDelta < 0 && zoom_control.value < zoom_control.max) {
-	zoom_control.value++;
-	change_zoom(zshift.x, zshift.y);
-    } else if (event.wheelDelta > 0 && zoom_control.value > zoom_control.min) {
-	zoom_control.value--; 
-	change_zoom(zshift.x, zshift.y);
-    }
-}
-
-function change_zoom(shx, shy) {
-    var zoom_control = document.getElementById("zoom_ctrl");
-    var v = zoom_control.value;
-
-    prev_zm = zm;
-
-    if (zooms[v]) {
-	if (!zooms[v].is_updated) zooms[v].refresh();
-    } else {
-	zooms[v] = new tzoom(v);
-    }
-
-    if (zooms[v].is_updated) {
-	if (shx == undefined || shy == undefined) {
-	    shx=0;
-	    shy=0;
-	}
-	zm = zooms[v];
-	var px = (last.x+shx)*zm.im.width/prev_zm.im.width - shx;
-	var py = (last.y+shy)*zm.im.height/prev_zm.im.height - shy;
-	if (py < zm.im.height && py >= 0) {
-	    zoom = zm.value;
-	    tile = zm.tile;
-	    ntiles = zm.ntiles;
-	    putImage(px, py);
-	} else {
-	    zm = prev_zm;
-	    zoom_control.value = zm.value;
-	}
-    }
-}
-
-function change_angle() {
-    var elvtn_control = document.getElementById('elvtn_ctrl');
-    var angle_control = document.getElementById('angle_ctrl');
-    var pos_x = zm.im.width*angle_control.value/360;
-    var pos_y = Math.floor(zm.im.height/2 - zm.im.width*elvtn_control.value/360);
-    putImage(pos_x, pos_y);
-}
-
-function check_links(e) {
-    var mouse_x = e.pageX-canvas_pos.x;
-    var mouse_y = e.pageY-canvas_pos.y;
-    var pos_x = nmodulo(last.x + mouse_x - canvas.width/2, zm.im.width);
-    var pos_y = last.y + mouse_y - canvas.height/2;
-    for(var i = 0; i < zm.pt_list.length; i++) {
-	if (Math.sqrt((zm.pt_list[i]['xc'] - pos_x) * (zm.pt_list[i]['xc'] - pos_x) + (zm.pt_list[i]['yc'] - pos_y) * (zm.pt_list[i]['yc'] - pos_y)) < 20) {
-	    if (zm.pt_list[i]['lnk'] != undefined) window.location = zm.pt_list[i]['lnk'];
-	    break;
-	}
-    }
-}
-
-function display_links(e) {
-    var info = document.getElementById('info');
-    var mouse_x = e.pageX-canvas_pos.x;
-    var mouse_y = e.pageY-canvas_pos.y;
-    var pos_x = nmodulo(last.x + mouse_x - canvas.width/2, zm.im.width);
-    var pos_y = last.y + mouse_y - canvas.height/2;
-    //var cap = ((pos_x/zm.im.width)*360).toFixed(2);
-    var cap = zm.get_cap(pos_x).toFixed(2);
-    var elev = (((zm.im.height/2 - pos_y)/zm.im.width)*360 - elevation).toFixed(2);
-    info.innerHTML = 'élévation :'+elev+'<br/>cap :'+cap;
-    info.style.top = e.pageY+'px';
-    info.style.left = e.pageX+'px';
-    info.style.backgroundColor = '#FFC';
-    canvas.style.cursor='crosshair';
-    for(var i = 0; i < zm.pt_list.length; i++) {
-	if (Math.sqrt((zm.pt_list[i]['xc'] - pos_x) * (zm.pt_list[i]['xc'] - pos_x) + (zm.pt_list[i]['yc'] - pos_y) * (zm.pt_list[i]['yc'] - pos_y)) < 20) {
-	    info.innerHTML = zm.pt_list[i]['label'];
-	    info.style.backgroundColor = '#FC8';
-	    canvas.style.cursor='auto';
-	    break;
-	}
-    }
-}
-
-function hide_links() {
-    canvas.removeEventListener( "mousemove", display_links, false);
-    var info = document.getElementById('info');
-    info.style.display = 'none';
-}
-
-function show_links() {
-    canvas.addEventListener( "mousemove", display_links, false);
-    var info = document.getElementById('info');
-    info.style.display = 'block';
-}
-
-function show_insert_point(e) {
-    event.preventDefault();
-    event.stopPropagation();
-    var insrt = document.getElementById('insert');
-    document.getElementById('do-insert').onclick = function() {insert_point(insert, e.pageX-canvas_pos.x, e.pageY-canvas_pos.y)};
-    document.getElementById('do-cancel').onclick = function() {insert.style.display = 'none'};
-    insrt.style.left = e.pageX+'px';
-    insrt.style.top = e.pageY+'px';
-    insrt.style.display = 'block';
-}
-
-function insert_point(el, x, y) {
-    el.style.display = 'none';
-    for(var i = 0; i < zm.pt_list.length; i++) {
-	var label = zm.pt_list[i]['label'];
-	if(label == document.getElementById('sel_point').value) {
-	    var posx = nmodulo(last.x + x - canvas.width/2, zm.im.width)/zm.im.width;
-	    var posy = 0;
-	    var pval = {x:posx, cap:zm.pt_list[i]['angle'], y:posy, label:label};
-	    ref_points[label] = pval;
-	    document.getElementById('res').innerHTML += zm.pt_list[i]['label'] + '. ' + posx + '=' + zm.pt_list[i]['angle'] + '<br/>';
- 	    putImage(last.x, last.y);
-
-//	    if (ref_points.length > 1) {
-//		var pval0 = inserted_points[inserted_points.length-2];
-//		var origin = fmodulo(pval0.angle - ((pval.angle - pval0.angle)/(pval.ratio - pval0.ratio))*pval0.ratio, 360);
-//		var end = fmodulo(pval.angle + ((pval.angle - pval0.angle)/(pval.ratio - pval0.ratio))*(1-pval.ratio), 360);
-//		document.getElementById('res').innerHTML += 'cap_min = ' + origin + '<br/>';
-//		document.getElementById('res').innerHTML += 'cap_max = ' + end + '<br/>';
-//	    }
-	    break;
-	}
-    }
-}
-
-function clean_canvas_events(e) {
-    canvas.removeEventListener('mousemove', stickImage, false);
-    document.getElementById('info').style.display = 'none';
-    speed.x = 0;
-    speed.y = 0;
-}
-
-window.onload = function() {
-    canvas = document.getElementById("mon-canvas");
-    canvas.style.border = border_width+"px solid red";
-    cntext = canvas.getContext("2d");
-    canvas.width = window.innerWidth-200;
-    canvas.height = window.innerHeight-20;
-    canvas.addEventListener("click", check_links, false);
-    canvas_pos.x = canvas.offsetLeft+border_width;
-    canvas_pos.y = canvas.offsetTop+border_width;
-    canvas.addEventListener("contextmenu", show_insert_point, false);
-    canvas.addEventListener("mouseout", clean_canvas_events, false);
-
-    show_links();
-
-    var max_zoom = zooms.length - 1;
-    zoom_control = document.getElementById("zoom_ctrl");
-    zoom_control.onchange = change_zoom;
-    zoom_control.max = max_zoom;
-    if (to_zoom == undefined || to_zoom > max_zoom) to_zoom = Math.floor(max_zoom/2);
-    zm = zooms[to_zoom];
-    zoom_control.value = to_zoom;
-    zm.refresh();
-
-    zoom = zm.value;
-    tile = zm.tile;
-    ntiles = zm.ntiles;
-
-    angle_control = document.getElementById("angle_ctrl");
-    angle_control.value = to_cap;
-    angle_control.onchange = change_angle;
-    angle_control.onclick = change_angle;
-    angle_control.onkeyup = change_angle;
-    elvtn_control = document.getElementById("elvtn_ctrl");
-    elvtn_control.value = to_ele+elevation;
-    elvtn_control.onchange = change_angle;
-    elvtn_control.onclick = change_angle;
-    elvtn_control.onkeyup = change_angle;
-
-    change_angle();
-
-    canvas.addEventListener('mousedown', onImageClick, false);
-    addEventListener('keyup', keys, false);
-    canvas.addEventListener('mousewheel', wheel_zoom, false);
-};
diff --git a/js/pano_old.js b/js/pano_old.js
deleted file mode 100644
index 6061d58..0000000
--- a/js/pano_old.js
+++ /dev/null
@@ -1,539 +0,0 @@
-if (img_prefix == undefined) var img_prefix = './tiles/ttn_mediatheque/mediatheque_70';
-if (to_cap == undefined) var to_cap = 0;
-if (to_ele == undefined) var to_ele = 0;
-if (cap == undefined) var cap = 0;
-if (elevation == undefined) var elevation = 0;
-if (cap_min == undefined) var cap_min = cap;
-if (cap_max == undefined) var cap_max = cap_min+360;
-
-var inserted_points = new Array();
-var canvas;
-var cntext;
-var point_list = new Array();
-var zoom;
-var to_zoom;
-var zooms = new Array();
-var prev_zm;
-var zm;
-var tile = {width:256, height:256};
-var ntiles = {x:228, y:9};
-var border_width = 5;
-var imageObj = new Array();
-
-var last  = {x:0,y:0};
-var shift = {x:0,y:0};
-var mouse = {x:0,y:0};
-var speed = {x:0,y:0};
-var canvas_pos = {x:0,y:0};
-var tmt;
-
-var test = {x:0, y:0, i:100};
-
-function nmodulo(val, div) {                // pour obtenir un modulo dans l'espace des nombres naturels N.
-    return Math.floor((val%div+div)%div);   // il y a peut être plus simple, mais en attendant .... 
-}
-
-function fmodulo(val, div) {                // pour obtenir un modulo dans l'espace des nombres réels positifs.
-    return (val%div+div)%div;               // il y a peut être plus simple, mais en attendant .... 
-}
-
-function distort_canvas(p, x, y) {
-    if (p == 0) distort = 0;
-    else {
-	cntext.save();
-	distort++;
-        cntext.clearRect(0, 0, canvas.width, 2*canvas.height);
-	var ratio = (canvas.width-2*distort)/canvas.width;
-	var shift = canvas.height/2*(1-ratio);
-	cntext.scale(1, ratio);
-	if (p == 1) cntext.translate(0, 0);
-	else if (p == -1) cntext.translate(0, 0);
-	draw_image(x, y);
-	cntext.restore();
-	document.getElementById('res').innerHTML = 'distort : ' + distort + ' shift ' + shift + ' ratio : ' + ratio + '<br/>';
-    }
-}
-
-function draw_image(ox, oy) {
-    ox = nmodulo(ox-canvas.width/2, zm.im.width);        // pour placer l'origine au centre du canvas 
-    var ocx = nmodulo(ox - zm.phase_pix, zm.im.width);
-    //document.getElementById('res').innerHTML = zm.phase_pix + ' -- ' + zm.im.width + ' shift(x,y) ' + shift.x;
-    oy = Math.floor(oy-canvas.height/2);                             // pas de rebouclage vertical
-
-    cntext.clearRect(0, 0, canvas.width, canvas.height);
-    cntext.fillStyle = "rgba(128,128,128,0.8)";
-    
-    if (canvas.height > zm.im.height) {
-	var fy = Math.floor((oy+canvas.height/2-zm.im.height/2)/(tile.height*zm.ntiles.y))*zm.ntiles.y;
-	if (fy < 0) fy = 0; 
-	var ly = fy + zm.ntiles.y;
-    } else {
-	var fy = Math.floor(oy/tile.height);
-	var ly = Math.floor((oy+canvas.height+tile.height-1)/tile.height+1);
-	if (fy < 0) fy = 0; 
-	if (ly > zm.ntiles.y) ly = zm.ntiles.y; 
-    }
-
-    for (var j=fy; j<ly; j++) {
-	var delta_y = (Math.floor(j/zm.ntiles.y) - Math.floor(fy/zm.ntiles.y)) * (tile.height - zm.last_tile.height);
-	var dy = j*tile.height - oy - delta_y;
-	var ny = j%ntiles.y;
-	var wy = zm.tile.width;
-	if (ny == zm.ntiles.y - 1) wy = zm.last_tile.height;
-
-	var cpx = 0;
-	var i = 0;
-	var Nx = zm.ntiles.x;
-	if (zm.im.unused_width != 0) Nx++;
-	while (cpx < ocx+canvas.width) {
-	    var cur_width = zm.tile.width;
-	    if (i%Nx == zm.ntiles.x-1) cur_width = zm.last_tile.width;
-	    else if (i%Nx == Nx-1) cur_width = zm.im.unused_width;
-	    if (cpx >= ocx-cur_width) {
-		if (i%Nx == Nx-1 && zm.im.unused_width != 0) {
-		    cntext.fillRect(cpx-ocx, dy, zm.im.unused_width, wy);
-		} else {
-		    var nx = i%Nx;
-		    load_image(nx, ny, cpx-ocx, dy, ox, oy);
-		}
-	    }
-	    cpx += cur_width;
-	    i++;
-	}
-    }
-    drawDecorations(ox, oy);
-}
-
-function load_image(nx, ny, ox, oy, x, y) {
-    var idx = nx+'-'+ny+'-'+zoom;
-    if (imageObj[idx] && imageObj[idx].complete) {
-	draw_tile(idx, ox, oy); // l'image est déja en mémoire, on force le dessin sans attendre.
-    } else {
-	var fname = get_file_name(nx, ny, zoom);
-	imageObj[idx] = new Image();
-	imageObj[idx].src = fname;
-	var ts = zm.get_tile_size(nx, ny);
-	cntext.fillRect(ox, oy, ts.width, ts.height);
-	var dx = shift.x;
-	var dy = shift.y;
-	imageObj[idx].addEventListener('load', function() {draw_tile_del(zoom, dx, dy, idx, ox, oy, x, y)}, false);
-    }
-}
-
-function draw_tile_del(ezoom, dx, dy, idx, ox, oy, x, y) {
-    if (ezoom == zoom && dx == shift.x && dy == shift.y) {
-	draw_tile(idx, ox, oy);
-	drawDecorations(x, y);
-    }
-}
-
-function draw_tile(idx, ox, oy) {
-    var img = imageObj[idx];
-    cntext.drawImage(img, ox, oy);
-}
-
-function drawDecorations(ox, oy) {
-    var wgrd = zm.im.width/360;
-    var od = ((ox+canvas.width/2)/wgrd)%360;
-    var el = (zm.im.height/2 - (oy+canvas.height/2))/wgrd;
-//    document.getElementById('angle_ctrl').value = od.toFixed(2);
-//    document.getElementById('elvtn_ctrl').value = el.toFixed(2);
-    cntext.fillStyle = "rgba(0,128,128,0.9)";
-    cntext.strokeStyle = "rgb(255,255,255)";
-    cntext.lineWidth = 1;
-    cntext.fillRect(canvas.width/2-5, canvas.height/2-5, 10, 10);
-    cntext.strokeRect(canvas.width/2-5, canvas.height/2-5, 10, 10);
-    for(var i = 0; i < zm.pt_list.length; i++) {
-	var cx = zm.pt_list[i]['xc'] - ox;
-	var cy = zm.pt_list[i]['yc'] - oy;
-	if (zm.pt_list[i]['lnk'] != undefined) cntext.fillStyle = "rgba(255,128,128,0.5)";
-	else cntext.fillStyle = "rgba(128,255,128,0.5)";
-	cntext.beginPath();
-	cntext.arc(cx, cy, 20, 0, 2*Math.PI, true);
-	cntext.fill();
-    }
-
-    //cntext.font = "20pt Arial";
-    //cntext.fillRect(0, 0, 200, 20);
-    //cntext.fillStyle = "rgb(255,0,0)";
-    //cntext.fillText(od.toFixed(2), 5, 20);
-    //for (i=0; i<canvas.width/wgrd; i++) {
-	//cntext.strokeRect(i*wgrd, 0, wgrd, 20);
-    //}
-}
-
-function get_file_name(x, y, z) { // recherche du fichier correspondant au zoom et à la position
-    var prm = [z, x, y];
-    var fname = img_prefix;
-    for (var i = 0; i < prm.length; i++) {
-	fname += '_';
-	if (prm[i] < 10) fname += '00';
-	else if (prm[i] < 100) fname += '0';
-	fname += prm[i];
-    }
-    fname += '.jpg';
-    return fname;
-}
-
-function keys(key) {
-    event.preventDefault();
-    event.stopPropagation();
-    if (!key) {
-	key = event;
-	key.which = key.keyCode;
-    }
-    evt = key || event;
-//    alert(key);
-//    if (!evt.shiftKey) return;
-    switch (key.which) {
-    case 36: // home
-	test.x=0;
-	test.y=0;
-	putImage(test.x, test.y);
-	return;
-    case 66: // b
-	alert(key.pageX);
-	test.x=tile.width*(ntiles.x-3);
-	test.y=0;
-	putImage(test.x, test.y);
-	return;
-    case 67: // c
-	test.x=0;
-	test.y=tile.height*(ntiles.y-3);
-	putImage(test.x, test.y);
-	return;
-    case 35: // end
-	test.x=tile.width*(ntiles.x-3);
-	test.y=tile.height*(ntiles.y-3);
-	putImage(test.x, test.y);
-	return;
-    case 39: // left
-	test.x+=test.i;
-	putImage(test.x, test.y);
-	return;
-    case 40: // up
-	test.y+=test.i;
-	putImage(test.x, test.y);
-	return;
-    case 37: // right
-	test.x-=test.i;
-	putImage(test.x, test.y);
-	return;
-    case 38: // down
-	test.y-=test.i;
-	putImage(test.x, test.y);
-	return;
-    case 33: // pageup
-	test.y=0;
-	putImage(test.x, test.y);
-	return;
-    case 34: // pagedown
-	test.y=tile.height*(ntiles.y-3);
-	putImage(test.x, test.y);
-	return;
-    default:
-	//alert(key.which)
-	return;
-    }
-}
-
-function onImageClick(e) {
-    shift.x = last.x;
-    shift.y = last.y;
-    speed.x = 0;
-    speed.y = 0;
-    mouse.x = e.pageX;
-    mouse.y = e.pageY;
-    clearTimeout(tmt);  //arrêt de l'éffet eventuel d'amorti en cours.
-    canvas.addEventListener('mousemove', stickImage, false);
-    canvas.addEventListener('mouseup', launchImage, false);
-    //canvas.addEventListener('mouseout', launchImage, false);
-    canvas.style.cursor='move';
-    //document.onmousemove = stickImage;
-    document.onmouseup = launchImage;
-    hide_links();
-}
-
-
-function stickImage(e) {
-    var xs = mouse.x - e.pageX + shift.x;
-    var ys = mouse.y - e.pageY + shift.y;
-    speed.x = xs - last.x;  //mémorisation des vitesses horizontales
-    speed.y = ys - last.y;  //et verticales lors de ce déplacement
-    putImage(xs, ys);
-}
-
-function launchImage(e) {
-    distort_canvas(0);
-    canvas.removeEventListener('mousemove', stickImage, false);
-    show_links();
-    //document.onmousemove = null;
-    shift.x = e.pageX - mouse.x + shift.x;
-    shift.y = e.pageY - mouse.y + shift.y;
-    tmt = setTimeout(inertialImage, 100);
-}
-
-function putImage(x, y) { // est destiné à permettre l'effet d'amortissement par la mémorisation de la position courante.
-    if (!zm.is_updated) return; 
-    if (x >= zm.im.width) {   // rebouclage horizontal
-	shift.x -= zm.im.width;
-	x -= zm.im.width;
-    } else if (x < 0) {
-	shift.x += zm.im.width;
-	x += zm.im.width;
-    }
-    if (y >= zm.im.height) {   // pas de rebouclage vertical mais blocage
-	//distort_canvas(1, x, y);
-	shift.y = zm.im.height-1;
-	y = zm.im.height-1;
-    } else if (y < 0) {
-	//distort_canvas(-1, x, y);
-	shift.y = 0;
-	y = 0;
-    }
-
-    draw_image(x, y);
-    last.x = x;
-    last.y = y;
-}
-
-function inertialImage() {
-    speed.x *= 0.9;
-    speed.y *= 0.9;
-    if (Math.abs(speed.x) > 2 || Math.abs(speed.y) > 2) {
-	putImage(last.x+speed.x, last.y+speed.y);
-	tmt = setTimeout(inertialImage, 100);
-    }
-}
-
-function tzoom(zv) {
-    this.value = zv;
-    this.ntiles = {x:0,y:0};
-    this.tile = {width:0,height:0};
-    this.last_tile = {width:0,height:0};
-    this.max_tile = {width:0,height:0};
-    this.im = {width:0,height:0};
-    this.im.unused_width = 0;
-    this.pt_list = new Array();
-    this.is_updated = false;
-    this.refresh = function() {
-	this.im.visible_width = this.tile.width*(this.ntiles.x-1)+this.last_tile.width;
-	this.is_updated = true;
-	var cap_int = (Math.abs(cap_max - cap_min + 0.005)) % 360.0;
-	if (cap_int < 0.01) this.im.unused_width = 0;
-	else this.im.unused_width = Math.floor(fmodulo(cap_min - cap_max, 360)*this.im.visible_width/fmodulo(cap_max - cap_min, 360));
-//	document.getElementById('res').innerHTML += 'unuse_cap ' + fmodulo(cap_min - cap_max) + ' used_cap ' + fmodulo(cap_max - cap_min);
-
-	this.im.width = this.im.visible_width+this.im.unused_width;
-	this.im.height = this.tile.height*(this.ntiles.y-1)+this.last_tile.height;
-	if (this.im.unused_width > this.tile.width) this.max_tile.width = this.im.unused_width;
-	else this.max_tile.width = this.tile.width;
-	this.max_tile.height = this.tile.height;
-	this.max_tile.width = 
-	this.phase_pix = Math.floor(this.im.width*cap_min/360);
-	for (var i=0; i<point_list.length; i++) {
-	    var tmp = fmodulo(point_list[i][2], 360);
-	    this.pt_list[i] = new Array();
-	    this.pt_list[i]['label'] = point_list[i][0];
-	    this.pt_list[i]['xc'] = Math.floor(tmp * this.im.width/360);
-	    this.pt_list[i]['yc'] = Math.floor(this.im.height/2 - (point_list[i][3] + elevation) * this.im.width/360);
-	    this.pt_list[i]['angle'] = point_list[i][2];
-	    if (point_list[i][4] != '') this.pt_list[i]['lnk'] = point_list[i][4]+'&to_zoom='+zv;
-	}
-    }
-    this.get_tile_size = function(nx, ny) {
-	var res = {width:0, height:0};
-	if (nx == this.ntiles.x-1) res.width = this.last_tile.width;
-	else res.width = this.tile.width;
-	if (ny == this.ntiles.y-1) res.height = this.last_tile.height;
-	else res.height = this.tile.height;
-	return res;
-    }
-}
-
-function wheel_zoom (event) {
-    var zshift = {x:0, y:0};
-    if (event.pageX != undefined && event.pageX != undefined) {
-	zshift.x = event.pageX-canvas.width/2-canvas_pos.x;
-	zshift.y = event.pageY-canvas.height/2-canvas_pos.y;
-    }
-    event.preventDefault();
-    if (event.wheelDelta < 0 && zoom_control.value < zoom_control.max) {
-	zoom_control.value++;
-	change_zoom(zshift.x, zshift.y);
-    } else if (event.wheelDelta > 0 && zoom_control.value > zoom_control.min) {
-	zoom_control.value--; 
-	change_zoom(zshift.x, zshift.y);
-    }
-}
-
-function change_zoom(shx, shy) {
-    var zoom_control = document.getElementById("zoom_ctrl");
-    var v = zoom_control.value;
-
-    prev_zm = zm;
-
-    if (zooms[v]) {
-	if (!zooms[v].is_updated) zooms[v].refresh();
-    } else {
-	zooms[v] = new tzoom(v);
-    }
-
-    if (zooms[v].is_updated) {
-	if (shx == undefined || shy == undefined) {
-	    shx=0;
-	    shy=0;
-	}
-	zm = zooms[v];
-	var px = (last.x+shx)*zm.im.width/prev_zm.im.width - shx;
-	var py = (last.y+shy)*zm.im.height/prev_zm.im.height - shy;
-	if (py < zm.im.height && py >= 0) {
-	    zoom = zm.value;
-	    tile = zm.tile;
-	    ntiles = zm.ntiles;
-	    putImage(px, py);
-	} else {
-	    zm = prev_zm;
-	    zoom_control.value = zm.value;
-	}
-    }
-}
-
-function change_angle() {
-    var elvtn_control = document.getElementById('elvtn_ctrl');
-    var angle_control = document.getElementById('angle_ctrl');
-    var pos_x = zm.im.width*angle_control.value/360;
-    var pos_y = Math.floor(zm.im.height/2 - zm.im.width*elvtn_control.value/360);
-    putImage(pos_x, pos_y);
-}
-
-function check_links(e) {
-    var mouse_x = e.pageX-canvas_pos.x;
-    var mouse_y = e.pageY-canvas_pos.y;
-    var pos_x = nmodulo(last.x + mouse_x - canvas.width/2, zm.im.width);
-    var pos_y = last.y + mouse_y - canvas.height/2;
-    for(var i = 0; i < zm.pt_list.length; i++) {
-	if (Math.sqrt((zm.pt_list[i]['xc'] - pos_x) * (zm.pt_list[i]['xc'] - pos_x) + (zm.pt_list[i]['yc'] - pos_y) * (zm.pt_list[i]['yc'] - pos_y)) < 20) {
-	    if (zm.pt_list[i]['lnk'] != undefined) window.location = zm.pt_list[i]['lnk'];
-	    break;
-	}
-    }
-}
-
-function display_links(e) {
-    var info = document.getElementById('info');
-    var mouse_x = e.pageX-canvas_pos.x;
-    var mouse_y = e.pageY-canvas_pos.y;
-    var pos_x = nmodulo(last.x + mouse_x - canvas.width/2, zm.im.width);
-    var pos_y = last.y + mouse_y - canvas.height/2;
-    var cap = ((pos_x/zm.im.width)*360).toFixed(2);
-    var elev = (((zm.im.height/2 - pos_y)/zm.im.width)*360 - elevation).toFixed(2);
-    info.innerHTML = 'élévation :'+elev+'<br/>cap :'+cap;
-    info.style.top = e.pageY+'px';
-    info.style.left = e.pageX+'px';
-    info.style.backgroundColor = '#FFC';
-    canvas.style.cursor='crosshair';
-    for(var i = 0; i < zm.pt_list.length; i++) {
-	if (Math.sqrt((zm.pt_list[i]['xc'] - pos_x) * (zm.pt_list[i]['xc'] - pos_x) + (zm.pt_list[i]['yc'] - pos_y) * (zm.pt_list[i]['yc'] - pos_y)) < 20) {
-	    info.innerHTML = zm.pt_list[i]['label'];
-	    info.style.backgroundColor = '#FC8';
-	    canvas.style.cursor='auto';
-	    break;
-	}
-    }
-}
-
-function hide_links() {
-    canvas.removeEventListener( "mousemove", display_links, false);
-    var info = document.getElementById('info');
-    info.style.display = 'none';
-}
-
-function show_links() {
-    canvas.addEventListener( "mousemove", display_links, false);
-    var info = document.getElementById('info');
-    info.style.display = 'block';
-}
-
-function show_insert_point(e) {
-    event.preventDefault();
-    event.stopPropagation();
-    var insrt = document.getElementById('insert');
-    document.getElementById('do-insert').onclick = function() {insert_point(insert, e.pageX-canvas_pos.x, e.pageY-canvas_pos.y)};
-    document.getElementById('do-cancel').onclick = function() {insert.style.display = 'none'};
-    insrt.style.left = e.pageX+'px';
-    insrt.style.top = e.pageY+'px';
-    insrt.style.display = 'block';
-}
-
-function insert_point(el, x, y) {
-    el.style.display = 'none';
-    for(var i = 0; i < zm.pt_list.length; i++) {
-	if(zm.pt_list[i]['label'] == document.getElementById('sel_point').value) {
-	    var posx = nmodulo(last.x + x - canvas.width/2 - zm.phase_pix, zm.im.width)/zm.im.width;
-	    var pval = {ratio:posx, angle:zm.pt_list[i]['angle']};
-	    inserted_points.push(pval);
-	    document.getElementById('res').innerHTML += zm.pt_list[i]['label'] + '. ' + posx + '=' + zm.pt_list[i]['angle'] + '<br/>';
-	    if (inserted_points.length > 1) {
-		var pval0 = inserted_points[inserted_points.length-2];
-		var origin = fmodulo(pval0.angle - ((pval.angle - pval0.angle)/(pval.ratio - pval0.ratio))*pval0.ratio, 360);
-		var end = fmodulo(pval.angle + ((pval.angle - pval0.angle)/(pval.ratio - pval0.ratio))*(1-pval.ratio), 360);
-		document.getElementById('res').innerHTML += 'cap_min = ' + origin + '<br/>';
-		document.getElementById('res').innerHTML += 'cap_max = ' + end + '<br/>';
-	    }
-	    break;
-	}
-    }
-}
-
-function clean_canvas_events(e) {
-    canvas.removeEventListener('mousemove', stickImage, false);
-    document.getElementById('info').style.display = 'none';
-    speed.x = 0;
-    speed.y = 0;
-}
-
-window.onload = function() {
-    canvas = document.getElementById("mon-canvas");
-    canvas.style.border = border_width+"px solid red";
-    cntext = canvas.getContext("2d");
-    canvas.width = window.innerWidth-200;
-    canvas.height = window.innerHeight-20;
-    canvas.addEventListener("click", check_links, false);
-    canvas_pos.x = canvas.offsetLeft+border_width;
-    canvas_pos.y = canvas.offsetTop+border_width;
-    canvas.addEventListener("contextmenu", show_insert_point, false);
-    canvas.addEventListener("mouseout", clean_canvas_events, false);
-
-    show_links();
-
-    var max_zoom = zooms.length - 1;
-    zoom_control = document.getElementById("zoom_ctrl");
-    zoom_control.onchange = change_zoom;
-    zoom_control.max = max_zoom;
-    if (to_zoom == undefined || to_zoom > max_zoom) to_zoom = Math.floor(max_zoom/2);
-    zm = zooms[to_zoom];
-    zoom_control.value = to_zoom;
-    zm.refresh();
-
-    zoom = zm.value;
-    tile = zm.tile;
-    ntiles = zm.ntiles;
-
-    angle_control = document.getElementById("angle_ctrl");
-    angle_control.value = to_cap;
-    angle_control.onchange = change_angle;
-    angle_control.onclick = change_angle;
-    angle_control.onkeyup = change_angle;
-    elvtn_control = document.getElementById("elvtn_ctrl");
-    elvtn_control.value = to_ele+elevation;
-    elvtn_control.onchange = change_angle;
-    elvtn_control.onclick = change_angle;
-    elvtn_control.onkeyup = change_angle;
-
-    change_angle();
-
-    canvas.addEventListener('mousedown', onImageClick, false);
-    addEventListener('keyup', keys, false);
-    canvas.addEventListener('mousewheel', wheel_zoom, false);
-};
diff --git a/panorama.php b/panorama.php
old mode 100644
new mode 100755
index b2b37b7..9a59ef9
--- a/panorama.php
+++ b/panorama.php
@@ -79,6 +79,7 @@
        printf('point_list[%d] = new Array("%s", %03lf, %03lf, %03lf, "");'."\n", $ipt++, $name, $dist, $cap, $ele);
      }
    }
+ 
 
    if (isset($params['reference'])) {
      echo "ref_points = new Array();\n";
@@ -90,15 +91,31 @@
        }
      }
    }
+  
+  $localLat = (isset($_POST["loca_latitude"])) ? $_POST["loca_latitude"] : NULL;
+  $localLon = (isset($_POST["loca_longitude"])) ? $_POST["loca_longitude"] : NULL;
+  $localAlt = (isset($_POST["loca_altitude"])) ? $_POST["loca_altitude"] : NULL;
+ 
+  if ($localLat && $localLon && $localAlt) {
+  	  list($localDistance, $localCap, $localEle) = $pt->coordsToCap($localLat, $localLon, $localAlt);
+  	  $n = "point temporaire";
+      printf('point_list[%d] = new Array("%s", %03lf, %03lf, %03lf, "temporary");'."\n",$ipt++, $n, $localDistance, $localCap, $localEle);
+  } 
   ?>
   </script>
+  
+ 
+
+  
   <link type="image/x-icon" rel="shortcut icon" href="images/tsf.png"/>
   <link rel="stylesheet" media="screen" href="css/all.css" />
+  <script src="js/hide_n_showForm.js"></script> 
 </head>
 <body>
   <canvas id="mon-canvas">
     Ce message indique que ce navigateurs est vétuste car il ne supporte pas <samp>canvas</samp> (IE6, IE7, IE8, ...)
   </canvas>
+  
   <fieldset id="control"><legend>contrôle</legend>
       <label>Zoom : <input type="range" min="0" max="2" value="2" id="zoom_ctrl"/></label>
       <label>Cap : <input type="number" min="0" max="360" step="10" value="0" autofocus="" id="angle_ctrl"/></label>
@@ -106,13 +123,79 @@
   </fieldset>
 
   <?php
-      //phpinfo();exit;
+      
      if ($params && isset($params['latitude']) && isset($params['longitude'])) {
        print("<div id=\"params\">\n");
-       printf ("<p>latitude :   <em>%.3f°</em></p>\n", $params['latitude']);
-       printf ("<p>longitude : <em>%.3f°</em></p>\n", $params['longitude']);
-       if (isset($params['altitude'])) printf ("<p>altitude : <em>%d m</em></p>\n", $params['altitude']);
+       printf ("<p>latitude :   <em><span id=\"pos_lat\">%.5f</span>°</em></p>\n", $params['latitude']);
+       printf ("<p>longitude : <em><span id=\"pos_lon\">%.5f</span>°</em></p>\n", $params['longitude']);
+       if (isset($params['altitude'])) printf ("<p>altitude : <em><span id=\"pos_alt\">%d</span> m</em></p>\n", $params['altitude']); 
        print("</div>\n");
+       ?>
+       <span id="loca"><img src="images/locapoint.svg" id="icone" onclick="showLoca()"/></span>
+  <fieldset id="locadraw"><legend id="" onclick="hideLoca()">Localiser un point</legend>
+    <form id="form_loca" method="post" name="form_localate" action="panorama.php?dir=<?php echo $_GET['dir'];?>&amp;panorama=<?php echo $_GET['panorama'];?>">
+      <label class="form_col" title="La latitude ϵ [-90°, 90°]. Ex: 12.55257">Latitude :
+	<input  name="loca_latitude" type="number" min="-90" max="90"  id="loca_latitude"/></label>
+	         
+      <label class="form_col" title="La longitude ϵ [-180°, 180°]. Ex: 144.14723">Longitude :
+	<input name="loca_longitude" type="number" min="-180" max="180" id="loca_longitude"/></label>
+	      
+      <label class="form_col" title="L'altitude positive Ex: 170">Altitude :
+	<input  name="loca_altitude" type="number" min="-400" id="loca_altitude"/></label>
+	       
+      <div class="answer">
+	<input type="button" value="Localiser" id="loca_button" class="form_button"/> 
+	<input type="reset" value="Reset" class="form_button"/>
+	<input type="button" value="Effacer" class="form_button" id="loca_erase"/>
+      </div>
+	      
+    </form>
+  </fieldset>
+       <?php
+     } elseif ($params == false ){
+     	$dir   = $_GET['dir'];
+        $name  = $_GET['panorama'];
+     	?>
+       <div id="addParams">		
+     	  <label onclick="showForm()" value="Hide label">Paramétrer le panorama</label>	
+       </div>
+       <fieldset id="adding"><legend id="lgd" onclick="hideForm()">Paramètrer le panorama</legend>
+	 <form action="addParams.php?dir=<?php echo $dir;?>&amp;panorama=<?php echo $name;?>" id="form_param" method="post">
+	   	  
+	   <label class="form_col" for="param_title" title="Au moins 4 caractères">Titre: </label>
+	   <input type="text" id="param_title" name="param_title"/>
+	   
+	   <label class="form_col" for="param_latitude" title="La latitude ϵ [-90°, 90°]. Ex: 12.55257">Latitude: </label>
+	   <input  name="param_latitude" type="text" id="param_latitude" />
+	         
+	   <label class="form_col" for="param_longitude" title="La longitude ϵ [-180°, 180°]. Ex: 144.14723">Longitude: </label>
+	   <input name="param_longitude" type="text" id="param_longitude" />
+	   
+	   <label class="form_col" for="param_altitude" title="L'altitude positive Ex: 170">Altitude: </label>
+	   <input  name="param_altitude" type="text" id="param_altitude" />
+	  
+	   <label class="form_col" for="param_elevation" title="élévation ϵ [-10,10] ( valeur par défaut : 0)">Elévation: </label>
+	   <input  name="param_elevation" type="text" id="param_elevation" />
+	   
+	   <label class="form_col" for="param_loop" title="L'image fait elle 360° ? ">Rebouclage: </label>
+	   <input class="radio" type="radio" name="param_loop" value="true" checked="checked"> Oui
+           <input class="radio" type="radio" name="param_loop" value="false"> Non
+	   
+	   <input type="hidden" value="Localiser" id="loca_button" class="form_button" style="width:70px" /> 
+	   <input type="hidden" value="Effacer" class="form_button" id="loca_erase"/>
+	  
+	   <div class="answer">
+	     <input type="submit" value="Submit" class="form_button"/> 
+	     <input type="reset" value="Reset" class="form_button"/>
+	   </div>
+	      
+  	 </form>
+       </fieldset>
+  
+ 
+       <script src="js/pano_deroulant.js"></script> 
+      
+     	<?php
      }
      echo '<p id="info"></p>'."\n";
      if (count($extra_names) > 1) {
@@ -126,7 +209,8 @@
        echo "<input type=\"button\" id=\"do-cancel\" value=\"annuler\"/>\n";
        echo "</p>\n";
      }
-  ?> 
+     
+     ?>
   <p class="validators"><a href="http://validator.w3.org/check?uri=referer">page xHTML validé !</a></p>
   <p id="res"></p>
 </body>
diff --git a/ref_points.php b/ref_points.php
old mode 100644
new mode 100755
index 8fa683c..f5b87d1
--- a/ref_points.php
+++ b/ref_points.php
@@ -1,5 +1,7 @@
 <?php
 $ref_points = array (
+                     'Marc' => array(43.60568, 1.42841, 170),
+                     'FF2' => array(43.67737, 1.45077, 140),
 		     'Clocher de Saint-Sernin' => array(43.6085, 1.4424, 190),
 		     'Clocher des Minimes' => array(43.61811, 1.43639, 165),
 		     "Obélisque de l'observatoire" => array(43.6114, 1.4618, 200),
diff --git a/to_tiles/gen_tiles.sh b/to_tiles/gen_tiles.sh
index 97ee6cf..ec805ac 100755
--- a/to_tiles/gen_tiles.sh
+++ b/to_tiles/gen_tiles.sh
@@ -8,7 +8,7 @@ min_scale=0
 max_scale=8
 usage="$0 [-x <x_tile_size>] [-y <y_tile_size>] [-p <prefix_result>] [-t] [-h] [-m <min_zoom>] [-M <max_zoom>] <image_to_convert>\n   example: $0 -r test_res"
 
-if ! which tifftopnm pnmscale convert > /dev/null; then
+if ! which anytopnm pnmscale convert > /dev/null; then
     echo "il faut installer les paquets netpbm et imageMagick pour utiliser ce script !"
 fi
 
@@ -44,9 +44,9 @@ fi
 
 wfname=$prefix.pnm
 if ! $test_mode; then
-    tifftopnm $fname > $wfname
+    anytopnm $fname > $wfname
 else
-    echo "tifftopnm $fname > $wfname"
+    echo "anytopnm $fname > $wfname"
 fi
 
 echo "préfixe : "$prefix
@@ -54,7 +54,7 @@ echo "préfixe : "$prefix
 for ((z=$min_scale; z <= $max_scale; z++))
 do
     fprefix=${prefix}_00$z
-    printf -v ratio %1.4lf $(echo "1 / (2^$z)" | bc -l)
+    LANG=C  printf -v ratio %1.4lf $(echo "1 / (2^$z)" | bc -l)
     echo génération du ratio $ratio
     zwfname=tmp.pnm
 
