Index: /extensions/Autosize/autosize.inc.php
===================================================================
--- /extensions/Autosize/autosize.inc.php	(revision 19763)
+++ /extensions/Autosize/autosize.inc.php	(revision 19764)
@@ -92,5 +92,5 @@
         }
           self::reload("#93");
-           self::Fin_php("#94 autosize_calcContent:" + $DEBUG_autosize);
+          self::Fin_php("#94 autosize_calcContent:" + $DEBUG_autosize);
 
     }  
@@ -120,4 +120,20 @@
 * INIT
 *********************/
+
+static public function init_1($content, $image)
+		{
+		  global $conf, $template, $page;    
+       if(!isset($conf['AS_panorama'])) return $content;  
+       		  $asp = & $conf['AS_panorama'];   
+       if ( !stristr($image['name'], $asp['in_mode_360']) and !stristr($image['name'], $asp['in_mode_180']) ) return $content;
+
+       $windowWidth=$_COOKIE['windowWidth'] -$_COOKIE['theImageLeft']-$_COOKIE['theImageRight'];
+       $windowHeight=$_COOKIE['windowHeight']-130 ;
+
+      $asp['start_position']= 10;     
+           $asp['min_viewport_width']= $windowWidth;     
+            $asp['viewport_height']= $windowHeight;     
+      }
+
 static public function init($content,$element_info){
   global  $template,$version,$icon_path,$page,$picture,$conf;
@@ -408,5 +424,5 @@
         echo $set_var ;       
         echo $autoscript;       
-        self::Fin_php("#411: ".$DEBUG_autosize);
+  //      self::Fin_php("#411: ".$DEBUG_autosize);
        
 }
Index: /extensions/Autosize/js/Affiche_script.js
===================================================================
--- /extensions/Autosize/js/Affiche_script.js	(revision 19763)
+++ /extensions/Autosize/js/Affiche_script.js	(revision 19764)
@@ -472,6 +472,4 @@
       //========================================================================================== 
       init_gen();
-
-
     });
     //__________________window.onload_________________
@@ -513,5 +511,5 @@
     options.valide = jQuery(".Autosize").css("display") != "none";
     options.marge_haute = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("top"));
-  options.marge_basse = Math.max(
+    options.marge_basse = Math.max(
   jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("bottom")),
   options.marge_basse
@@ -945,11 +943,18 @@
 
         //jQuery(theMainImage_id).height(Zone_image.image.height);
+        } else if (Type_Img == "panorama") {
+         // jQuery("#pamoorama").width(img_finale.width);
+         // jQuery("#pamoorama").height(img_finale.height);
+
+           
+      
+     //   jQuery("#theImage img.simple_panorama").panorama(asp_options);
       } else {
         if (options.imageAutosize == false)
           if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
-            jQuery(theMainImage_id).height(Zone_image.image.height );
+            jQuery(theMainImage_id).height(Zone_image.image.height);
             jQuery(theMainImage_id).width(Zone_image.image.width);
-           
-            jQuery(theMainImage_id).css("margin-top", options.marge_haute );
+
+            jQuery(theMainImage_id).css("margin-top", options.marge_haute);
 
           } else {
@@ -1131,5 +1136,6 @@
     *      pamoorama
     ******************************/
-
+   
+   
     jQuery("#pamoorama").bind("on", function () { alert($(this).text()); });
     jQuery("#pamoorama").bind("on", function (e) {
@@ -1753,5 +1759,5 @@
       if (!options.check_desc_v)
         options.marge_bottom_2 = 0;
-      
+
 
       marge_bottom = options.marge_bottom_2 + options.marge_bottom;
@@ -1866,4 +1872,6 @@
           infos_theImage = jQuery(theMainImage_id).infos();
           infos_the_page = jQuery("#the_page").infos();
+          if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
+
           img_finale.height = infos_theImage.height;
           break
@@ -1939,6 +1947,10 @@
         mxi = Math.ceil(Zone_image.image.height + Zone_image.marges.height);
         Zone_image.container.height = Math.max(Zone_image.container.height, mxi);
+      } else {
+
+
       }
       img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
+
       return true;
     }
@@ -2274,5 +2286,5 @@
 
 
-  });                                                                                                                // ready
+  });                                                                                                                   // ready
 
 
Index: /extensions/Autosize/main.inc.php
===================================================================
--- /extensions/Autosize/main.inc.php	(revision 19763)
+++ /extensions/Autosize/main.inc.php	(revision 19764)
@@ -48,5 +48,7 @@
 //===============================================================
 if(!preg_match("|NO|", $DEBUG_autosize, $val)) {  
+ // EVENT_HANDLER_PRIORITY_NEUTRAL=80
     add_event_handler('render_element_content', array(&$autosize_ctrl, 'autosize_calcContent'),EVENT_HANDLER_PRIORITY_NEUTRAL-11,2); 
+    add_event_handler('render_element_content', array(&$autosize_ctrl, 'init_1'),EVENT_HANDLER_PRIORITY_NEUTRAL-9,2); 
     add_event_handler('render_element_content',  array(&$autosize_ctrl,'init'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2  );
     add_event_handler('render_element_content',  array(&$autosize_ctrl,'init2'),EVENT_HANDLER_PRIORITY_NEUTRAL+1,2  );
Index: /extensions/Autosize/template/picture.tpl
===================================================================
--- /extensions/Autosize/template/picture.tpl	(revision 19763)
+++ /extensions/Autosize/template/picture.tpl	(revision 19764)
@@ -26,8 +26,9 @@
    var src5 = "{'cl_autosize_info_1'|@translate}";
    var src6 = "{$cl_autosize_button.ICON1}";
+   var asp_options = null;
 
    {if $ASP.width}
    jQuery(window).load(function () {ldelim}
-   var asp_options ={ldelim} };
+   asp_options ={ldelim} };
    if(typeof $("#imageToolBar") !="undefined" )
    var w = $("#imageToolBar").width();
@@ -51,5 +52,6 @@
 					 loop_180 : {$ASP.loop_180}
 			 };
-		//$("#theImage img.simple_panorama").panorama(asp_options);
+
+		// $("#theImage img.simple_panorama").panorama(asp_options);
 	};
  });
