Index: /extensions/Autosize/autosize.inc.php
===================================================================
--- /extensions/Autosize/autosize.inc.php	(revision 18935)
+++ /extensions/Autosize/autosize.inc.php	(revision 18936)
@@ -939,10 +939,12 @@
                                     $maxi_image = $img_select;   
                                                              
-                       
+                               $maxi_image->url  =  $maxi_image->get_path();
+
                             } else { 
                             
                                 $mini_image->type=$img_type;
                                 $mini_image->url=$img_url;
-                                $mini_image=$img_select;                     
+                                $mini_image=$img_select;  
+                               $mini_image->url  =  $mini_image->get_path();            
                             }                         
        
@@ -968,10 +970,11 @@
         $retour->url=$retours[1];
      }
-  
-
+
+   if(preg_match("|get_infos|", $DEBUG_autosize, $val)) $infos_message .= $retour->type . " " . $retour->url ;
   if (!isset( $retour->type)){     
                   $retour=$last_image;
                   $retour->type =  $retour->get_type();
                   $retour->url  =  $retour->get_path();
+                
 }
 if (isset( $retour->type) && $retour->type=="Original" ){     
@@ -979,7 +982,8 @@
                   $retour->type =  $last_derivative;
                   $retour->url  =  $retour->get_path();
-}
-
-         if(preg_match("|get_minfos|", $DEBUG_autosize, $val))     $infos_message .= $pictureSelType . " -> " .  $retour->type . "---" . $retour->url. "<br >";
+              
+}
+
+
 
       if($nofile > 0){  
@@ -988,5 +992,5 @@
 
 
-    if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) 
+    if(preg_match("|get_infos|", $DEBUG_autosize, $val)) 
             $infos_message .=$pictureSelType . " -> " . $retour->type . " : "  . $retour->url  ."<br >";
 
Index: /extensions/Autosize/js/Affiche_script.js
===================================================================
--- /extensions/Autosize/js/Affiche_script.js	(revision 18935)
+++ /extensions/Autosize/js/Affiche_script.js	(revision 18936)
@@ -58,5 +58,5 @@
     //____________________ Save_cookies _____________________________
     /************************************************
-    *
+    *  Get COOKIE
     *************************************************/
     Get_cookies = function () {
@@ -170,8 +170,14 @@
       if (typeof options.cl_visible == "undefined") return;
       if (typeof src1 == "undefined") return;
-
       if (options.cl_visible) src = src1;
       else src = src2;
 
+      if (typeof options.pictureSelType != "undefined" && (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi")) {
+        if (options.pictureSelType == "SelMaxi") src = src6;
+      } else {
+        Valid = false;
+        src = src2;
+        jQuery("#bp_cla span").text("");
+      }
       if (options.cl_visible) {
         src_info = src3;
@@ -181,25 +187,22 @@
         src_infos_1 = src5;
       }
-
+      src_info = options.pictureDeriv;
       if (!Valid) {
         Zone_image.image.height = Zone_image.image_init.height;
         Zone_image.image.width = Zone_image.image_init.width;
-        src = src6;
+
       }
       if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined") {
-
         Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
         zoom_cl = parseInt(100 * Zone_image.zoom) + "%"; ;
-
         if (!Valid) {
           if (options.pictureSelType == "SelMaxi")
             zoom_cl = options.pictureSelType + " [" + options.pictureDeriv + "]";
-          else
-            zoom_cl = " [" + options.pictureDeriv + "]";
-
-        } else
-
-
-          jQuery('#bp_cla').attr('alt', src_info);
+          else {
+            zoom_cl = "";
+            src_info = options.pictureDeriv;
+          }
+        }
+        jQuery('#bp_cla').attr('alt', src_info);
         jQuery('#bp_cla').attr('title', src_info);
         jQuery('#bp_cla').attr('Stitle', src_info);
@@ -209,6 +212,4 @@
           rap_init: Zone_image.image_init.rapport
         }
-
-
         jQuery('#bp_cla span').text(zoom_cl);
         color_back = jQuery('#imageToolBar').css("backgroundColor");
@@ -251,9 +252,9 @@
 
     /********************************
-    * Set__bgo
+    * Set__llbgo
     *********************************/
     Set_llbgo = function (Force) {
 
-      if (marges_llgbo == 0) return;
+      if (options.marges_llgbo == 0) return;
       if (Type_Img == "pamoorama") {
 
@@ -470,5 +471,5 @@
     ********************************************/
     jQuery(window).unload(function () {
-      return;
+    //  return;
     });
     //_________ unload ___________
@@ -596,86 +597,13 @@
     spans.next().text(options.pictureDeriv);
     //==========================================================
-
     /*
-
-
     jQuery('#derivativeCheckedAutosize').hide();
     jQuery('#derivativeCheckedAutosize').next().hide();
     jQuery('#derivativeCheckedAutosize').next().next().hide();
     */
-
-
     //=============================================================
     // REPONSE ACTION
     //=============================================================
     theMainImage_st = false;
-
-
-    /***********************
-    *
-    **********************/
-    jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")
-        .load(function (e) {
-          src = this.src;
-          theMainImage_st = true;
-          if (typeof Zone_image == "undefined") {
-            Zone_image = {};
-          }
-          Zone_image.image_init = { width: this.width, height: this.height, rapport: this.width / this.height };
-          if (!init_img(this)) {
-            nu_img = 0;
-          }
-
-        })
-         .error(function (e) {
-           if (!this.complete) {
-             src = jQuery(this).attr("src").replace("./_data/i/", "", 1);
-             jQuery.ajax({
-               type: 'GET',
-               url: 'i.php?' + src + "&ajaxload=true",
-               dataType: 'json',
-               success: (function (data) {
-                 j = data;
-               })
-
-             });
-
-
-
-           }
-
-         })
-         .bind("Finish", function (e, data) {
-           if (typeof imageInfos_id == "undefined") return;
-
-         })
-          .bind("ON", function (e, data) {
-            if (data.status != "ok") {
-              popup = jQuery(".errors");
-              if (popup.length == 0) {
-                jQuery("#theImage").append("<div class='errors'><span></span></div>");
-              }
-              jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText);
-              jQuery(".errors").show().delay(10000).hide(2000);
-              return;
-            }
-            if (data.src) {
-              if (typeof imageInfos_id == "undefined") return;
-              if (data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) {
-                //   Autosize_resize(true, options);
-              }
-            }
-          });
-
-
-    ;
-
-
-
-
-    ;
-    //_________ theMainImage  ___________
-
-
     jQuery("#reset").click(function () {
       location.reload();
@@ -850,16 +778,11 @@
         // options.pictureDeriv = retour.pictureDeriv;
         options.pictureSelType = retour.pictureSelType;
-        options.pictureMap = options.pictureDeriv;
-
+        options.pictureDeriv = retour.pictureDeriv;
+        options.pictureMap = retour.pictureDeriv;
 
         if (this.name) {
           options.pictureSelType = this.name;
           n = Get_dimensions(true, options);
-
-
-
         } else {
-
-
         }
 
@@ -872,4 +795,5 @@
           jQuery(".auto_details").text("");
         }
+        Autosize_resize(true, options);
       }
     });
@@ -889,5 +813,5 @@
       return;
     });
-    //____________________ set_llgbo _____________________________
+
 
     //====================================
@@ -927,6 +851,10 @@
       Save_cookies(options);
       if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
+        /**/
         jQuery(theImg).width(Zone_image.image_init.width);
         jQuery(theImg).height(Zone_image.image_init.height);
+
+        set_cl("no");
+        Set_llbgo(true);
         return;
 
@@ -971,6 +899,6 @@
 
           } else {
-            jQuery(theMainImage_id).height(Zone_image.image.height);
-            jQuery(theMainImage_id).width(Zone_image.image.width);
+            jQuery(theMainImage_id).width(Zone_image.image_init.width);
+            jQuery(theMainImage_id).height(Zone_image.image_init.height);
           }
 
@@ -999,17 +927,19 @@
     changeImgSrc = function (url, typeSave, typeMap, type) {
       if (url) {
-        if (options.imgSrc != url) {
-          options.imgSrc = url;
-        }
-      }
-      jQuery("#theMainImage")
-      .removeAttr("width height")
-      .attr("src", url)
+        if (url.match(RegExp("i.php", "gi"))) {
+          urls = url.split("?");
+        }
+      }
+      url2 = jQuery("#theMainImage").attr("src");
+      return;
+
+      jQuery("#theMainImage").removeAttr("width height").attr("src", url)
       .load(function (i) {
-        url2 = this.src;
+        if (!init_img(this))
+          return;
+        //=======================================================================       
         jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
         newtype = options.pictureSelType;
         if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) {
-
           jQuery('#derivativeChecked' + type).css('visibility', 'visible');
           document.cookie = 'picture_sel_type=' + type + ';path=' + COOKIE_PATH;
@@ -1018,25 +948,68 @@
           document.cookie = 'picture_sel_type=' + typeSave + ';path=' + COOKIE_PATH;
         }
-
         options.pictureMap = typeMap;
         options.pictureDeriv = typeSave;
         document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH;
-        Autosize_resize(true, options);
-        if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) {
-
-        } else {
-          jQuery("#bp_img_cla").attr("src", "./plugins/Autosize/icons/button-maximize.png");
-          jQuery("#bp_cla span").text("");
-        }
+
       })
       .live("ON", function (e) {
         theMainImage_st = this.complete;
-        this.src = this.src;
+        imgsrc = this.src;
         // alert(this.src + ' Image does not exist !!');
       }).error(function (i) {
-        this.src = this.src;
+        imgsrc = this.src;
       });
-      ;
-
+      /***********************
+      *
+      **********************/
+      jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")
+         .error(function (e) {
+           if (!this.complete) {
+             // le fichier n'est pas present 
+             src = jQuery(this).attr("src").replace("./_data/i/", "", 1);
+             src = this.src.split("/_data/i")[1];
+             url = 'i.php?' + src + "&ajaxload=true";
+             jQuery(theMainImage_id).attr("src", url);
+             /*
+             jQuery.ajax({
+             type: 'GET',
+             url: 'i.php?' + src + "&ajaxload=true",
+             dataType: 'json',
+             success: (function (data) {
+             j = data.url;
+             //  jQuery(theMainImage_id).attr("src", data.url);
+
+             })
+
+             });
+             */
+
+
+
+           }
+
+         })
+         .bind("Finish", function (e, data) {
+           if (typeof imageInfos_id == "undefined") return;
+
+         })
+          .bind("ON", function (e, data) {
+            if (data.status != "ok") {
+              popup = jQuery(".errors");
+              if (popup.length == 0) {
+                jQuery("#theImage").append("<div class='errors'><span></span></div>");
+              }
+              jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText);
+              jQuery(".errors").show().delay(10000).hide(2000);
+              return;
+            }
+            if (data.src) {
+              if (typeof imageInfos_id == "undefined") return;
+              if (!data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) {
+                Autosize_resize(true, options);
+              }
+            }
+          });
+      //_________ theMainImage  ___________
 
 
@@ -1118,10 +1091,19 @@
     //__________________ Wait_pamoorama ______________________
     jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) {
-      n = window.myPamoorama;
-      n = this;
+
+
+
+
+
+    }).mouseover(function (i) {
+
     })
+
 
     Wait_pamoorama_time = function () {
       if (nopano == true) return true;
+
+
+
       if (jQuery("#pamoorama").length) {
         tempo = tempo + 1;
@@ -1152,4 +1134,5 @@
 
         nopano = true;
+
         Zone_image = { image_init: { width: mypanorama.imageWidth,
           height: mypanorama.imageHeight
@@ -1309,5 +1292,6 @@
                 maxi_size = size_derive;
                 maxi_size.idx = n;
-                return false
+                if (options.pictureSelType == "SelMaxi" || options.pictureSelType == "Autosize")
+                  return false
               }
             }
@@ -1330,4 +1314,5 @@
 
         }
+
         options.pictureDeriv = pt[n][0];
         return { url: pt[n][1], pictureDeriv: pt[n][0], pictureMap: pt[n][0], width: pt[n][2], height: pt[n][3] };
@@ -1350,11 +1335,21 @@
         options.theImageMargeZone = Zone_image.marges;
         if (Type_Img != 'charlie') {
+          /*
           if (options.pictureSelType != "SelMaxi" && options.pictureSelType != "Autosize") {
-            return;
+          options.pictureMap = options.pictureDeriv;
+            
+          imgSrc = options.liste_type[6];
+          changeImgSrc(imgSrc, options.pictureDeriv, options.pictureMap, options.pictureSelType);
+          src = theImg.src;
+          return;
           } else {
-            IMg = Get_Maxi(Zone_image.image);
+          IMg = Get_Maxi(Zone_image.image);
           }
+          */
+          IMg = Get_Maxi(Zone_image.image);
           imgSrc = IMg.url;
-          options.imgSrc = imgSrc;
+          if (options.imgSrc.match(RegExp(imgSrc, "gi")))
+            options.imgSrc = imgSrc;
+
           img_width = IMg.width;
           img_height = IMg.height;
@@ -1376,12 +1371,7 @@
         Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height;
         if (typeof Zone_image.src == "undefined") Zone_image.src = " ";
-        status = imgSrc.match(RegExp(Zone_image.src, "gi")); // status = '' si !=
-        status1 = (imgSrc.toString() == Zone_image.src.toString());
-
-        if (status1 == true) {
-          //  changeImgSrc(imgSrc, IMg.pictureMap, IMg.pictureDeriv, options.pictureSelType);
-          return;
-
-        }
+
+        identique = Zone_image.src.match(RegExp(imgSrc, "gi"));
+        if (identique) return;
         href_path = "javascript:changeImgSrc('" + imgSrc + "', '" + IMg.pictureMap + "', '" + IMg.pictureDeriv + "', '" + options.pictureSelType + "')";
         jQuery(".linkAutosize").attr("href", href_path);
@@ -1392,7 +1382,6 @@
           imgSrc_j = jQuery(theImg).css("background-image");
           return;
-
         } else {
-          theImg.src = imgSrc;
+          changeImgSrc(imgSrc, IMg.pictureDeriv, IMg.pictureMap, options.pictureSelType);
         }
 
@@ -1673,27 +1662,15 @@
 
         }
-
-
-
-
-      }
-
-
-
+      }
+      //=================================================================
       Zone_image.image = {
         width: width_theMainImage,
         height: height_theMainImage,
         rapport: width_theMainImage / height_theMainImage
-
       };
-
-
-      //=================================================================
       Zone_image.marges = { width: marge_left + marge_right + retrait_img.width,
         height: marge_top + marge_bottom + retrait_img.height
-
       }
       Zone_image.src = jQuery(theMainImage_id).attr("src");
-
     }
 
@@ -1716,8 +1693,4 @@
       options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight;
       options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop;
-
-
-
-
       var chk = eval("options." + user_status + "_enabled");
       if (chk == "") { return; }
@@ -1837,8 +1810,5 @@
     *  init_gen
     *****************************/
-
     init_gen = function (e) {
-
-
       theImg = document.getElementById(theMainImage_id.replace("#", ""));
       //==================================================
@@ -1944,5 +1914,7 @@
       pictureDeriv = options.pictureDeriv;
       Autosize_resize(true, options);
+      Autosize_resize(true, options);
       return;
+
       IMg = Get_Maxi(Zone_image.image);
       imgSrc = IMg.url;
@@ -2200,5 +2172,5 @@
 
 
-  });                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         // ready
+  });                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             // ready
 
 
Index: /extensions/Autosize/main.inc.php
===================================================================
--- /extensions/Autosize/main.inc.php	(revision 18935)
+++ /extensions/Autosize/main.inc.php	(revision 18936)
@@ -23,5 +23,14 @@
 );
 
-if (isset($_GET['cl_debug']) && $_GET['cl_debug']=="NO"){
+global $conf ;
+  if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') {
+      $DEBUG_autosize="";
+  }else{
+    $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ;
+    $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] :  $DEBUG_autosize ;
+    $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ;    
+    }
+
+if(preg_match("|NO|", $DEBUG_autosize, $val)) {  
 
 }else{
@@ -37,24 +46,14 @@
 add_event_handler('get_admin_plugin_menu_links', array(&$autosize_ctrl,'cl_autosize_admin')  );
 
-  if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') {
-      $DEBUG_autosize="";
-  }else{
-    $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ;
-    $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] :  $DEBUG_autosize ;
-    $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ;
- //===============================================================
-}
+//===============================================================
 if(!preg_match("|NO|", $DEBUG_autosize, $val)) {  
-// init cl_autosize_script_1 cl_autosize_affiche 
-//Important avant pamooramics, gvideo
-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'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2  );
-add_event_handler('render_element_content',  array(&$autosize_ctrl,'init2'),EVENT_HANDLER_PRIORITY_NEUTRAL+1,2  );
-add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_1') );
-add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_2')  );
-add_event_handler('loc_after_page_header',array(&$autosize_ctrl, 'cl_autosize_script_3')  );
-add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL +21    );
-}
+    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'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2  );
+    add_event_handler('render_element_content',  array(&$autosize_ctrl,'init2'),EVENT_HANDLER_PRIORITY_NEUTRAL+1,2  );
+    add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_1') );
+    add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_2')  );
+    add_event_handler('loc_after_page_header',array(&$autosize_ctrl, 'cl_autosize_script_3')  );
+    add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL +21    );
+    }
 } ;
 
Index: /extensions/Autosize/maintain.inc.php
===================================================================
--- /extensions/Autosize/maintain.inc.php	(revision 18935)
+++ /extensions/Autosize/maintain.inc.php	(revision 18936)
@@ -62,20 +62,23 @@
  global $conf ;
  global $infos_message , $erreur_message ,$warnings_message ;
- if (isset($conf['cl_derivatives_sav']))  {    
-    $arr = unserialize($conf['cl_derivatives_sav']);         
-      if(isset($arr['d'])){
-          $conf['derivatives'] = $conf['cl_derivatives_sav'];
-        }
-          $query = '
-          UPDATE '.CONFIG_TABLE.'
-            SET value="'.addslashes(serialize($arr)).'"
-          WHERE param = "derivatives"
-          LIMIT 1';
-          pwg_query($query);
+   $arr = @unserialize($conf['derivatives']);
+        if(isset($arr['d']['Autosize'])){    
+                unset(  $arr['d']['SelMaxi']); 
+                unset(  $arr['d']['Autosize']);  
+                $conf['derivatives']=serialize($arr);
+                $arr = @unserialize($conf['derivatives']);       
+                  $query = '
+                      UPDATE '.CONFIG_TABLE.'
+                      SET value="'.addslashes(serialize($arr)).'"
+                      WHERE param = "derivatives"
+                      LIMIT 1';
+                  pwg_query($query);              
+            } 
+
+      if (isset($conf['cl_derivatives_sav']))  {    
           $q = 'DELETE FROM '.CONFIG_TABLE.' WHERE param="cl_derivatives_sav"   ;';
           pwg_query($q);
-         unset ( $conf['cl_derivatives_sav']);         
-       
-    }   
+         unset ( $conf['cl_derivatives_sav']);    
+      }   
       $model= $conf['derivative_default_size'];
       $_COOKIE  ['picture_deriv'] = $model;  
