Index: /extensions/Autosize/autosize.inc.php
===================================================================
--- /extensions/Autosize/autosize.inc.php	(revision 17191)
+++ /extensions/Autosize/autosize.inc.php	(revision 17192)
@@ -27,6 +27,7 @@
  static public function cl_autosize_script_1()
 	{
-		global  $template,$user,$conf,$picture ,$page, $cl_plugin ;
- 
+  global $user,$page,$template,$cl_plugin;
+
+  
  // header ('X-UA-Compatible: n=7')  ;
  // header ('X-UA-Compatible: IE=Edge')  ;
@@ -58,5 +59,6 @@
         'AUTOSIZE_PATH' => str_replace("../","",AUTOSIZE_PATH)  ,
         'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS,
-        'Version_pwg' => PHPWG_VERSION       
+        'Version_pwg' => PHPWG_VERSION       ,
+            'loading' => AUTOSIZE_PATH . 'images/loading.gif'
          )
     );
@@ -71,6 +73,9 @@
  {
 	   global  $template,$user,$conf,$picture ,$page, $cl_plugin,$known_script ;
+
+     		global  $template,$user,$conf,$picture ,$page, $cl_plugin ;
+
    if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ;
-
+   if (!isset($PAMOORAMICS_PATH)) return ;    
 			$AUTOSIZE_PATH = dirname(__FILE__).'/';
 //================================================================
@@ -155,63 +160,46 @@
 
   // this is the default handler that generates the display for the element
- static public function autosize_RenderContent($content, $element_info)
+ static public function autosize_calcContent($content)
 {
-  global $conf;  
-  if ( !empty($content) )
-  {// someone hooked us - so we skip;
-    return $content;
-  }
-  if (isset($_COOKIE['picture_deriv']))
-  {
-    if ( array_key_exists($_COOKIE['picture_deriv'], ImageStdParams::get_defined_type_map()) )
-    {
-      pwg_set_session_var('picture_deriv', $_COOKIE['picture_deriv']);
+  global $conf; 
+   
+ global $page, $template,$picture;
+
+
+  $current = $template->get_template_vars('current'); 
+  $defined_types = array_keys(ImageStdParams::get_defined_type_map());  
+if (isset($current)){ 
+    if (!isset($current['selected_derivative'])){  
+      $model= $defined_types[count($defined_types)-1];
+      $selected_derivative =      $current['derivatives'][$model];
+      $template->append('current', array(
+      'selected_derivative' => $selected_derivative
+    ), true);
+
+
+    $current = $template->get_template_vars('current');
+        } 
+
+         $derivative=$current['selected_derivative'] ;
+          $imgScaledWH=$derivative->src_image->get_size();
+          $imgSizeWH  =  $derivative->get_size();	
+          $img_type  =  $derivative->get_type();	
+          $img_url  = $derivative->get_url();
+          $img_all= $derivative->get_all($derivative->src_image);
+          $scaled_size=$derivative->get_size_hr(); //792 x 441
+          $scaled_size=$derivative->get_scaled_size_htm(); // width="792" height="441"
+         //================= taille mis a l'échelle 
+          $scaled_size=$derivative->get_scaled_size(100,100); // array([0]=>100,[1]=>55)
+          $src= $derivative->src_image ;
+       
     }
-    setcookie('picture_deriv', false, 0, cookie_path() );
-  }
-  $deriv_type = pwg_get_session_var('picture_deriv', $conf['derivative_default_size']);
-  $selected_derivative = $element_info['derivatives'][$deriv_type];
-
-  $unique_derivatives = array();
-  $show_original = isset($element_info['element_url']);
-  $added = array();
-  foreach($element_info['derivatives'] as $type => $derivative)
-   $element_info['derivatives']['Autosize']=$derivative; // last
-
-  foreach($element_info['derivatives'] as $type => $derivative) {     
-  if ($type=='Autosize'){    
-       
-    $url = $derivative->get_url(); 
-    if (isset($added[$url]))
-      continue;
-    $added[$url] = 1;
-    $show_original &= !($derivative->same_as_source());
-    $unique_derivatives[$type]= $derivative;
-     }
-
-  }
-
-  global $page, $template;
-
-  if ($show_original)
-  {
-    $template->assign( 'U_ORIGINAL', $element_info['element_url'] );
-  }
-
-  $template->append('current', array(
-      'selected_derivative' => $selected_derivative,
-      'unique_derivatives' => $unique_derivatives,
-    ), true);    
-      $file =AUTOSIZE_PATH_ABS.'template/picture_content.tpl' ;
-  $template->set_filenames(
-    array('autosize_content'=> $file)
-    );
-
-  $template->assign( array(
-      'ALT_IMG' => $element_info['file'],
-      'COOKIE_PATH' => cookie_path(),
-      )
-    );
-   return $template->parse( 'autosize_content', false);
+ 
+    $img_scaled_width=isset($imgScaledWH)?$imgScaledWH[0]:"480";
+    $img_scaled_height=isset($imgScaledWH)?$imgScaledWH[1]:"320";
+    $current = $template->get_template_vars('picture');
+    $picture['current']['scaled_width']=$img_scaled_width;
+    $picture['current']['scaled_height']= $img_scaled_height;
+    $picture['current']['image_url']=$src->rel_path;
+    
  }
 
@@ -228,4 +216,5 @@
  if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ;
 		load_language('plugin.lang', AUTOSIZE_PATH);
+
 		$AUTOSIZE_PATH = dirname(__FILE__).'/';
 		 if (isset( $page['body_id']) && $page['body_id']=='thePicturePage'  ) {
@@ -271,5 +260,5 @@
         $template->parse('mes_script');
       }     
-        
+            
         return $template->parse( 'autosize_content', false);
      				  }
Index: /extensions/Autosize/css/autosize.css
===================================================================
--- /extensions/Autosize/css/autosize.css	(revision 17191)
+++ /extensions/Autosize/css/autosize.css	(revision 17192)
@@ -1,13 +1,14 @@
   
 #theImage {
-    opacity: 100;
-    filter: alpha(opacity:100);
+/*    opacity: 0.1;
+    filter: alpha(opacity:10);
+    */
     
 }
-body{
- 
+body {
+
 }
 #the_page {
-  /*  
+  /*  background-color: #FF0000;
   margin-top: -4px;
 position:static ;*/
@@ -23,5 +24,10 @@
 }
 
-
+#imageHeaderBar {background-color: transparent;
+  /*  
+  margin-top: -4px;
+position:static ;*/
+   
+}
 #navThumbNext, #navThumbPrev{ /*height:200px;*/
 
@@ -34,20 +40,21 @@
 }
 #content {
-/* 
-  border: 5px solid #00FF00;
-padding:10px;
- margin:15px
+ /* background-color: transparent;*/
+ 
+}
+#theImage {   /* 
+ background-image: url('../images/quadrille_100.gif');
+  margin: 5px; 
+ border: 10px solid #0000F0;
+  padding: 20px; 
  */
-}
-#theImage {  
- /*  padding: 10px;  margin: 10px;
- border: 5px solid #0000F0;
-  background-color: #0000FF; 
-   background-image: url('../images/quadrille_100.gif');
-   */ }
+ /*  background-color: transparent;*/ 
+   }
   
+.licencetag,.imageComment{
+ 
+  }
 
-
-#theMainImage {
+#theMainImage { 
 /*
   margin: 15px;
@@ -57,11 +64,21 @@
  background-color: #0000FF; */
 }
+#imageInfos{ 
+overflow:hidden ;
+/* 
+margin : 0px;
+  border: 0px solid #00f0f0;
+  padding: 10px;*/ 
 
-#imageInfos, #imageInfoBar {
-/* margin : 20px;
-  border: 20px solid #FFf0f0;
+ }
+ 
+#imageInfoBar {
+/* 
+margin : 20px;
+  border: 20px solid #00f0f0;
   padding: 20px;
- 
- background-color: #FF0000; */
+
+ background-color: #00FF00; 
+ opacity:0.3 ;*/ 
 }
 #thePicturePage{
@@ -71,2 +88,76 @@
 
 
+#Debug0 {
+  align: center;
+  color: black;
+/*  z-index: 2000;*/
+  position: absolute;
+  background-color: Beige;
+  top: 0px;
+  left: 0px;
+  width: 800px;
+  margin: auto;
+}
+#Debug1 {
+  align: center;
+  color: black;
+/*  z-index: 2000;*/
+  position: absolute;
+  background-color: Beige;
+  top: 0px;
+  left: 0px;
+  width: 800px;
+  margin: auto;
+}
+
+
+#Debug2 {
+  align: center;
+  color: black;
+ /*  z-index: 2000;*/
+  position: absolute;
+  background-color: yellow;
+  top: 0px;
+  left: 0px;
+  width: 800px;
+  margin: auto;
+}
+#Debug3 {
+  align: center;
+  color: #FFFFFF;
+/*  z-index: 2000;*/
+  position: absolute;
+  background-color: blue;
+  top: 0px;
+  left: 0px;
+  width: 800px;
+  margin: auto;
+}
+#Debug4 {
+  align: center;
+  color: #CCFF33;
+  
+/*  z-index: 2000;*/
+  background-color: green;
+  top: 0px;
+  left: 0px;
+  width: 800px;
+  margin: auto;
+}
+
+
+#Debug5 {
+  align: center;
+/*  z-index: 2000;*/
+  z-index: 2000;
+  position: absolute;
+  background-color: red;
+  top: 100px;
+  left: 0px;
+  width: 300px;
+  margin: auto;
+}
+#Debug6 {
+  align: center;
+  display: none;
+}
Index: /extensions/Autosize/include/affiche.php
===================================================================
--- /extensions/Autosize/include/affiche.php	(revision 17191)
+++ /extensions/Autosize/include/affiche.php	(revision 17192)
@@ -8,5 +8,5 @@
 
  ; 
-//=================================================================================================
+//==============================================================================
 $DEBUG_autosize = isset($_POST['cl_debug_conflit']) ? $_POST['cl_debug_conflit'] : "false" ;
 $DEBUG_autosize = isset($_GET['cl_debug_conflit']) ? $_GET['cl_debug_conflit'] : $DEBUG_autosize ;
@@ -28,24 +28,33 @@
   }
   $deriv_type = pwg_get_session_var('picture_deriv', $conf['derivative_default_size']);
+  $defined_types = array_keys(ImageStdParams::get_defined_type_map());  
 
-if (isset($current)){
- $derivative=$current['selected_derivative'] ;
-  $imgScaledWH=$derivative->src_image->get_size();
-	$imgSizeWH  =  $derivative->get_size();	
-  $img_type  =  $derivative->get_type();	
-  $img_url  = $derivative->get_url();
-  $img_all= $derivative->get_all($derivative->src_image);
-  $scaled_size=$derivative->get_size_hr(); //792 x 441
-   $scaled_size=$derivative->get_scaled_size_htm(); // width="792" height="441"
-   //================= taille mis a l'échelle 
-   $scaled_size=$derivative->get_scaled_size(100,100); // array([0]=>100,[1]=>55)
-  $src= $derivative->src_image ;
-     
-    }
-
-          $defined_types = array_keys(ImageStdParams::get_defined_type_map());      
+if (isset($current)){ 
+    if (!isset($current['selected_derivative'])){  
+      $model= $defined_types[count($defined_types)-1];
+      $selected_derivative =      $current['derivatives'][$model];
+      $template->append('current', array(
+      'selected_derivative' => $selected_derivative
+    ), true);
 
 
+    $current = $template->get_template_vars('current');
+        } 
+         $derivative=$current['selected_derivative'] ;
+          $imgScaledWH=$derivative->src_image->get_size();
+          $imgSizeWH  =  $derivative->get_size();	
+          $img_type  =  $derivative->get_type();	
+          $img_url  = $derivative->get_url();
+          $img_all= $derivative->get_all($derivative->src_image);
+          $scaled_size=$derivative->get_size_hr(); //792 x 441
+          $scaled_size=$derivative->get_scaled_size_htm(); // width="792" height="441"
+         //================= taille mis a l'échelle 
+          $scaled_size=$derivative->get_scaled_size(100,100); // array([0]=>100,[1]=>55)
+          $src= $derivative->src_image ;
+       
+    }
+ 
 
+  
 $img_width=isset($imgScaledWH)?$imgSizeWH[0]:"480";
 $img_height=isset($imgScaledWH)?$imgSizeWH[1]:"320";
Index: /extensions/Autosize/js/Affiche_script.js
===================================================================
--- /extensions/Autosize/js/Affiche_script.js	(revision 17191)
+++ /extensions/Autosize/js/Affiche_script.js	(revision 17192)
@@ -3,313 +3,2408 @@
 // corriger   gmaps_pip.class.inc.php ajouter ligne 90 if ( !isset($_GET['slideshow']))
 //==============================================================
-jQuery(document).ready(function (jQuery) {
-  //=============================================================
-  // REPONSE ACTION
-  //=============================================================
-  jQuery("#reset").click(function () {
-    location.reload();
-  });
-
-
-  //===========================================================
-  //  REPONSE TRIGGER 
-  //===========================================================
-  jQuery('#pamoorama').live('ON', function (e) {
-    jQuery(jQuery('.debug').get(1)).trigger('ON');
-    if (typeof Bandeau_bas == "undefined" || Bandeau_bas.width == 0) {
-      Bandeau_bas = infos_Description_f("#theImage");
-      Bandeau = Bandeau_bas.top;
+
+(function (jQuery) {
+  jQuery.Affiche_script = { version: '1.0' };
+
+  var theMainImage_Id = "#theMainImage";
+  var Zone_image;
+  /********************************************
+  *  document ready
+  ********************************************/
+  jQuery(document).ready(function (jQuery) {
+    /********************************************
+    *  window unLOAD
+    ********************************************/
+    jQuery(window).unload(function () {
+
+      try {
+
+        if (typeof theMainImage_Id != "undefined") {
+
+          useMap = options.useMap;
+          pictureMap = jQuery.cookie('picture_map');
+          typeSave = jQuery.cookie('picture_deriv');
+
+          old_img = jQuery.cookie('img');
+          old_window_height = jQuery.cookie('window_height');
+          old_window_width = jQuery.cookie('window_width');
+          old_img_h = jQuery.cookie('img_h');
+          old_img_w = jQuery.cookie('img_w');
+
+          set_cookies({
+            window_height: infos_window.height,
+            window_width: infos_window.width,
+            img_h: infos_theMainImage.height,
+            img_w: infos_theMainImage.width
+          });
+
+        }
+      } catch (r) {
+
+      }
+
+    }); //unload
+
+
+    //=========================================================
+    messages = "This frame uses the W3C box model: <span>" + jQuery.support.boxModel + "</span>";
+    messages += "This frame uses the html5Clone: <span>" + jQuery.support.html5Clone + "</span>";
+    // jQuery("p").html(messages);
+    if (typeof (options) == "undefined") {
+      options = { imageAutosize: false }
     }
-  });
-  //=============================================================
-  jQuery('#ret_autosize').live('ON', function (e) {
-    if (nu_img == "") nu_img = 8;
-    jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
-
-  });
-
-  //==========================================================
-  jQuery("map area").mouseover(function (e) {
-    hok = this;
-
-  });
-
-  //==================================
-  // jQuery("#llgbo").trigger("ON");
-  //==================================
-  jQuery(llgbo_id).live('ON', function (e) {
-    n_id = this;
-    infos_llgbo = jQuery(llgbo_id).infos();
-    if (infos_llgbo.visible == false) return;
-
-    marges_llgbo = 0;
-    if (infos_llgbo.height > 0) {
-      infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
-      infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
-      //=============================================
-      ll2 = infos_llgboframe1.width; // llgboframe1
-      ll1 = infos_llgboframe31.general.width; // llgboframe31
-      options.marges_llgbo = (ll1 - ll2);
-      infos_llgboh2 = jQuery("#llgboh2").infos();
+    options = jQuery.extend(Autosize_options, options);
+    var defaults = {
+      useMap: '#Autosize',
+      imageAutosizeMargin: 0,
+      imageAutosize: false,
+      marge_basse: options.imageAutosizeMargin || 0,
+      DEBUG_autosize: false
+    };
+
+    options = jQuery.extend(defaults, options);
+    jQuery("#form_autosize_picture").addClass("Autosize_margin");
+    //===== marges suplémentaires en fonction theme ===
+    options.marge_haute = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("top"));
+    options.marge_basse = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("bottom"));
+    options.marge_gauche = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("left"));
+    options.marge_droite = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("right"));
+    fade_in = options.fade_in || 0;
+
+
+
+    if (options.check_desc_v) {
+      infos_Licence = jQuery(".licencetag").infos({ pos_absolute: true });
+      infos_imageComment = jQuery(".imageComment").infos({ pos_absolute: true });
+      options.marge_basse += infos_imageComment.general.height;
     }
-  });
-  //==============================
-  // jQuery("#mapPicture").trigger("ON");
-  //==============================
-  jQuery("#mapPicture").live('ON', function (e) {
-    p2 = jQuery("#infoSwitcher").infos();
-  });
-  //==============================
-  // jQuery("#map").trigger("ON");
-  //==============================
-  jQuery("#map").live('ON', function (e) {
-
-  });
-
-  //===================================
-  // jQuery("#theImage").trigger("ON");
-  //===================================
-  jQuery("#theImage").live('ON', function (e) {
-    target = e.target.id;
-
-    id = this.id;
-    theImage_init("#theImage");
-  });
-
-  /***********************
-  *
-  **********************/
-  jQuery("#theMainImage").error(function (e) {
-    alert(this.src + ' Image does not exist !!');
-  });
-
-  jQuery("#theMainImage,.preload, .next1 , ").load(function (e) {
-    if (init_img(this))
-      setTimeout(function () { Autosize_resize(true) }, 100);
+
+
+
+    DEBUG_autosize = options.DEBUG_autosize;
+    Get_type_img();
+
+    //===================
+    // VARIABLES  
+    //===================
+
+    type_src = "div";
+    old_window = { width: 0, height: 0 };
+    List_autosize = new Array();
     nu_img = 0;
-  });
-
-  //=================================================================
-  jQuery(document).live('gallyInterfaceReady', function (e) {
-    i = jQuery(this).text();
-    jQuery(this).trigger('ON');
-  }
+    tempo = 0;
+    var nopano;
+    var cookies = Get_cookies();
+    var theme = options.theme;
+
+    var Type_Img = "";
+
+    var llgbo_id = "#llgbo0";
+    var infos_llgbo = jQuery(llgbo_id).infos();
+    var infos_llgboh2 = jQuery("#llgboh2").infos();
+    var marges_llgbo = 0;
+Zone_image = {
+      width_init: options.img_width,
+      height_init: options.img_height,
+      rapport_init: options.img_width / options.img_height
+    };
+
+    var theImageAndInfos_id = "#theImageAndInfos";
+
+    if (options.theme.match(RegExp("simple", "gi"))) {
+      theImageAndInfos_id = "#content";
+      jQuery(theMainImage_Id).attr("position", "static");
+
+    } else {
+      infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
+      if (infos_theImageAndInfos.visible == false)
+        theImageAndInfos_id = "#imageContainer";
+    }
+
+    theImage_id = "#theImage";
+    imageInfos_id = "#imageInfos";
+    theMainImage_Id = "#theMainImage";
+
+    infos_theImage = jQuery(theImage_id).infos({ pos_absolute: true });                 // conteneur
+    infos_imageInfos = jQuery(imageInfos_id).infos({ pos_absolute: true });             // information
+    infos_theMainImage = jQuery(theMainImage_Id).infos({ pos_absolute: true });         // Image  
+    /************************************
+    *
+    *************************************/
+
+    infos_theImage = jQuery(theImage_id).infos({ pos_absolute: true });                 // conteneur
+    infos_imageInfos = jQuery(imageInfos_id).infos({ pos_absolute: true });             // information
+    infos_theMainImage = jQuery(theMainImage_Id).infos({ pos_absolute: true });         // Image   
+
+    infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
+    var infos_theImage = jQuery("#theImage").infos();                  // Container
+    var infos_imageInfos = jQuery("#imageInfos").infos();              // Informations
+
+    var infos_the_page = jQuery("#the_page").infos();
+    var infos_content = jQuery("#content").infos();
+    var infos_titrePage = jQuery("#titrePage").infos();
+    var infos_imageInfoBar = jQuery("#imageInfoBar").infos();
+    var infos_theHeader = jQuery("#theHeader").infos();
+    var infos_imageToolBar = jQuery("#imageToolBar").infos();
+    var infos_imageHeaderBar = jQuery("#imageHeaderBar").infos();
+    var infos_body = jQuery("body").infos();
+
+
+    var Type_Img = "";
+
+    //=============================================================
+    // REPONSE ACTION
+    //=============================================================
+    jQuery("#reset").click(function () {
+      location.reload();
+    });
+    var mouseLocation = new Point(-500, -500);
+    //========================================================
+    jQuery("#pamoorama").live("on", function (e) {
+      myPamoorama = window.myPamoorama;
+    });
+    jQuery("#pamoorama_inner").live("on", function (e) {
+      myPamoorama = window.myPamoorama;
+    });
+
+    function Point(x, y) {
+      this.x = x; this.y = y;
+    }
+    register_position();
+
+    function register_position() {
+      mouse_x = 0;
+      mouse_y = 0;
+      //  document.onmousemove = position;
+
+    }
+
+    function position(evt) {
+      if (!evt) evt = window.event;
+      mouseLocation.x = evt.clientX;
+      mouseLocation.y = evt.clientY;
+      affiche_debug({
+        Debug1: Debug_info(1, "x:" + mouseLocation.x + " y: " + mouseLocation.y, "position:"),
+        Debug2: Debug_info(2, "pos_top:" + options.pos_top + " marge_right: " + options.marge_right, "marges:"),
+
+        Debug5: Debug_info(5, "X:" + infos_theMainImage.left +
+    "Y:" + infos_theMainImage.top +
+    "W:" + infos_theMainImage.exterieur.width +
+    "H:" + infos_theMainImage.exterieur.height
+    , infos_theMainImage.id)
+      });
+
+
+    }
+
+    jQuery("div,a,img").mousemove(function (evt) {
+
+      if (!evt) evt = window.event;
+      mouseLocation.x = evt.clientX;
+      mouseLocation.y = evt.clientY;
+      Context = jQuery(this).context.nodeName;
+      obj_id = "#" + this.id.toString();
+      infos_g = jQuery(obj_id).infos(true);
+      infos_g.top = jQuery(obj_id).absoluteTop();
+
+
+      affiche_debug({
+        Debug1: Debug_info(1, "x:" + mouseLocation.x
+    + " y: " + mouseLocation.y
+    + " id: " + obj_id
+    + " top: " + infos_g.top,
+    +" Node: " + Context
+    , "->")
+    ,
+        Debug2: Debug_info(2, "W:" + infos_g.general.width
+    + " H: " + infos_g.general.height
+    + " id: " + obj_id
+    + " top: " + infos_g.top,
+    +" Node: " + Context
+    , "->")
+      });
+
+    });
+
+
+
+    //===========================================================
+    //  REPONSE TRIGGER 
+    //===========================================================
+
+
+    jQuery('#ret_autosize').live('ON', function (e) {
+      if (nu_img == "") nu_img = 8;
+      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
+
+    });
+
+    //==========================================================
+    jQuery("map area").mouseover(function (e) {
+      hok = this;
+
+    });
+
+    //==================================
+    // jQuery("#llgbo").trigger("ON");
+    //==================================
+    jQuery(llgbo_id).live('ON', function (e) {
+      n_id = this;
+      infos_llgbo = jQuery(llgbo_id).infos();
+      if (infos_llgbo.visible == false) return;
+
+      marges_llgbo = 0;
+      if (infos_llgbo.height > 0) {
+        infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
+        infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
+        //=============================================
+        ll2 = infos_llgboframe1.width; // llgboframe1 interieur
+        ll1 = infos_llgboframe31.exterieur.width; // llgboframe31 avec border width
+        options.marges_llgbo = (ll1 - ll2);
+        infos_llgboh2 = jQuery("#llgboh2").infos();
+      }
+    });
+    //==============================
+    // jQuery("#mapPicture").trigger("ON");
+    //==============================
+    jQuery("#mapPicture").live('ON', function (e) {
+      p2 = jQuery("#infoSwitcher").infos();
+    });
+    //==============================
+    // jQuery("#map").trigger("ON");
+    //==============================
+    jQuery("#map").live('ON', function (e) {
+      p2 = jQuery("#map").infos();
+    });
+    //===================================
+    // jQuery("#theImage").trigger("ON");
+    //===================================
+    jQuery("#imageInfos").live('on', function (e) {
+      target = e.target.id;
+    });
+
+    //===================================
+    // jQuery("#theImage").trigger("ON");
+    //===================================
+    jQuery("#theImage").live('ON', function (e) {
+      target = e.target.id;
+
+      id = this.id;
+      theImage_init();
+    });
+
+    /***********************
+    *
+    **********************/
+    jQuery("#theMainImage").error(function (e) {
+      alert(this.src + ' Image does not exist !!');
+    });
+
+    jQuery("#theMainImage,.preload, .next1 , ").load(function (e) {
+      if (this.complete) {
+        theMainImage_id = "#" + this.id;
+        jQuery(theMainImage_id).show(1000);
+      }
+
+      if (typeof theMainImage_id != "undefined")
+        if (init_img(this))
+          setTimeout(function () { Autosize_resize(true) }, 5);
+      nu_img = 0;
+    });
+
+    //=================================================================
+    jQuery(document).live('gallyInterfaceReady', function (e) {
+      i = jQuery(this).text();
+      jQuery(this).trigger('ON');
+    }
 
           );
-  // jQuery("#theImage").trigger("OK");
-  jQuery("#theImage").live('Start_right', function (e) {
-    if (typeof Zone_image == "undefined") return
-    if (nu_img == "") nu_img = 7;
-    jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
-    test_w = window.myPamoorama.autoSlideFx.to;
-    test_w = window.myPamoorama.autoScrollFx.to;
-    nf = jQuery("#pamoorama_thumb").height();
-    jQuery("#pamoorama_thumb img").width(200);
-    jQuery("#pamoorama_thumb img").height(nf);
-    // 200=window.myPamoorama.imageWidth 
-    // frame = Zone_image.container.width
-    if (Zone_image.container)
-      nw = (200 * Zone_image.container.width) / window.myPamoorama.imageWidth;
-    else
-      nw = (200 * infos_content.width) / window.myPamoorama.imageWidth;
-    jQuery("#pamoorama_frame").width(nw);
-
-
-
-  });
-
-  jQuery("#theImage").live('Start_left', function (e) {
-    if (typeof Zone_image == "undefined") return
-    if (nu_img == "") nu_img = 7;
-    jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
-    test_w = window.myPamoorama.autoSlideFx.to;
-    test_w = window.myPamoorama.autoScrollFx.to;
-    nf = jQuery("#pamoorama_thumb").height();
-    jQuery("#pamoorama_thumb img").width(200);
-    jQuery("#pamoorama_thumb img").height(nf);
-
-    nw = (200 * Zone_image.container.width) / window.myPamoorama.imageWidth;
-    jQuery("#pamoorama_frame").width(nw);
-
-  });
-
-  // Custom Event, ON to turn on a debug.
-  jQuery('.debug').live('ON', function (e) {
-
-    nu_img = jQuery(this).text();
-    jQuery('.debug').trigger('OFF');
-    jQuery(this).addClass('debugOn');
-
-  });
-
-  // On Click = debugs On
-  jQuery('.debug').live('click', function (e) {
-    i = jQuery(this).text();
-    jQuery(this).trigger('ON');
-  });
-
-  // Custom Event, Turn off a debug
-  jQuery('.debug').live('OFF', function (e) {
-    jQuery(this).removeClass('debugOn');
-  });
-
-  // on Double Click, remove the debug from the DOM
-  jQuery('.debug').live('dblclick', function () {
-    jQuery(this).fadeOut(function () { jQuery(this).remove() });
-  });
-
-  // Add another debug to the DOM
-  jQuery('#adddebugs').click(function () {
-    i = jQuery('.debug').length;
-    jQuery('<div>' + i + '</div>')
+
+
+    jQuery('#pamoorama').live('ON', function (e) {
+      jQuery(jQuery('.debug').get(1)).trigger('ON');
+      if (typeof Bandeau_bas == "undefined" || Bandeau_bas.width == 0) {
+        Bandeau_bas = infos_Description_f("#theImage");
+        Bandeau = Bandeau_bas.top;
+      }
+    });
+    // jQuery("#theImage").trigger("OK");
+    jQuery("#theImage").live('Start_right', function (e) {
+      if (typeof Zone_image == "undefined") return
+      if (nu_img == "") nu_img = 7;
+      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
+      test_w = window.myPamoorama.autoSlideFx.to;
+      test_w = window.myPamoorama.autoScrollFx.to;
+      nf = jQuery("#pamoorama_thumb").height();
+      jQuery("#pamoorama_thumb img").width(200);
+      jQuery("#pamoorama_thumb img").height(nf);
+      // 200=window.myPamoorama.imageWidth 
+      // frame = Zone_image.container.width
+      if (Zone_image.container)
+        nw = (200 * Zone_image.container.width) / window.myPamoorama.imageWidth;
+      else
+        nw = (200 * infos_content.width) / window.myPamoorama.imageWidth;
+      jQuery("#pamoorama_frame").width(nw);
+
+
+
+    });
+
+    jQuery("#theImage").live('Start_left', function (e) {
+      if (typeof Zone_image == "undefined") return
+      if (nu_img == "") nu_img = 7;
+      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
+      test_w = window.myPamoorama.autoSlideFx.to;
+      test_w = window.myPamoorama.autoScrollFx.to;
+      nf = jQuery("#pamoorama_thumb").height();
+      jQuery("#pamoorama_thumb img").width(200);
+      jQuery("#pamoorama_thumb img").height(nf);
+      if (typeof Zone_image.container != "undefined") return;
+      try {
+        nw = (200 * Zone_image.container.width) / window.myPamoorama.imageWidth;
+        jQuery("#pamoorama_frame").width(nw);
+      } catch (e) {
+
+      }
+
+    });
+
+    // Custom Event, ON to turn on a debug.
+    jQuery('.debug').live('ON', function (e) {
+
+      nu_img = jQuery(this).text();
+      jQuery('.debug').trigger('OFF');
+      jQuery(this).addClass('debugOn');
+
+    });
+
+    // On Click = debugs On
+    jQuery('.debug').live('click', function (e) {
+      i = jQuery(this).text();
+      jQuery(this).trigger('ON');
+    });
+
+    // Custom Event, Turn off a debug
+    jQuery('.debug').live('OFF', function (e) {
+      jQuery(this).removeClass('debugOn');
+    });
+
+    // on Double Click, remove the debug from the DOM
+    jQuery('.debug').live('dblclick', function () {
+      jQuery(this).fadeOut(function () { jQuery(this).remove() });
+    });
+
+    // Add another debug to the DOM
+    jQuery('#adddebugs').click(function () {
+      i = jQuery('.debug').length;
+      jQuery('<div>' + i + '</div>')
           .addClass('debug')
           .appendTo('#debugsContainer');
-  });
-
-
-  /*********************************
-  *
-  ********************************/
-  jQuery("#menuSwitcher,#infoSwitcher").click(function (e) {
-
-    setTimeout(function () { Autosize_resize(true) }, 10);
-    nu_img = 0;
-  });
-
-
-  //===========================================
-  // jQuery("#theImageAndInfos").trigger("ON");
-  //===========================================
-  jQuery("#theImageAndInfos").live('ON', function (e) {
-    infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
-    //   setTimeout(function () { Autosize_resize(true) }, 100);
-    nu_img = 0;
-  }); // fin click #theImageAndInfos ON
-  jQuery("#theImageAndInfos").resize(function (e) {
-
-    nu_img = 0;
-  });
-
-  //==================================
-  //
-  //===================================
-  jQuery('#derivativeCheckedAutosize').click(function () {
-    pathnames = jQuery(this).attr("href").split(":");
-    try {
-      eval(pathnames[1]);
-    } catch (e) {
-      n = false;
-    }
-  }); // fin click derivativeCheckedAutosize
-  //====================================================
-  jQuery("#derivativeSwitchBox a").click(function () {
-    var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
-    if (theImg) {
+    });
+
+
+    /*********************************
+    *
+    ********************************/
+    jQuery("#menuSwitcher,#infoSwitcher").click(function (e) {
+
+      setTimeout(function () { Autosize_resize(true) }, 10);
+      nu_img = 0;
+    });
+
+
+    //===========================================
+    // jQuery("#theImageAndInfos").trigger("ON");
+    //===========================================
+    jQuery("#theImageAndInfos").live('ON', function (e) {
+      infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
+      //   setTimeout(function () { Autosize_resize(true) }, 100);
+      nu_img = 0;
+    }); // fin click #theImageAndInfos ON
+    jQuery("#theImageAndInfos").resize(function (e) {
+
+      nu_img = 0;
+    });
+
+
+    jQuery("#linkAutosize").click(function (e) {
+      nu_img = 0;
+    });
+    //==================================
+    //
+    //===================================
+    jQuery('#derivativeCheckedAutosize').click(function () {
       pathnames = jQuery(this).attr("href").split(":");
-
       try {
         eval(pathnames[1]);
-        n = true;
       } catch (e) {
         n = false;
       }
-
+    }); // fin click derivativeCheckedAutosize
+    //====================================================
+    jQuery("#derivativeSwitchBox a").click(function () {
+      var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
+      if (theImg) {
+        pathnames = jQuery(this).attr("href").split(":");
+
+        try {
+          eval(pathnames[1]);
+          n = true;
+        } catch (e) {
+          n = false;
+        }
+
+        infos_theMainImage = jQuery(theMainImage_Id).infos();
+        infos_theImage = jQuery("#theImage").infos();
+        theImg.removeAttribute("width");
+        theImg.removeAttribute("height");
+
+        var nw = "100% x 100%".split("x");
+        if (jQuery(this).text().match(RegExp("x", "gi"))) {
+          nw = jQuery(this).text().split("(")[1].split(")")[0];
+          nw = nw.split("x");
+          init_img(theImg);
+          wx = parseInt(nw[0]);
+          wh = parseInt(wx / rapport);
+          //jQuery("#theImage").css("height", wh + "px");
+          jQuery(theImg).width(wx);
+          jQuery(theImg).height(wh);
+          set_cl(useMap == "#Autosize");
+          Set_llbgo();
+        }
+
+      }
+
+    });  // fin click #derivativeSwitchBox a
+
+    jQuery("input").click(function () {
+      if (this.name.match(RegExp("_enabled", "gi"))) {
+        sel = "[name*=" + this.name + "]";
+        obj = jQuery("tr" + sel);
+
+        if (this.checked)
+          obj.css({ backgroundColor: "green", color: "white" });
+        else
+          obj.css({ backgroundColor: "red", color: "white" });
+
+        return;
+      }
+
+
+
+      return;
+
+
+
+
+    });
+
+    //====================================
+    Autosize_init = function (name, value) {
+      img_defaut = { height: options.scaled_height, width: options.scaled_width };
+      img_reelle = { height: options.img_height, width: options.img_width };
+      img_init = { height: options.img_height, width: options.img_width };  // taille initiale
+
+      img_finale = img_init;
+      rapport = parseInt(img_init.width) / parseInt(img_init.height);
+      useMap = infos_theMainImage.useMap; // #mapmedium
+
+      useMap = cookies.pictureMap; // #mapxxx
+      typeSave = cookies.typeSave; //picturederiv xxx
+
+
+      old_img = cookies.imgSrc;
+      old_window_height = cookies.windowHeight || jQuery(window).height();
+      old_window_width = cookies.windowWidth || jQuery(window).width();
+      old_img_h = cookies.imgHeight;
+      old_img_w = cookies.imgWidth;
+      if (infos_theMainImage.visible == true) {
+        var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
+        theImg.useMap = useMap;
+      }
+
+    } // Autosize_init
+    //===========================================================================
+    Autosize_resize = function (force, parametres) {
+      fade_in = parseInt(fade_in || 1000);
+
+      if (Get_dimensions(force, parametres)) {
+        jQuery(theMainImage_Id).height(Zone_image.image.height);
+        jQuery(theMainImage_Id).width(Zone_image.image.width);
+        jQuery("#theImageAndInfos").css({ height: "auto" });
+        if (Type_Img == "pamoorama") {
+          jQuery("#theImage").css({ height: "auto" });
+
+        } else {
+          jQuery("#theImage").css({ height: Zone_image.container.height });
+          jQuery("#theImage").width(Zone_image.container.height);
+        }
+        jQuery("#theImage").width(Zone_image.container.width);
+
+
+        Set_Pamoorama();
+
+        set_cl(true);
+      } else {
+        Set_Pamoorama();
+        set_cl(false);
+      }
+
+      jQuery(theMainImage_Id).show(fade_in);
+      Set_llbgo(true);
+      return true;
+
+      //_____________________________________________________   
+    }; // Autosize 
+
+
+
+
+
+    /********************************************
+    *  window LOAD
+    ********************************************/
+    jQuery(window).load(function () {
+      href = location.href;
+      var aff_ok = false;
+      if (DEBUG_autosize == "true") {
+        for (var i = 0; i < 10; i++) {
+          jQuery('#adddebugs').click();
+        }
+        jQuery(jQuery('.debug').get(i - 1)).click();
+      }
+
+      Autosize_init();
+
+
+      /*
+      Bandeau_bas = infos_Description_f("#theImage");
+      if (typeof Bandeau_bas != "undefined") Bandeau = Bandeau_bas.top;
+      else Bandeau = 0;
+      */
+
+      Wait_pamoorama();
+
+      if (!theImage_init()) {
+        Wait_Affichage();
+        Autosize_resize(true, options);
+        Set_llbgo(true);
+
+      } else {
+        set_cl(options.useMap.match(RegExp("Autosize", "gi")));
+        Set_llbgo();
+      }
+      setTimeout(function () { Autosize_resize(true) }, 100);
+
+
+
+      //=================================================================================
+    }); // window.onload
+    /***********************************************************
+    *  RESIZE 
+    ***********************************************************/
+    jQuery(window).resize(
+                       function (event, ui) {
+                         Wait_Affichage();
+                         List_autosize_resize(event, ui);
+                         Autosize_resize(true, options);
+
+
+                       });
+
+    /*****************
+    * changeImgSrc1
+    ******************/
+    changeImgSrc = function (url, typeSave, useMap) {
+      var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
+      if (theImg) {
+        theImg.removeAttribute("width");
+        theImg.removeAttribute("height");
+        //  theImg.useMap = "#map" + useMap;
+
+        jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
+        jQuery('#derivativeChecked' + useMap.replace("#", "")).css('visibility', 'visible');
+        options.useMap = useMap;
+        if (useMap.match("Autosize")) {
+          pictureMap = "#" + "Autosize";
+        } else {
+          pictureMap = "#map" + typeSave;
+        }
+        theImg.src = url; // charge Image 
+        theImg.useMap = pictureMap;
+        //===================================================
+
+
+        infos_theMainImage = jQuery(theMainImage_Id).infos();
+        Zone_image.width_init = infos_theMainImage.width;
+        Zone_image.height_init = infos_theMainImage.height;
+        Zone_image.zoom = (infos_theMainImage.width / infos_theMainImage.height);
+        infos_theMainImage.useMap = theImg.useMap;
+
+        Save_cookies({
+          typeSave: typeSave,
+          pictureMap: pictureMap,
+          imgSrc: url
+        });
+        cookies = Get_cookies();
+
+      }
+
+
+    }          //changeImgSrc1
+    /************************************
+    *
+    ************************************/
+    Wait_pamoorama = function () {
+      if (Type_Img != "pamoorama") return;
+
+      jQuery("#loading").attr("id", "theMainImage");
+
+      Wait_pamoorama_st = false;
+      while (Wait_pamoorama_st == false) {
+        Wait_pamoorama_st = Wait_pamoorama_time();
+      }
+    }
+    Wait_pamoorama_time = function () {
+
+      if (jQuery("#pamoorama").length) {
+        tempo = tempo + 1;
+
+        mypanorama = window.myPamoorama;
+        if (!mypanorama) {
+          tempo = tempo + 1;
+          if (tempo > 2000) return true;
+          nopano = false;
+          setTimeout("Wait_pamoorama_time()", 500);
+          return false;
+
+        }
+
+        if (mypanorama.skipInit == false) {
+          if (tempo > 4000) return true;
+          setTimeout("Wait_pamoorama_time()", 500);
+          return false;
+        }
+        //=============================================================
+        infos_pamoorama = jQuery("#pamoorama").infos();
+        if (Math.abs(infos_pamoorama.height) < 50) {
+          setTimeout("Wait_pamoorama_time()", 500);
+          return false;
+        }
+
+        nopano = true;
+
+        return true;
+
+      }
+    } // Wait_pamoorama
+    //====================================================================================
+    Wait_Affichage = function () {
+      Wait_Affichage_st = false;
+      while (Wait_Affichage_st == false) {
+        Wait_Affichage_st = Wait_Affichage_time();
+      }
+    }
+    //==========================================
+    Wait_Affichage_time = function () {
+      if (typeof fade_in == "undefined") fade_in = 1000;
+      fade_in = parseInt(fade_in);
+      /*
+      if (!Autosize_resize()) {
+      setTimeout("Wait_Affichage()", 500);
+      return
+      }  
+      nu_img++;     
+      */
+      if (typeof fade_in == "undefined") fade_in = 0;
+
+      //   if (nu_img > 1) return;
+      if (typeof stb != "undefined")
+        stb.stop().fadeTo(3500, 0);
+      if (typeof theMainImage_Id == "undefined") return true;
+
+      if (theMainImage_Id.selector) {
+        theMainImage_Id = theMainImage_Id.selector;
+      }
+      if (theMainImage_Id == null) return;
+
+      if (jQuery(theMainImage_Id).length == 0) {
+        if (jQuery("#pamoorama_inner").length > 0) {
+          return true;
+        }
+        //=== attente Image chargée ===
+        if (tempo > 100) return true;
+        tempo++;
+        setTimeout("Wait_Affichage_time()", 500);
+        return false;
+
+      } else {
+
+        img_h = jQuery(theMainImage_Id).height();
+        img_w = jQuery(theMainImage_Id).width();
+
+        jQuery("#src_img_h").val(img_h);
+        jQuery("#src_img_w").val(img_w);
+        jQuery("#ret_autosize").val(infos_theMainImage.src);
+        if (typeof Window_Affichage == "undefined") return;
+        jQuery("#window_height").val(Window_Affichage.height);
+        jQuery("#window_width").val(Window_Affichage.width);
+        jQuery("#ret_autosize").trigger('ON', {
+          width: img_w,
+          height: img_h,
+          theImage: theMainImage_Id,
+          src_img: infos_theMainImage.src,
+          window_height: Window_Affichage.height,
+          window_width: Window_Affichage.width
+        });
+      }
+      return true;
+    } // Wait_affichage
+
+
+
+
+
+    /***********************
+    *
+    **********************/
+    init_img = function (theImg) {
+
+      name_src = theImg.src;
+      img_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() }
+
+      if (typeof theImg.naturalWidth != "undefined")
+        img_init.width = theImg.naturalWidth;
+      if (typeof theImg.naturalHeight != "undefined")
+        img_init.height = theImg.naturalHeight;
+
+      img_init.rapport = img_init.width / img_init.height;
+      Zone_image.height_init = img_init.height;
+      Zone_image.width_init = img_init.width;
+      if (typeof Zone_image.image == "undefined") Zone_image.image = { height: Zone_image.height_init, width: Zone_image.width_init }; ;
+      Zone_image.zoom = Zone_image.image.height / Zone_image.height_init;
+      Zone_image.rapport = img_init.rapport;
+      nu_img = 0;
+      if (typeof Zone_image.src == "undefined") return false;
+      stx = name_src.match(Zone_image.src);
+      sty = infos_theMainImage.src;
+      return stx;
+    }
+
+
+    /*****************************************************
+    * recherche la plus grande image (hauteur ou largeur)
+    *****************************************************/
+    Get_Img_Maxi = function (myobj) {
+      var w00 = 0;
+      var myImg = null;
+
+      img = jQuery(theMainImage_Id);
+      if (img != null) {
+        return;
+
+      }
+      img = jQuery(myobj);
+
+      img = jQuery('img[alt]');
+
+      jQuery(myobj).each(function (i) {
+        w0 = img_reelle.width;
+        h0 = img_reelle.height;
+        if (h0 > w0) w0 = h0;
+        if (w0 > w00) {
+          if (!this.src.match(RegExp(".png", "gi")))
+            if (!this.src.match(RegExp(thumbnail, "g"))) {
+              myImg = this;
+              jQuery(myImg).addClass("Image");
+              w00 = w0;
+            }
+
+        }
+      });
+      return myImg;
+    } // Get_Img_Maxi
+
+
+    /*************************************************************
+    *
+    **************************************************************/
+    infos_entete = function () {
+      infos_imageToolBar = jQuery("#imageToolBar").infos();
+      if (typeof (marge_top) != "undefined") return;
+
+      optiontop = 0;
+      infos_imageInfoBar = jQuery("#imageInfoBar").infos();
+
+      infos_thePicturePage = jQuery("#thePicturePage").infos();
+      infos_theImage = jQuery("#theImage").infos();
+      if (theme.match(RegExp("stripped", "gi"))) {
+        infos_theImageAndTitle = jQuery("#theImageAndTitle").infos();
+        infos_theImageBox = jQuery("#theImageBox").infos();
+        optiontop = (marges_llgbo / 2) + infos_theImageAndTitle.margin.top;
+      }
+
+
+
+      marge_top = Math.ceil(infos_the_page.top +
+                                             infos_the_page.borderwidth.top +
+                                             infos_theImage.borderwidth.top +
+                                             infos_thePicturePage.margin.top
+                                             );
+
+      img_top = Math.ceil(infos_theImage.top +
+                                infos_theImage.padding.top +
+                                infos_theImage.borderwidth.top +
+                                infos_thePicturePage.margin.top + optiontop);
+      result = infos_imageToolBar;
+      // result.width = "20%";
+      // result.left = "40%";
+      result.marge_top = marge_top;
+      result.img_top = img_top;
+      //=== Afficher le titre de l'image sur le cadre ===
+
+
+      if (infos_llgboh2.top > 0) {
+        result.img_top = infos_llgboh2.top;
+
+      }
+      else if (marges_llgbo > 0) {
+        result.img_top -= (8);
+      }
+      return result;
+    } // infos_entete
+
+    /*************************************************
+    * Récupère les informations sur la description.
+    *
+    *************************************************/
+    infos_Description_f = function () {
+      // jQuery("#theImage").css({ display: "block" });
+
+      //===============  CHARLIE ==============================
+      if (jQuery("#charlie").length > 0) {
+        jQuery("#charlie").css({
+          paddingTop: "0px",
+          marginTop: "0px",
+          paddingBottom: "0px",
+          marginBottom: "0px"
+        });
+
+      }
+
+      //  Bandeau_t = infos_entete();
+      //  Bandeau = Bandeau_t.img_top;
+      infos_theImgContainer = jQuery("#" + "theImgContainer").infos();
+      infos_description = jQuery("#" + "description").infos();
+      //=============================================================================
+
+
+
+      if (theme.match(RegExp("luciano", "g"))) {
+
+
+
+
+      } else if (Type_Img == "map") {
+
+        infos_map = jQuery("#mapPicture").infos();
+        marge_left = infos_map.width;
+
+        jQuery("#map").css({ left: marge_left + "px", padding: "0px",
+          marginLeft: "0px",
+          marginRight: "4px",
+          marginTop: "0px",
+          marginBottom: "0px",
+          position: "relative"
+        });
+
+        theMainImage_Id = "#map";
+        infos_theMainImage = jQuery(theMainImage_Id).infos();
+
+
+      } else if (jQuery("#charlie").length > 0) {
+        infos_charlie = jQuery("#charlie").infos();
+        obj_charlie = jQuery("object");
+        try {
+          tp = obj_charlie.attr();
+        } catch (e) {
+          tp = obj_charlie.prop();
+        }
+
+        if (tp != undefined) {
+          if (obj_charlie.length > 0)
+            tp = jQuery("object").attr("type") || jQuery("object").prop("type");
+          else
+            tp = jQuery("embed").attr("type") || jQuery("embed").prop("type");
+        }
+
+        if (tp == 'application/x-shockwave-flash') {
+          jQuery("#charlie").css({
+            paddingTop: "0px",
+            marginTop: "0px",
+            paddingBottom: "30px",
+            marginBottom: "0px"
+          });
+        } else {
+
+        }
+
+        var MainImage = jQuery(theMainImage_Id);
+
+        if (MainImage.length == 0) {
+          theMainImage_Id = "#charlie";
+          infos_theMainImage = jQuery(theMainImage_Id).infos();
+        } else {
+
+          infos_theMainImage = jQuery(theMainImage_Id).infos();
+
+        }
+
+
+      } else if (jQuery("#theImage" + " embed").length > 0) {
+        if (jQuery(theMainImage_Id).lenght == 0) {
+          theMainImage_Id = "#theImage" + " embed";
+          infos_theMainImage = jQuery(theMainImage_Id).infos();
+          jQuery("#theImage" + " embed").width({ width: infos_theMainImage.width + "px", height: infos_theMainImage.height + "px" });
+        } else {
+
+          infos_theMainImage = jQuery(theMainImage_Id).infos();
+          Type_Img == "charlie"
+          if (infos_theMainImage.width == 0) {
+
+            infos_theMainImage = jQuery(theMainImage_Id).infos();
+
+          }
+        }
+
+      } else if (Type_Img == "pamoorama") {
+        if (!nopano) {
+          Wait_pamoorama();
+
+        }
+        infos_theMainImage = jQuery(theMainImage_Id).infos();
+        infos_footer = jQuery("#pamoorama_footer").infos();
+        infos_theMainImage.height += parseInt(infos_theMainImage.height) + parseInt(infos_footer.height);
+
+      } else {
+        if (jQuery(theMainImage_Id).length == 0) {
+          theMainImage_Id = "#theImage" + " img[alt]";
+        } else {
+
+        }
+
+
+        if (!theMainImage_Id)
+          theMainImage_Id = "#theImage";   // sans img ??
+
+
+      }
+      //=====================================================================================
       infos_theMainImage = jQuery(theMainImage_Id).infos();
-      infos_theImage = jQuery("#theImage").infos();
-      theImg.removeAttribute("width");
-      theImg.removeAttribute("height");
-
-      var nw = "100% x 100%".split("x");
-      if (jQuery(this).text().match(RegExp("x", "gi"))) {
-        nw = jQuery(this).text().split("(")[1].split(")")[0];
-        nw = nw.split("x");
-        init_img(theImg);
-        wx = parseInt(nw[0]);
-        wh = parseInt(wx / rapport);
-        //jQuery("#theImage").css("height", wh + "px");
-        jQuery(theImg).width(wx);
-        jQuery(theImg).height(wh);
-        set_cl(useMap == "#Autosize");
-        Set_llbgo();
+
+      switch (infos_theMainImage.position) {
+        case "relative":
+          break;
+        case "static":
+          break;
+        case "absolute":
+          break;
+        case "":
+          break;
+        default:
+          break;
+      }
+
+      infos_description.marge = {
+        bottom: infos_theMainImage.padding.bottom + infos_theMainImage.margin.bottom + infos_theMainImage.borderwidth.bottom,
+        top: infos_theMainImage.padding.top + infos_theMainImage.borderwidth.top + infos_theMainImage.margin.top
+      }
+
+      if (infos_llgbo.height > 0) infos_theMainImage = infos_llgbo; // format de l'image+largeur du cadre
+
+      if (theme.match(RegExp("luciano", "g"))) {
+
+        infos_theImgContainer = jQuery(theImageAndInfos_id).infos();
+        infos_description.bottom = jQuery("#imageInfo").infos().top;
+        infos_description.top = infos_theImgContainer.bottom;
+        infos_slidshowToolBar = jQuery("#slidshowToolBar").infos();
+
+        if (infos_slidshowToolBar.height > 0) {
+          correction = (infos_slidshowToolBar.height);
+          infos_description.top = infos_theMainImage.bottom;
+          infos_description.bottom = jQuery("#copyright").infos().top;
+        }
+
+        //=========================================================
+      } else if (theme.match(RegExp("stripped", "gi"))) {
+        //options.imageAutosize
+        //options.imageMargin
+
+        infos_content = jQuery("#content").infos();
+        if (options.imageAutosizeTitle == false) {
+          infos_description.top = infos_theImageBox.bottom;
+
+          infos_description.bottom = infos_HeaderBar.margin.top + infos_description.top +
+                                            infos_description.borderwidth.top +
+                                            infos_description.borderwidth.bottom +
+                                              options.imageAutosizeMargin * 2 +
+                                            (marges_llgbo / 2) + 4;
+
+        } else {
+
+
+          infos_description.top = infos_theImageBox.bottom -
+                                infos_content.top +
+                                options.imageAutosizeMargin * 2 +
+                                (marges_llgbo / 2)
+                                        ;
+          infos_description.bottom = jQuery("#tabZone").infos().top +
+                                infos_theImageAndTitle.margin.top;
+          if (msie == true) infos_description.bottom -= 4;
+        };
+        check_desc_v = true;
+
+      } else {
+        if (theme.match(RegExp("sobre", "gi"))) {
+          infos_description.marge.top = -2;
+        }
+        infos_description.bottom = infos_theImage.bottom; //482
+        infos_description.top = infos_theMainImage.height + infos_theImage.top; //410+62
+        // infos_description.bottom -= infos_theMainImage.top;
+      }
+      //
+
+      infos_description.height = infos_description.bottom - infos_description.top;
+
+      if (options.check_desc_v == false) {
+        infos_description.height = 0;
+      }
+
+      Debug_pos();
+
+      //options.cl_visible=false ;
+      return infos_description;
+    } //infos_Description_f
+
+    //=======================================================================================
+    Debug_info = function (index, infos, Nom_str) {
+      if (DEBUG_autosize == "true") {
+        if (typeof infos == "undefined") return;
+        width_g = Math.ceil(infos_body.width / 5) - 10;
+        if (typeof infos.height != "undefined") {
+
+          message = " -- > Info : " + Nom_str + " " + infos.id + "\n" +
+                         "Info nodeName: " + infos.nodeName + "\n" +
+                         "Info width: " + infos.width + "\n" +
+                         "Info height: " + infos.height + "\n" +
+                         "Info top: " + infos.top + "\n" +
+                         "Info left: " + infos.left + "\n" +
+                         "Info position: " + infos.position + "\n";
+
+          myDebug = { id: "Debug" + index, texte: message,
+            css: {
+              color: "black",
+              opacity: "1",
+              position: "absolute",
+              height: infos.height || pos_top - 30 + "px",
+              width: infos.width || width_g + "px",
+              left: infos.left || 0 + "px",
+              border: "solid 1px green",
+              top: infos.top + "px"
+            }
+          }
+          return myDebug;
+        } else {
+          if (typeof old_messages == "undefined") {
+            old_messages = new Array();
+
+          }
+          if (infos != "" && infos != "undefined") {
+            nc0 = old_messages[index] || "";
+
+            if (typeof nc0 != "undefined") {
+              nc0 = nc0.toString().split("<br />");
+              if (nc0.length > 6) nc0.shift();
+
+              old_messages[index] = nc0.join("<br />");
+            }
+            old_messages[index] += "" + Nom_str + "->" + infos + "<br />";
+
+            message = old_messages[index];
+
+            colors = Array('black', 'black', 'white', 'white', 'white', 'white', 'red');
+            myDebug = { id: "Debug" + index, texte: message,
+              css: {
+                color: colors[index - 1],
+                opacity: "1",
+                position: "absolute",
+                align: "left",
+                height: 80 + "px",
+                width: width_g + "px",
+                left: ((index - 1) * width_g) + "px",
+                border: "solid 1px green",
+                top: 0 + "px"
+              }
+            }
+          }
+
+          return myDebug;
+        }
       }
 
     }
-
-  });  // fin click #derivativeSwitchBox a
-
-  jQuery("input").click(function () {
-    if (this.name.match(RegExp("_enabled", "gi"))) {
-      sel = "[name*=" + this.name + "]";
-      obj = jQuery("tr" + sel);
-
-      if (this.checked)
-        obj.css({ backgroundColor: "green", color: "white" });
-      else
-        obj.css({ backgroundColor: "red", color: "white" });
-
+    //====================================================
+    function Debug_pos() {
+      return;
+      if (DEBUG_autosize == "true") {
+
+        jQuery("[id ^='Debug']").show();
+        /*
+        Debug2  background-color:yellow
+        Debug3 background-color:blue
+        Debug4 background-color:green
+        Debug5 background-color:red
+
+        */
+
+        affiche_debug({
+          Debug1: Debug_info(1, Bandeau_t, "Bandeau_t"),
+          Debug4: Debug_info(4, infos_description, "infos_description"),
+          Debug5: Debug_info(5, infos_theMainImage, "infos_theMainImage")
+        });
+      }
+    }
+    //==========================================================
+    affiche_debug = function (aff_infos) {
+      jQuery(jQuery("[id ^='Debug']")).each(function (i) {
+        if (aff_infos[this.id]) {
+          if (aff_infos[this.id].css) {
+            jQuery("#" + this.id).css(aff_infos[this.id].css);
+            jQuery("#" + this.id).html(aff_infos[this.id].texte);
+          }
+        }
+      });
       return;
     }
-
-
-
-    return;
-
-
-
-
-  });
-
-  //====================================
-  Autosize_init = function (name, value) {
-    img_defaut = { height: options.scaled_height, width: options.scaled_width };
-    img_reelle = { height: options.img_height, width: options.img_width };
-    img_init = { height: options.img_height, width: options.img_width };  // taille initiale
-
-    img_finale = img_init;
-    rapport = parseInt(img_init.width) / parseInt(img_init.height);
-    useMap = infos_theMainImage.useMap; // #mapmedium
-    Type_Img = "";
-    nopano = false;
-
-    useMap = cookies.pictureMap; // #mapxxx
-    typeSave = cookies.typeSave; //picturederiv xxx
-
-
-    old_img = cookies.imgSrc;
-    old_window_height = cookies.windowHeight || jQuery(window).height();
-    old_window_width = cookies.windowWidth || jQuery(window).width();
-    old_img_h = cookies.imgHeight;
-    old_img_w = cookies.imgWidth;
-
-    var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
-    theImg.useMap = useMap;
-
-
-  } // Autosize_init
-  //===========================================================================
-  Autosize_resize = function (force, parametres) {
-    theImage_init();
-
-    if (Get_dimensions(force, parametres)) {
-
-      jQuery(theMainImage_Id).height(Zone_image.image.height);
-      jQuery(theMainImage_Id).width(Zone_image.image.width);
-      jQuery("#theImageAndInfos").css({ height: "auto" });
-      jQuery("#theImage").css({ height: "auto" });
-      //  jQuery("#theImage").width(Zone_image.container.width);
-      // jQuery("#theImage").width("auto");
-      Set_Pamoorama();
-
-      set_cl(true);
-    } else {
-      Set_Pamoorama();
-      set_cl(false);
+    //===========================================
+    //
+    //===========================================
+    Set_Map = function (nds) {
+      p0 = jQuery("#map").position();
+      if (!p0) return;
+
+      infos_map = jQuery("#map").infos();
+      // if (infos_map.width == (Zone_image.container.width - p0.left))   return ;
+      nds = jQuery("#imageInfos").css("display");
+      if (nds != "none") {
+        p2 = jQuery("#infoSwitcher").infos();
+        p0.left += 35;
+      }
+      jQuery("#map").width(Zone_image.container.width - p0.left);
+      jQuery("#map").css({ position: "absolute", height: Zone_image.container.height + "px" });
     }
-    Set_llbgo(true);
-    return true;
-
-    //_____________________________________________________   
-  }; // Autosize 
-
+
+    jQuery("map [name='mapAutosize'] area").mouseover(function (e) {
+      return;
+    });
+    //=====================================
+    //
+    //=====================================
+    theImage_init = function () {
+      if (jQuery("#derivativeSwitchBox").length > 0) {
+        var px = jQuery(".derivativeSizeDetails ");
+        i = 0;
+        n = 0;
+        var pt = new Array();
+        jQuery("#derivativeSwitchBox a").each(function (i) {
+          href_path = jQuery(this).attr("href");
+          if (href_path.match(RegExp("auto", "gi"))) return true;
+          pt[i] = href_path.split("'");
+        });
+        //===== calcul Image ===
+        Calcul_Image();
+        tw = Zone_image.image.width;
+        th = Zone_image.image.height;
+        n = 0;
+        maxi_size = { w: tw, h: th, idx: -1 };
+        mini_size = { w: tw, h: th, idx: 0 };
+        size_derive = { w: 0, h: 0 };
+        size_encours = { w: tw, h: th };
+
+        jQuery(".derivativeSizeDetails").each(function (i) {
+          vn = jQuery(this).text().replace("(", "").replace(")", "").split("x");
+          size_derive = { w: parseInt(vn[0]), h: parseInt(vn[1]) };
+          if (size_derive.h > size_encours.h) {
+            if (maxi_size.idx < 0) {
+              maxi_size = size_derive;
+              maxi_size.idx = n;
+            }
+          }
+          if (size_derive.h < size_encours.h) {
+            mini_size = size_encours;
+            mini_size.idx = n;
+          }
+
+          n++;
+        });
+        // n = n - 1 ;
+        n = maxi_size.idx;
+
+        if (n > pt.length - 1) n = pt.length - 1; // format le plus grand
+        if (n < 0) n = pt.length - 1; // format le plus grand
+        imgSrc = pt[n][1];
+        last_map = pt[n][5];
+        status = imgSrc.match(RegExp(Zone_image.src, "gi"));
+        status1 = (imgSrc.toString() == Zone_image.src.toString());
+        if (status1 == true) return;
+        theImg = document.getElementById(theMainImage_Id.replace("#", ""));
+        href_path = "javascript:changeImgSrc('" + imgSrc + "', '" + last_map + "', '" + "Autosize" + "')";
+        jQuery("#linkAutosize").attr("href", href_path);
+        if (theImg.useMap.match(RegExp("map", "gi"))) return true;
+        if (theImg.src.match(RegExp(imgSrc, "gi"))) return true;
+        changeImgSrc(imgSrc, last_map, "#Autosize");
+        Zone_image.zoom = Zone_image.image.height / Zone_image.height_init;
+        return true;
+
+
+        var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
+        if (init_img(theImg)) {
+
+          return true;
+        }
+        return false;
+
+      } else {
+
+
+        return false;
+      }
+
+
+    };
+
+
+    /*************************************************
+    * correction pamoorama
+    *************************************************/
+    Set_Pamoorama = function () {
+      myPamoorama = window.myPamoorama;
+      if (Type_Img == "pamoorama") {
+
+        if (!nopano) {
+          //theMainImage_Id = "#pamoorama";
+          nopano = false;
+          Wait_pamoorama();
+          infos_theMainImage = jQuery(theMainImage_Id).infos();
+          //theMainImage_Id = "#pamoorama";
+        }
+
+
+        if (typeof myPamoorama == "undefined") {
+          return;
+        }
+        //=========================================================  
+        if (!nopano) {
+          //theMainImage_Id = "#pamoorama";
+          nopano = false;
+          Wait_pamoorama();
+          infos_theMainImage = jQuery(theMainImage_Id).infos();
+          //theMainImage_Id = "#pamoorama";
+        }
+
+
+
+        infos_pamoorama = jQuery("#pamoorama").infos();
+        infos_pamoorama_outter = jQuery("#pamoorama_outter").infos();
+        infos_pamoorama_inner = jQuery("#pamoorama_inner").infos();
+        infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
+        infos_pamoorama_frame = jQuery("#pamoorama_frame").infos();
+        infos_frame = jQuery(myPamoorama.frame).infos();
+
+
+        //====================================================
+        jQuery("#pamoorama").css({
+          marginLeft: "auto",
+          marginRight: "auto"
+          //  height: Zone_Affichage.height + "px" , sinon déclenchement panorama sur la hauteur;
+        });
+
+        marges_w = infos_pamoorama.general.marges.width;
+
+        marges_h = infos_pamoorama.general.marges.height;
+        marges_h += infos_pamoorama_footer.general.height;
+
+        jQuery("#pamoorama").css({
+          width: ""
+        });
+
+        outter_height = Zone_image.container.height - marges_h;
+        Zoom_pano = outter_height / Zone_image.height_init;
+
+        new_image = { height: Math.ceil(Zone_image.height_init * Zoom_pano),
+          width: Math.ceil(Zone_image.width_init * Zoom_pano)
+        }
+
+        jQuery("#pamoorama_inner").css({ width: new_image.width, height: new_image.height, "background-size": "100%"
+        });
+
+        //  jQuery("#pamoorama_inner").width(Zone_image.width_init * Zoom_pano);
+        //  jQuery("#pamoorama_inner").height(Zone_image.height_init * Zoom_pano);
+
+
+        //---------- test largeur image 
+        new_width = Zone_image.container.width;
+        if (new_width > new_image.width) {
+          new_width = new_image.width;
+          jQuery("#pamoorama_outter").css({
+            position: 'absolute',
+            align: "center",
+            margin: "auto"
+          });
+        }
+        outter_width = new_width;
+
+
+        //  jQuery("#pamoorama_thumb").width(200 /  Zone_image.zoom);
+
+        jQuery("#pamoorama_outter").css({
+
+          align: 'center',
+          margin: 'auto',
+          width: outter_width + "px",
+          height: outter_height + "px"
+        });
+        //============= Mise à l'echelle ==================
+        jQuery("#pamoorama_footer").css({
+          width: Zone_image.container.width + "px"
+        });
+
+        window.myPamoorama.options.width = Math.ceil(Zone_image.container.width);
+        //==================================================================
+        new_max_left = new_image.width - outter_width;
+        //   jQuery(window.myPamoorama.inner).width(Zone_image.width_init* Zoom_pano);
+        //    jQuery(window.myPamoorama.inner).height(Zone_image.height_init * Zoom_pano);
+
+        if (!window.myPamoorama.outter) return;
+        window.myPamoorama.outter.scrollTo(new_max_left, 0);
+
+        window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0);
+        window.myPamoorama.ratio = Math.ceil(new_image.width / 200);
+        window.myPamoorama.imageWidth = new_image.width;
+        window.myPamoorama.imageHeight = new_image.height;
+        nf = jQuery("#pamoorama_thumb").height();
+        jQuery("#pamoorama_thumb img").width(200);
+        jQuery("#pamoorama_thumb img").height(nf);
+        // 200=window.myPamoorama.width 
+        // frame = Zone_image.container.width
+
+        nw = (window.myPamoorama.image.width * Zone_image.container.width) / window.myPamoorama.imageWidth;
+        jQuery("#pamoorama_frame").width(nw);
+        jQuery("#pamoorama").css({
+          width: outter_width, height: "auto"
+        });
+        //infos_theMainImage.width;
+        //  infos_theMainImage.height;
+
+        jQuery("#theMainImage").width(infos_pamoorama_outter.width);
+        jQuery("#theMainImage").height(infos_pamoorama_outter.height);
+        jQuery("#theMainImage").css({ margin: "auto"
+
+        });
+
+      } // test img
+    } // Set_Pamoorama
+    /*********************************************************/
+
+    Toggle_bp = function () {
+      options.cl_visible = !options.cl_visible;
+      Autosize_resize();
+      Wait_Affichage();
+
+    }
+
+    //====================================
+    // 
+    //====================================
+    Calcul_Image = function () {
+      // theImageAndInfos(jaune) -> theImage(vert) -> [llgbo] -> theMainImage
+      // + infos_imageInfos(red)
+      infos_window = jQuery(window).infos();
+      infos_body = jQuery("body").infos(); // thePicturePage
+      infos_the_page = jQuery("#the_page").infos();
+      // theHeader
+      // 
+      infos_menubar = jQuery("#menubar").infos();
+      infos_menubar_dl = jQuery("#menubar dl").infos();
+      infos_content = jQuery("#content").infos();
+      // imageHeaderBar
+      // imageToolBar imageInfoBar
+      infos_imageInfoBar = jQuery("#imageInfoBar").infos();
+      infos_imageToolBar = jQuery("#imageToolBar").infos();
+      //theImageAndTitle
+      infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
+      if (infos_theImageAndInfos.width == 0)
+        infos_theImageAndInfos = jQuery("#theImageAndTitle").infos();
+
+      /****************************************/
+      infos_theImage = jQuery(theImage_id).infos({ pos_absolute: true });                 // conteneur
+      infos_imageInfos = jQuery(imageInfos_id).infos({ pos_absolute: true });             // information
+      infos_theMainImage = jQuery(theMainImage_Id).infos({ pos_absolute: true });         // Image   
+      // commentContent
+      // copyright 
+
+
+      pos_top = options.pos_top;
+      pos_top = infos_theImage.top;
+
+      container = {
+        height: infos_window.height - pos_top,
+        width: infos_content.width
+      }
+      marge_left = options.marge_left;
+      marge_right = options.marge_right;
+      marge_top = options.marge_top;
+      marge_bottom = options.marge_bottom;
+
+      //==========================================================
+      if (theme.match(RegExp("stripped", "gi"))) {
+        infos_the_page.margin.left = 20;  //taille fleche
+        infos_the_page.margin.right = 20;
+      }
+
+
+      if (theme.match(RegExp("elegant", "gi"))) {
+
+        jQuery("#imageInfos").css({ position: "absolute", right: 0, top: 0
+        });
+
+        // marge_right += infos_content.general.marges.right;
+        if (infos_imageInfos.visible == true) {
+          marge_right += infos_imageInfos.general.width; ;
+
+        } else {
+          marge_right += 0;
+
+        }
+
+
+      } else if (theme.match(RegExp("stripped", "gi"))) {
+
+      } else if (theme.match(RegExp("simple", "gi"))) {
+        if (infos_imageInfoBar.visible == true) {
+          marge_right += infos_imageInfoBar.general.width;
+
+        } else {
+          marge_right += 0;
+
+        }
+        marge_left += 2;
+
+      } else if (theme.match(RegExp("OS", "gi"))) {
+
+      } else if (theme.match(RegExp("pur", "gi"))) {
+        marge_right += 0;
+        // marge_right += 25;
+
+      } else {
+        //   jQuery("#menuSwitcher").hide();
+
+        margeLeft = infos_content.margin.left;
+        if (infos_menubar_dl.visible == true) {
+          margeLeft += infos_body.general.marges.width + infos_menubar.general.width;
+        }
+        else
+
+          margeLeft += infos_thePicturePage.general.marges.width;
+        // container.width -= margeLeft;
+
+
+      }
+
+
+      retrait_img = {};
+      //========== Format Image ==============  
+      retrait_img.height = Math.ceil(options.marges_llgbo || 0)
+      + Math.ceil(infos_theMainImage.exterieur.height - infos_theMainImage.height);
+      //===============================================================
+      retrait_img.width = Math.ceil(infos_theMainImage.exterieur.width - infos_theMainImage.width); // borderwidth+padding
+      retrait_img.width += Math.ceil(options.marges_llgbo || 0);
+      retrait_img.width += 0;
+
+      //================== Limite Format Image =====================
+      container.height_interne = container.height - marge_top - marge_bottom;
+      container.width_interne = container.width - marge_left - marge_right;
+
+      rapport = Zone_image.rapport_init;
+      if (Type_Img == "pamoorama") {
+        container.height_interne -= (marge_bottom + marge_top);
+      }
+      if (options.marges_llgbo > 0) {
+        // container.height_interne - = (marge_bottom);
+      }
+      image_max = {
+        height: container.height_interne - retrait_img.height,
+        width: container.width_interne - retrait_img.width
+      }
+      //=========================
+      // test débordement
+      //=========================
+      height_theMainImage = Math.ceil(image_max.height);
+      width_theMainImage = Math.ceil(image_max.width);
+      if (Type_Img == "pamoorama") {
+
+      } else {
+        height_theMainImage = Math.ceil(width_theMainImage / rapport);
+        if (height_theMainImage > container.height_interne) {
+          image_max.height = container.height_interne;
+          image_max.width = image_max.height * rapport;
+          width_theMainImage = Math.ceil(image_max.width);
+          height_theMainImage = Math.ceil(image_max.height);
+        }
+        if (width_theMainImage > container.width_interne) {
+          image_max.width = container.width_interne;
+          image_max.height = image_max.height / rapport;
+          width_theMainImage = Math.ceil(image_max.width);
+          height_theMainImage = Math.ceil(image_max.height);
+
+        } else if (width_theMainImage > container.width) {
+
+        } else {
+
+        }
+        height_theMainImage = Math.ceil(width_theMainImage / rapport);
+      }
+      //=================================================
+
+
+      container.height = height_theMainImage + marge_bottom + marge_top;
+      bottom = jQuery("#imageInfos").absoluteAll({ pos_absolute: true }).Bottom;
+      ps = infos_imageInfos.left;
+      ps1 = infos_theImage.left;
+      if (ps > infos_theImage.right)
+        container.height = Math.max(container.height, infos_imageInfos.general.bottom);
+
+      container.width = infos_content.width - marge_right - marge_left;
+
+      affiche_debug({
+        Debug3: Debug_info(3, "H:" + container.height + "  img:" + height_theMainImage + " if " + infos_imageInfos.general.bottom, " ext:")
+      });
+
+
+      //================================================================
+      Zone_image.image = {
+        width: width_theMainImage,
+        height: height_theMainImage
+      };
+
+      Zone_image.container = {
+        width: container.width,
+        height: container.height
+
+      };
+      //=================================================================
+      Zone_image.src = jQuery(theMainImage_Id).attr("src");
+      Zone_image.zoom = Zone_image.image.height / Zone_image.height_init;
+    }
+
+    /*********************************************
+    * Calcul l es dimensions.
+    *********************************************/
+    Get_dimensions = function (force, parametres) {
+      if (theImage_init()) {
+        infos_theMainImage = jQuery(theMainImage_Id).infos();
+        Zone_image.src = infos_theMainImage.src;
+      }
+      infos_widow = jQuery(window).infos();
+      infos_body = jQuery("body").infos();
+      var winwidth = infos_body.width;
+      var winheight = infos_body.height;
+
+
+      if (typeof rapport == "undefined") return;
+      if (force && force == true) old_window.width = 0;
+
+
+      if (infos_theMainImage.useMap.match(RegExp("Autosize", "gi")))
+        infos_theMainImage.useMap = "#Autosize";
+
+      useMap = options.useMap;
+
+
+      if (typeof useMap == "") useMap = "#Autosize";
+      if (options.useMap) {
+        //  useMap = options.useMap;
+      }
+      if (useMap) {
+        if (!useMap.match(RegExp("Autosize", "gi"))) {
+          return;
+        }
+      }
+
+      if (options.imageAutosize) {
+        return; //stripped
+      }
+
+      if (typeof options.cl_visible == "undefined") return;
+      if (!options.cl_visible == true) { return; }
+      //======================================================
+
+      var chk = eval("options." + user_status + "_enabled");
+      if (chk == "") { return; }
+
+      if (!options.useMap.match(RegExp("Autosize", "gi"))) {
+
+        return;
+      }
+
+      //================================================================= 
+      Calcul_Image();
+      img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
+      //=================================================================
+      old_window = jQuery(window).infos();
+
+      //=================================================================
+      switch (Type_Img) {
+        case "map":
+          Set_Map(true);
+          break
+        case "panorama":
+          if (!theMainImage_Id) {
+            theMainImage_Id = theMainImage_id;
+            if (theMainImage_Id.length > 0)
+              return;
+            theMainImage_Id = jQuery().Get_Img_Maxi("#Panorama img[alt]");
+
+            if (theMainImage_Id.length > 0)
+              theMainImage_Id = theMainImage_Id[0];
+            else
+              theMainImage_Id = jQuery().Get_Img_Maxi("#Panorama img[alt]");
+          }
+          infos_theImage = jQuery(theMainImage_Id).infos();
+          infos_the_page = jQuery("#the_page").infos();
+          jQuery("#theImage").height(infos_theImage.height);
+          img_finale.height = infos_theImage.height;
+          break
+        case "img":
+
+          if (!theMainImage_Id) return;
+          if (theme.match(RegExp("luciano", "g"))) {
+
+          }
+
+          infos_the_page = jQuery("#the_page").infos();
+
+
+          break
+        case "img_autre":
+          if (!theMainImage_Id) {
+            if (DEBUG_autosize == "true") alert("The_MainImage=null");
+            return;
+
+          }
+          infos_theImage = jQuery(theMainImage_Id).infos();
+          infos_the_page = jQuery("#the_page").infos();
+
+
+          break
+        case "embed":
+          //
+          if (infos_theMainImage.width == 0)
+            infos_theMainImage = jQuery("#thePicturePage").infos();
+          if (infos_theMainImage.width == 0)
+            infos_theMainImage = jQuery("#the_page").infos();
+          infos_theImage = infos_theMainImage;
+          infos_the_page = jQuery("#the_page").infos();
+          Bandeau_bas.height = Bandeau_bas.top;
+
+          iph1 = jQuery("#theImage div").infos();
+          if ((winheight - iph1.bottom) > 0)
+            Bandeau_bas.height = (winheight - iph1.bottom) + 50;
+          else
+            Bandeau_bas.height = 50;
+
+
+          if (rapport < 0) {
+            img_height = infos_theMainImage.height;
+            img_width = infos_theMainImage.width;
+            img_reelle.height = img_height;
+            img_reelle.width = img_width;
+          }
+
+          break
+        case "charlie":
+          img_reelle = { height: img_height, width: img_width };
+          infos_theMainImage = jQuery(theMainImage_Id).infos(); ;
+          infos_the_page = jQuery("#the_page").infos();
+          if (rapport < 0) {
+            img_height = parseInt(infos_theMainImage.height);
+            img_width = parseInt(infos_theMainImage.width);
+            img_reelle.height = parseInt(infos_theMainImage.height);
+            img_reelle.width = parseInt(infos_theMainImage.width);
+          }
+          break
+
+
+        case "pamoorama":
+
+          /*
+          infos_theImage = jQuery("#pamoorama_outter").infos();
+          infos_theImage.height = infos_theImage.height;
+          infos_the_page = jQuery("#the_page").infos();
+          */
+          break
+      }
+
+      img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
+
+
+      //================= Vérification Taille image minimun autorisée ========
+      MinWidth = jQuery(theMainImage_Id).css("minWidth");
+      if (MinWidth == "0px")
+        MinWidth = options.mini_width;
+      MinHeight = jQuery(theMainImage_Id).css("minHeight");
+      if (MinHeight == "0px")
+        MinHeight = options.mini_height;
+
+      MaxWidth = jQuery(theMainImage_Id).css("maxWidth");
+      if (MaxWidth == "0px")
+        MaxWidth = winwidth;
+      MaxHeight = jQuery(theMainImage_Id).css("maxHeight");
+      if (MaxHeight == "0px")
+        MaxHeight = winheight;
+
+      //=============== Vérification taille minimale  autorizée ======================
+      var miniWidth = jQuery(theMainImage_Id).Get_Val_int(MinWidth, options.mini_width);
+      var miniHeight = jQuery(theMainImage_Id).Get_Val_int(MinHeight, options.mini_height);
+      if (winwidth < options.mini_width2) mini_width2 = winwidth;
+
+      var miniWidth2 = jQuery(theMainImage_Id).Get_Val_int(MinWidth, options.mini_width2);
+      var miniHeight2 = jQuery(theMainImage_Id).Get_Val_int(MinHeight, options.mini_height2);
+
+
+      var maxWidth = jQuery(theMainImage_Id).Get_Val_int(MaxWidth, winwidth, "0");
+      maxHeight = jQuery(theMainImage_Id).Get_Val_int(MaxHeight, winheight, "0");
+
+      mini_width = parseInt(miniWidth);
+      mini_height = parseInt(miniHeight);
+      img_reelle.width = parseInt(img_reelle.width);
+      if (img_reelle.width < mini_width)
+        return;
+      img_reelle.height = parseInt(img_reelle.height);
+      if (img_reelle.height < parseInt(mini_height))
+        return;
+
+
+
+
+      //=================================================
+      if (Zone_image.image.height < options.mini_height2)
+        Zone_image.image.height = options.mini_height2;
+      if (Zone_image.image.width < options.mini_width2)
+        Zone_image.image.width = options.mini_width2;
+      //==================================================
+      //   Image_width largeur à atteindre
+      //   Calcul du rapport d'agrandissement
+      if (Type_Img != "pamoorama") {
+        echelle_max = parseFloat(options.echelle_max, '3');
+        if (Zone_image.zoom > 1) {
+          theImage_init();
+        }
+        if (Zone_image.zoom > echelle_max) {
+          Zone_image.zoom = echelle_max;
+          Zone_image.image.width = parseInt(Zone_image.width_init * Zone_image.zoom);
+          if (rapport > 0)
+            Zone_image.image.height = parseInt(Zone_image.width_init / rapport);
+        }
+      }
+      img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
+      return true;
+
+
+
+
+
+
+
+      //===================================================
+
+      img_finale.height = Image_height;
+      img_finale.width = Image_width;
+      if (theme.match(RegExp("stripped", "gi"))) {
+        img_finale.width -= (llgboframe.top * 2);
+        if (rapport > 0) img_finale.height = (img_finale.width / rapport);
+        else img_finale.height -= (llgboframe.top * 2);
+
+      }
+      zoom = echelle;
+      if (typeof (llgboframe) != "undefined" && llgboframe.height > 0) {
+        //=============LLGBO2 ===========================
+        t1 = llgboframe;
+        if (!theMainImage_Id.src) {
+          theMainImage_Id = jQuery(llgbo_id).find("img").get(0)
+          if (!theMainImage_Id.src) {
+            theMainImage_Id = jQuery("#theImage").find("div").get(0)
+          }
+        }
+        if (theMainImage_Id.src) {
+          wingbo = img_finale.width;
+          heightgbo = img_finale.height;
+          if (Type_Img == "panorama") {
+            heightgbo = infos_theImage.height;
+            img_finale.height = infos_theImage.height;
+          }
+
+
+
+
+          //    jQuery("#theImage").height(heightgbo + marges_llgbo / 2);
+        }
+      }
+
+      //================ Zone affichage =========================
+
+      //  jQuery("#theImage").css("top", "0px");
+      jQuery("#standard").css("top", 0 + "px");
+      jQuery("#comments").css("top", 0 + "px");
+      //========== Image Remise à l'échelle =======================
+
+      img_finale.height = parseInt(img_finale.height);
+      img_finale.width = parseInt(img_finale.width);
+      //=========================================================================
+      //=== cadre = theImage
+      if (theme.match(RegExp("simple", "gi"))) {
+        jQuery("#theImage").width(Zone_Affichage.width); //centrer simple black
+        jQuery("#theImage").css({ width: Zone_Affichage.width + "px",
+          marginLeft: "auto"
+        });
+
+      } else if (theme.match(RegExp("sobre", "gi")) || theme.match(RegExp("hr_", "gi")) || theme.match(RegExp("Mont", "gi"))) {
+        jQuery("#theImage").css({ width: "auto", marginLeft: "auto" });
+      } else if (theme.match(RegExp("saruka", "gi"))) {
+
+        jQuery("#theImage").css({ width: Zone_Affichage.width + "px" });
+      } else if (theme.match(RegExp("elegant", "gi"))) {
+
+        // jQuery("#theImage").css("width", "auto");
+        jQuery("#theImage").css({ height: Zone_Affichage.height + "px", width: "auto" }); //conteneur
+
+      } else {
+        jQuery("#theImage").css("width", "auto");
+
+      }
+      // ;
+
+      if (Type_Img == "panorama" || Type_Img == "pamoorama") {
+        img_finale.height = infos_theImage.height;
+        Zone_Affichage.height = img_finale.height;
+
+      }
+
+      if (typeof (gmaps) != "undefined") {
+        Gmap_ = gmaps.maps[0];
+        if (Gmap_.sizeMode == 'A') {
+          jQuery("#iGMapsIcon").css({ width: old_window.width * 0.8 + "px", height: old_window.height * 0.8 + "px" });
+
+        }
+      }
+      //============= flv,mov,mpg  ok
+      /* wmv nok
+      * avi nok
+      //===========================================
+      */
+      if (Type_Img == "charlie") {
+        t1 = jQuery("#charlie").infos();
+
+        /**/
+
+        pdf = 0;
+        jQuery("#charlie div").each(function (i) {
+
+
+          p1 = jQuery(this).infos();
+          pdf += p1.padding.right + p1.padding.left;
+        });
+        img_finale.width -= pdf;
+
+        jQuery("#charlie").css({
+          width: img_finale.width + pdf + "px",
+          height: img_finale.height + "px",
+          marginLeft: "auto"
+        });
+
+
+        if (MainImage.length > 0) {
+          img_finale.height = parseInt(img_finale.width / rapport);
+          img_finale.height -= 30;
+          img_finale.width = rapport * img_finale.height;
+
+
+          MainImage.width(img_finale.width);
+          MainImage.height(img_finale.height);
+          jQuery("#embedplayer").width(300);
+          jQuery("#embedplayer").height(15);
+        } else {
+          jQuery("#player").css("width", img_finale.width + "px");
+          jQuery("#player").css("height", img_finale.height + "px");
+
+          jQuery("#embedplayer").css("width", img_finale.width + "px");
+          jQuery("#embedplayer").css("height", img_finale.height + "px");
+
+          jQuery("embed").css({ width: img_finale.width + "px",
+            height: img_finale.height + "px"
+          });
+          jQuery("object").css({ width: img_finale.width + "px",
+            height: img_finale.height + "px"
+          });
+          jQuery("video").css({ width: img_finale.width + "px",
+            height: img_finale.height + "px"
+          });
+
+
+
+          jQuery("video").height(img_finale.height);
+          jQuery("video").width(img_finale.width);
+
+          jQuery("object").width(img_finale.width);
+          jQuery("object").height(img_finale.height);
+          //jQuery("#theImage").height(img_finale.height + Bandeau_bas.height); //??             
+
+          jQuery(theMainImage_Id).height(img_finale.height);
+          jQuery("#theImage").css("height", "auto");
+        }
+
+
+      } else if (Type_Img == "embed") {
+
+        if (MainImage.length > 0) {
+          img_finale.height = parseInt(img_finale.width / rapport);
+          img_finale.height -= 30;
+          img_finale.width = rapport * img_finale.height;
+
+
+          MainImage.width(img_finale.width);
+          MainImage.height(img_finale.height);
+          jQuery("#embedplayer").width(300);
+          jQuery("#embedplayer").height(15);
+        } else {
+          jQuery("#theImage").css("height", "auto");
+          jQuery("embed").css("height", img_finale.height);
+          jQuery("object").css({ height: img_finale.height + "px" });
+
+          jQuery("object").width(img_finale.width);
+          jQuery("object").height(img_finale.height);
+        }
+
+      } else if (Type_Img == "panorama") {
+        if (typeof asp_options != "undefined")
+          n = asp_options;
+        n1 = jQuery("#Panorama div").width();
+        jQuery(".panorama-viewport").css("margin", "auto");
+        n = infos_imageToolBar;
+
+
+      } else if (Type_Img == "pamoorama") {
+        Set_Pamoorama();
+
+
+
+
+      } else if (theMainImage_Id != null && theMainImage_Id.src) {
+        //--- background ?? ---
+        jQuery(theMainImage_Id).height(img_finale.height);
+        jQuery(theMainImage_Id).width(img_finale.width);
+        jQuery(theMainImage_Id).css({ height: img_finale.height + "px ",
+          width: img_finale.width + "px "
+        });
+
+
+      } else {
+        //===map ? luciano ===
+        //   jQuery(theMainImage_Id).css({ height: img_finale.height + "px ",  width: img_finale.width + "px });
+        //   jQuery(theMainImage_Id).height(img_finale.height );
+        //   jQuery(theMainImage_Id).width(img_finale.width );
+        //   jQuery(theMainImage_Id).attr({ width: img_finale.width  });
+        h = img_finale.height;
+        h = Zone_Affichage.height - Zone_Affichage.borderwidth.top - Zone_Affichage.borderwidth.bottom;
+        h -= (infos_theImage.borderwidth.bottom + infos_theImage.borderwidth.top);
+
+        jQuery(theMainImage_Id).attr({ height: h - 3 }); //image
+        if (theme.match(RegExp("elegant", "gi"))) {
+          return true;
+
+        }
+        if (theme.match(RegExp("luciano", "g"))) {
+          imgl = 180;
+          l = Zone_Affichage.left;
+
+          jQuery(".imageNumber").css({ left: l + "px"
+
+          });
+          jQuery("#theImage" + " #theImg IMG").css({ height: img_finale.height + "px ",
+            width: (img_finale.width - imgl) + "px ", marginTop: "0px"
+          })
+        }
+
+      }
+
+      var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
+      if (theImg) {
+        theImg.removeAttribute("width");
+        theImg.removeAttribute("height");
+        jQuery(theMainImage_Id).css("width", img_finale.width + "px");
+      }
+
+      jQuery("#navThumbPrev").css({ overflow: "hidden" });
+      jQuery("#navThumbNext").css({ overflow: "hidden" });
+      n = typeof inittoolbar;
+      if (Type_Img == "map") {
+        jQuery("#navThumbNext").css({ display: 'none' });
+        jQuery("#navThumbPrev").css({ display: 'none' });
+        jQuery("#theImage").css({ marginTop: infos_imageToolBar.height + "px", marginLeft: "0px",
+          width: winwidth + "px",
+          height: winheight + "px"
+        });
+        //mapPicture 
+      }
+      try {
+        if (theme.match(RegExp("gally", "gi"))) {
+          if (typeof inittoolbar == "function") {
+            if (typeof (currentTab) == "undefined") inittoolbar();
+            else initializeImageMode("resize");
+          } else {
+            tp = gallyPP.getImageProp();
+            if (typeof (GallyPP) == "function")
+              gallyPP = new GallyPP();
+
+            iph = jQuery("#imageHeaderBar").infos();
+            jQuery("#imageToolBar").css({ top: iph.bottom + "px", position: "absolute" });
+            jQuery("#theImage").width(winwidth);
+          }
+          //===========================================================================
+          if (jQuery("#navThumbPrev").length > 0) {
+            jQuery("#navThumbPrevContainer").css({ left: "0px"
+            });
+          }
+          if (jQuery("#navThumbNext").length > 0) {
+            jQuery("#navThumbNextContainer").css({ left: "0px"
+            });
+          }
+          //=============================================================================
+          if (!theme.match(RegExp("lapis", "gi"))) {
+            if (typeof initializeImageMode == "function") {
+              initializeImageMode("resize");
+            }
+
+          }
+
+        } else if (theme.match(RegExp("simple", "g"))) {
+
+          jQuery("#imageToolBar").css({ position: "static" });
+
+          infos_imageInfoBar = jQuery("#imageInfoBar").infos();
+          if (infos_imageInfoBar.bottom < infos_theMainImage.bottom) {
+            //   jQuery("#imageInfoBar").height(infos_theMainImage.bottom);
+          }
+
+        } else {
+
+          //    jQuery("#imageToolBar").css("position", "static");
+        }
+      } catch (e) {
+
+      }
+      zoom = img_finale.height / img_height;
+      h0 = jQuery("#content").height();
+      if (h0 == null) {
+        h0 = winheight - Zone_Affichage.top;
+      }
+      h1 = (h0 - img_finale.height) / 2;
+      //  jQuery("#theImage").css({ marginTop: h1 + "px" });
+
+      zoom = parseInt(zoom * 100);
+      jQuery('#zoom ').val(zoom);
+
+
+
+      //  --- réglage de la hauteur de page en fonction du copyright-----------
+      infos_copyright = jQuery("#copyright").infos();
+
+      if (theme.match(RegExp("stripped", "gi"))) {
+        var TitleBox = jQuery("#imageTitleContainer");
+        if (TitleBox.length != 0) TitleBox.css("width", img_finale.width + "px");
+      } else {
+
+      }
+
+
+      /*
+      if (!theme.match(RegExp("luciano", "gi"))) {
+      jQuery("#linkNext").css({ height: "80px", width: "200px", overflow: "hidden" });
+      jQuery("#linkPrev").css({ height: "80px", width: "200px", overflow: "hidden" });
+      jQuery(".navThumb img").css({ height: "80px", width: "", overflow: "hidden" });
+      }
+      */
+      infos_frame = jQuery("#theImage").infos();
+      if (theme.match(RegExp("stripped", "gi"))) {
+        /*
+        infos_theImageBox = jQuery("#theImageAndTitle").infos();
+        p1 = jQuery(".randomButtons").infos();
+        p2 = jQuery("#imageHeaderBar").infos();
+        p3 = infos_content.top;
+        p1 = options.imageAutosizeTitle;
+
+        jQuery("#theImage").width("width", infos_theImageBox.width + "px");
+        //jQuery("#theImageAndTitle").css("position", "relative");
+        jQuery("#content").css({ position: "relative", top: "10px", marginTop: "0px",
+        paddingTop: "0px", textAalign: "center", marginLeft: "auto"
+        });
+
+        jQuery("#theImageAndTitle").css({ position: "relative", top: "0px", marginTop: "0px",
+        paddingTop: "0px", marginLeft: "auto"
+        }); */
+        t1 = infos_theImageBox.top;
+        l1 = infos_theImageBox.left;
+        // infos_theImageBox = jQuery("#theImage").infos();
+
+      } else {
+
+        t1 = infos_frame.top;
+        l1 = infos_frame.left;
+        infos_theImageBox = jQuery("#theImage").infos(); //theImage
+      }
+      infos_theImageBox.margin.margin = infos_frame.margin.margin;
+      infos_theImageBox.top = t1;
+      infos_theImageBox.left = l1;
+      //  infos_theImageBox.position = "absolute";
+
+      Window_Affichage = infos_theImageBox;
+      if (DEBUG_autosize == "_true") {
+        //   jQuery("#theImage").css("border", "solid green");
+
+        jQuery("#Debug5").css({ background: "red",
+          position: "absolute",
+          border: "green solid 2px",
+          textAlign: align_auto,
+          margin: "auto",
+          top: Window_Affichage.top + "px",
+          left: Window_Affichage.left + "px",
+          width: Window_Affichage.width + "px",
+          height: Window_Affichage.height + "px"
+        }); //red
+        jQuery("#Debug4").css({ top: infos_frame.bottom - infos_description.height + "px" }); //green
+      }
+
+      //Wait_Affichage();
+
+      return true;
+    } // Get_dimensions
+
+
+    var infos_theMainImage = jQuery(theMainImage_Id).infos();          // Image 
+
+    if (infos_theMainImage.width == 0) {
+      if (Type_Img == "pamoorama") {
+        infos_theMainImage.id = "#theMainImage";
+
+      } else {
+        infos_theMainImage = jQuery("#theImage img").infos();
+
+      }
+      if (infos_theMainImage.id == "")
+        jQuery("#theImage img").attr("id", "theMainImage");
+      infos_theMainImage = jQuery(theMainImage_Id).infos();
+    }
+
+
+
+
+    var type_size = cookies.typeSave; // xxx
+    var useMap = cookies.pictureMap; // #mapxxx
+
+    var user_status = options.user_status;
+    var type_size_maxi = eval("options." + user_status + "_type"); //limite taille
+
+
+    init_gen = function (e) {
+
+      //============= Gestion Maps ================
+      nom_map = "Autosize";
+      a_up = jQuery("map[name='" + nom_map + "'] area[rel=up]");
+      a_prev = jQuery("map[name='" + nom_map + "'] area[rel=prev]");
+      a_next = jQuery("map[name='" + nom_map + "'] area[rel=next]");
+
+      new_html = '<map name="Autosize" >';
+
+
+      nb_zone = jQuery("div .navigationButtons a").length;
+
+      Largeur_zone = (infos_theMainImage.width / nb_zone);
+      Hauteur_zone = (infos_theMainImage.height);
+      init_zone = 0;
+      j = 0;
+      jQuery("div .navigationButtons a").each(function (e) {
+        Hauteur_zone = (infos_theMainImage.height);
+        title = jQuery(this).attr("title");
+        h_ref = jQuery(this).attr("href");
+        init_zone = Largeur_zone * j;
+        if (title.match(":")) {
+          if (j == 0)
+            rel = "prev";
+          else
+            rel = "next";
+        } else {
+          rel = "up";
+          Hauteur_zone = Hauteur_zone / 4;
+        }
+        coord = init_zone + "," + 0 + "," + Math.ceil(init_zone + Largeur_zone) + "," + Hauteur_zone;
+        new_html += '<area rel="' + rel + '" title="' + title + '" href="' + h_ref + '" shape="rect" coords="' + coord + '" alt="' + title + '" />';
+
+        j++;
+      });
+      new_html += '</map>';
+      jQuery("#theImage map:last").after(new_html);
+      //==================================================
+      marges_llgbo = 0;
+      options.marges_llgbo = 0;
+      if (jQuery(llgbo_id).length > 0) {
+        infos_llgbo = jQuery(llgbo_id).infos();
+        if (infos_llgbo.visible == true) {
+          if (infos_llgbo.height > 0) {
+            infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
+            infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
+            //=============================================
+            ll2 = infos_llgboframe1.width; // llgboframe1
+            ll1 = infos_llgboframe31.general.width; // llgboframe31
+            options.marges_llgbo = (ll1 - ll2);
+            infos_llgboh2 = jQuery("#llgboh2").infos();
+          }
+        }
+
+        marges_llgbo = options.marges_llgbo;
+      }
+
+      //========= Récupération des informations =============  
+
+      options.marge_top = 0;
+      pAll = jQuery(llgbo_id).absoluteAll({ pos_absolute: true });
+      infos_llgbo.top = pAll.Top;
+      infos_llgbo.bottom = pAll.Bottom;
+      pAll = jQuery(theMainImage_Id).absoluteAll({ pos_absolute: true });
+      pos_top = pAll.Top; ;
+      pos_bottom = pAll.Bottom; ;
+
+      if (infos_llgbo.top > 0) {
+        pos_top = infos_llgbo.top;
+
+        options.marge_top = infos_theMainImage.top - infos_theImage.top;
+      } else
+        pos_top = infos_theImageAndInfos.top;
+
+
+      options.pos_top = pos_top;
+
+      options.marge_left = infos_theImage.general.marges.left + Math.ceil(options.marge_gauche);
+      options.marge_right = infos_theImage.general.marges.right + Math.ceil(options.marge_droite);
+      options.marge_top += infos_theImage.general.marges.top + infos_content.general.marges.top + Math.ceil(options.marge_haute);
+      options.marge_bottom = Math.ceil(options.marge_basse); // +infos_content.general.marges.bottom; ;
+
+      old_window = { width: 0, height: 0 };
+
+
+      //=================== Gestion liste photos size ============================
+      us = 0;
+      type_size = cookies.typeSave; // xxx
+      useMap = cookies.pictureMap; // #mapxxx
+
+      user_status = options.user_status;
+      type_size_maxi = eval("options." + user_status + "_type"); //limite taille
+      type_size = type_size || type_size_maxi;
+      n = 0;
+
+      var pt = new Array();
+      jQuery("#derivativeSwitchBox .switchCheck").css('visibility', 'hidden');
+      jQuery("#derivativeSwitchBox a").css('visibility', 'hidden');
+
+      jQuery("#derivativeSwitchBox a").each(function (i) {
+        href_path = jQuery(this).attr("href");
+        pt[i] = href_path.split("'");
+        tsz = pt[i][5];
+        jQuery(this).css('visibility', 'visible');
+        //--- recherche limite ---
+        if (tsz.match(RegExp(type_size_maxi, "gi"))) {
+          return false;
+        }
+        //--- type en cours ---
+        if (tsz.match(RegExp("^" + type_size, "gi"))) {
+          us = n;
+        }
+
+        n++;
+      });
+
+      jQuery("derivativeChecked" + options.type_size).css('visibility', 'visible');
+      //==== en cours ============
+      n = pt.length - 1;
+      if (n >= 0) {
+        imgSrc = pt[n][1];
+        last_map = pt[n][5];  // dernière position
+        //=======================================
+        imgSrc = pt[us][1];
+        last_map = pt[us][5]; // taille selectionné.
+        href_path = "javascript:changeImgSrc('" + imgSrc + "', '" + last_map + "', '" + "Autosize" + "')";
+
+
+
+        new_html = '<br /><span class="switchCheck" id="derivativeCheckedAutosize" style="visibility:visible" >&#x2714; </span>';
+        new_html += '<a id="linkAutosize" href="' + href_path + '">';
+        new_html += 'Autosize<span class="derivativeSizeDetails" id="auto_details" > - Autosize</span>  </a>';
+        if (!type_size.match(RegExp("Autosize", "gi"))) {
+          jQuery("#derivativeSwitchBox br:last").before(new_html);
+        }
+
+        useMap = "#" + type_size_maxi; // #mapxxx
+        if (useMap == "#Autosize" && type_size_maxi == "Autosize") {
+
+        } else {
+          useMap = last_map;
+        }
+
+
+
+
+        typeSave = cookies.typeSave; //picturederiv xxx
+        options.type_size = useMap.replace("#", "");
+
+        type_size = options.type_size;
+        cookies.pictureMap = "#" + type_size_maxi; // #mapxxx
+        cookies.typeSave = type_size_maxi; //picturederiv xxx
+        cookies.imgSrc = imgSrc;
+        changeImgSrc(imgSrc, last_map, type_size);
+      } else {
+        type_size_maxi = cookies.pictureMap; // #mapxxx
+        type_size_maxi = cookies.typeSave; //picturederiv xxx
+        imgSrc = cookies.imgSrc;
+        last_map = type_size_maxi;
+        href_path = "";
+
+      }
+      affiche_debug({
+        Debug1: Debug_info(1, href_path, "href_path:"),
+        Debug4: Debug_info(4, "img:" + imgSrc + " last_map: " + last_map + " maxi:" + type_size_maxi, "Init:")
+      });
+
+
+    };        //init_gen
+    init_gen();
+
+
+  });                                                                                       // ready
+
+  //===============================================================
+  //  Fonctions générales
+  //===============================================================
+  /******************************************
+  *
+  ******************************************/
   Save_cookies = function (parametres) {
     if (parametres.typeSave) document.cookie = 'picture_deriv=' + parametres.typeSave + ';path="' + "/" + '" ';
@@ -338,971 +2433,90 @@
   }
 
-  /********************************************
-  *  window unLOAD
-  ********************************************/
-  jQuery(window).unload(function () {
-    try {
-      if (typeof theMainImage_Id != "undefined") {
-
-        useMap = options.useMap;
-        pictureMap = jQuery.cookie('picture_map');
-        typeSave = jQuery.cookie('picture_deriv');
-
-        old_img = jQuery.cookie('img');
-        old_window_height = jQuery.cookie('window_height');
-        old_window_width = jQuery.cookie('window_width');
-        old_img_h = jQuery.cookie('img_h');
-        old_img_w = jQuery.cookie('img_w');
-        set_cookies({
-
-      });
-
-      if (typeof Window_Affichage != "undefined") {
-        jQuery.cookie('window_height', Window_Affichage.height, { path: "/" });
-        jQuery.cookie('window_width', Window_Affichage.width, { path: "/" });
-      }
-    }
-  } catch (r) {
-
-  }
-
-}); //unload
-
-
-
-
-/********************************************
-*  window LOAD
-********************************************/
-jQuery(window).load(function () {
-  href = location.href;
-  var aff_ok = false;
-  if (DEBUG_autosize == "true") {
-    for (var i = 0; i < 10; i++) {
-      jQuery('#adddebugs').click();
-    }
-    jQuery(jQuery('.debug').get(i - 1)).click();
-  }
-
-  Autosize_init();
-  //=========================================================  
-
-  Bandeau_bas = infos_Description_f("#theImage");
-  if (typeof Bandeau_bas != "undefined") Bandeau = Bandeau_bas.top;
-  else Bandeau = 0;
-
-
-  if (!theImage_init("#theMainImage")) {
-    Autosize_resize(true, options);
-    Set_llbgo(true);
-    Wait_Affichage();
-  } else {
-    set_cl(options.useMap.match(RegExp("Autosize", "gi")));
-    Set_llbgo();
-  }
-
-
-
-
-  //=================================================================================
-}); // window.onload
-/***********************************************************
-*  RESIZE 
-***********************************************************/
-jQuery(window).resize(
-                       function (event, ui) {
-                         List_autosize_resize(event, ui);
-                         Autosize_resize(true, options);
-                         Wait_Affichage();
-                       });
-
-/*****************
-* changeImgSrc1
-******************/
-changeImgSrc = function (url, typeSave, useMap) {
-  var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
-  if (theImg) {
-    theImg.removeAttribute("width");
-    theImg.removeAttribute("height");
-    //  theImg.useMap = "#map" + useMap;
-
-    jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
-    jQuery('#derivativeChecked' + useMap.replace("#", "")).css('visibility', 'visible');
-    options.useMap = useMap;
-    if (useMap.match("Autosize")) {
-      pictureMap = "#" + "Autosize";
+
+  /*************************************************
+  * Recuoère le Type d'mage
+  *************************************************/
+  Get_type_img = function (e) {
+    //====== détection du type d'images ======
+    if (jQuery("#charlie").length > 0) {
+      Type_Img = "charlie";
+    } else if (jQuery("#Panorama").length) {
+      Type_Img = "panorama";
+    } else if (jQuery("#pamoorama").length) {
+      Type_Img = "pamoorama";
+    } else if (jQuery("#map").length) {
+      Type_Img = "map";
+    } else if (jQuery("#Panorama").length) {
+      Type_Img = "panorama";
+    } else if ((jQuery("#theImage" + " iframe").length + jQuery("#theImage" + " object").length + jQuery("#theImage" + " embed").length) > 0) {
+
+      if (jQuery("#theImage" + " object").length > 0) {
+
+        type_src = "object";
+
+      } else if (jQuery("#theImage" + " embed").length > 0) {
+
+        type_src = "embed";
+
+      } else {
+
+        type_src = "iframe";
+      }
+      nbf = jQuery("#theImage" + " " + type_src).length;
+      frm1 = jQuery("#theImage" + " " + type_src).get(0);
+      Type_Img = "charlie";
+
+      //'fb - xfbml - like - button
+
+      objs = jQuery("#theImage" + " div").get(0);
+      if (jQuery(objs).length > 0) {
+        id_0 = jQuery(objs).attr("id");
+        if (id_0 == "") {
+          jQuery(objs).attr("id", "charlie");
+        } else {
+          if (nbf > 1) {
+            jQuery(frm1).attr("id", "charlie");
+          } else {
+            Type_Img = "img";
+          }
+        }
+      } else {
+        jQuery(frm1).attr("id", "charlie");
+      }
+
+
+    } else if (jQuery("#theImage").find("img").length > 0) {
+      Type_Img = "img";
+    } else if (jQuery("#theImage" + "Box").find("img").length > 0) {
+      Type_Img = "img";
+      Parent = Parent + "Box";
+    } else if (jQuery("img").length > 0) {
+      Type_Img = "img_autre";
+      return;
     } else {
-      pictureMap = "#map" + typeSave;
-    }
-    theImg.src = url; // charge Image 
-    theImg.useMap = pictureMap;
-    infos_theMainImage = jQuery(theMainImage_Id).infos();
-    infos_theMainImage.useMap = theImg.useMap;
-    Save_cookies({
-      typeSave: typeSave,
-      pictureMap: pictureMap,
-      imgSrc: url
-    });
-    cookies = Get_cookies();
-
-  }
-
-
-}          //changeImgSrc1
-/************************************
-*
-************************************/
-Wait_pamoorama = function () {
-  if (jQuery("#pamoorama").length) {
-    mypanorama = window.myPamoorama;
-    if (!mypanorama) {
-      tempo = tempo + 1;
-      if (tempo > 10)
-        return true;
-      setTimeout("Wait_pamoorama()", 500);
-      return false;
-    }
-    if (mypanorama.skipInit == false) {
-      setTimeout("Wait_pamoorama()", 500);
-      return false;
-    }
-    //=============================================================
-    infos_pamoorama = jQuery("#pamoorama").infos();
-    if (Math.abs(infos_pamoorama.height) < 50) {
-      setTimeout("Wait_pamoorama()", 500);
-      return false;
-    }
-    nopano = true;
-    theMainImage_Id = "#pamoorama";
-
-  }
-} // Wait_pamoorama
-//====================================================================================
-Wait_Affichage = function () {
-
-  if (typeof fade_in == "undefined") fade_in = 1000;
-  fade_in = parseInt(fade_in);
-  /*
-  if (!Autosize_resize()) {
-  setTimeout("Wait_Affichage()", 500);
-  return
-  }  
-  nu_img++;     
-  */
-  if (typeof fade_in == "undefined") fade_in = 0;
-  if (fade_in == 0) {
-    jQuery("#theImage").css({ opacity: "1" });
-    jQuery("#theImg").css({ opacity: "1" });
-    jQuery("#imageTitleContainer").css({ opacity: "1" });
-    jQuery("#theImageAndTitle").css({ opacity: "1" });
-  } else {
-    jQuery("#theImage").animate({ opacity: "1" },
-                                                 fade_in, "swing",
-                                                 function (i) {
-                                                   jQuery("#theImage").css({ opacity: "1" });
-                                                   jQuery("#theImg").css({ opacity: "1" });
-                                                   jQuery("#imageTitleContainer").css({ opacity: "1" });
-                                                   jQuery("#theImageAndTitle").css({ opacity: "1" });
-
-                                                   if (DEBUG_autosize == "true") {
-
-                                                     nu_img--;
-                                                     if (nu_img < 1) nu_img = 1;
-
-                                                     bp1 = jQuery('.debug').get(nu_img);
-                                                     jQuery(bp1).trigger('ON');
-                                                   }
-                                                 }
-                                               );
-
-  }
-  //   if (nu_img > 1) return;
-  if (typeof stb != "undefined")
-    stb.stop().fadeTo(3500, 0);
-  if (typeof theMainImage_Id == "undefined") return true;
-
-  if (theMainImage_Id.selector) {
-    theMainImage_Id = theMainImage_Id.selector;
-  }
-  if (theMainImage_Id == null) return;
-
-  if (jQuery(theMainImage_Id).length > 0) {
-    if (typeof img_h == "undefined") {
-      img_h = jQuery(theMainImage_Id).height();
-      img_w = jQuery(theMainImage_Id).width();
-    }
-
-    jQuery("#src_img_h").val(img_h);
-    jQuery("#src_img_w").val(img_w);
-    jQuery("#ret_autosize").val(infos_theMainImage.src);
-    if (typeof Window_Affichage == "undefined") return;
-    jQuery("#window_height").val(Window_Affichage.height);
-    jQuery("#window_width").val(Window_Affichage.width);
-    jQuery("#ret_autosize").trigger('ON', {
-      width: img_w,
-      height: img_h,
-      theImage: theMainImage_Id,
-      src_img: infos_theMainImage.src,
-      window_height: Window_Affichage.height,
-      window_width: Window_Affichage.width
-    });
-  }
-} // Wait_affichage
-
-
-
-
-
-/***********************
-*
-**********************/
-init_img = function (theImg) {
-  name_src = theImg.src;
-  img_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() }
-
-  if (theImg.naturalWidth)
-    img_init.width = theImg.naturalWidth;
-  if (theImg.naturalHeight)
-    img_init.height = theImg.naturalHeight;
-
-  img_init.rapport = img_init.width / img_init.height;
-  Zone_image.height_init = img_init.height;
-  Zone_image.width_init = img_init.width;
-  Zone_image.rapport = img_init.rapport;
-
-  nu_img = 0;
-  theMainImage_Id = "#" + theImg.id;
-  if (typeof Zone_image.src == "undefined") return;
-  return name_src.match(Zone_image.src);
-}
-
-
-/*****************************************************
-* recherche la plus grande image (hauteur ou largeur)
-*****************************************************/
-Get_Img_Maxi = function (myobj) {
-  var w00 = 0;
-  var myImg = null;
-
-  img = jQuery(theMainImage_Id);
-  if (img != null) {
-    return;
-
-  }
-  img = jQuery(myobj);
-
-  img = jQuery('img[alt]');
-
-  jQuery(myobj).each(function (i) {
-    w0 = img_reelle.width;
-    h0 = img_reelle.height;
-    if (h0 > w0) w0 = h0;
-    if (w0 > w00) {
-      if (!this.src.match(RegExp(".png", "gi")))
-        if (!this.src.match(RegExp(thumbnail, "g"))) {
-          myImg = this;
-          jQuery(myImg).addClass("Image");
-          w00 = w0;
-        }
-
-    }
-  });
-  return myImg;
-} // Get_Img_Maxi
-
-
-/*************************************************************
-*
-**************************************************************/
-infos_entete = function () {
-  infos_imageToolBar = jQuery("#imageToolBar").infos();
-  if (typeof (marge_top) != "undefined") return;
-
-  optiontop = 0;
-  infos_imageInfoBar = jQuery("#imageInfoBar").infos();
-
-  infos_thePicturePage = jQuery("#thePicturePage").infos();
-  infos_theImage = jQuery("#theImage").infos();
-  if (theme.match(RegExp("stripped", "gi"))) {
-    infos_theImageAndTitle = jQuery("#theImageAndTitle").infos();
-    infos_theImageBox = jQuery("#theImageBox").infos();
-    optiontop = (marges_llgbo / 2) + infos_theImageAndTitle.margin.top;
-  }
-
-
-
-  marge_top = Math.ceil(infos_the_page.top +
-                                             infos_the_page.borderwidth.top +
-                                             infos_theImage.borderwidth.top +
-                                             infos_thePicturePage.margin.top
-                                             );
-
-  img_top = Math.ceil(infos_theImage.top +
-                                infos_theImage.padding.top +
-                                infos_theImage.borderwidth.top +
-                                infos_thePicturePage.margin.top + optiontop);
-  result = infos_imageToolBar;
-  // result.width = "20%";
-  // result.left = "40%";
-  result.marge_top = marge_top;
-  result.img_top = img_top;
-  //=== Afficher le titre de l'image sur le cadre ===
-
-
-  if (infos_llgboh2.top > 0) {
-    result.img_top = infos_llgboh2.top;
-
-  }
-  else if (marges_llgbo > 0) {
-    result.img_top -= (8);
-  }
-  return result;
-} // infos_entete
-/*************************************************
-* Récupère les informations sur la description.
-*
-*************************************************/
-infos_Description_f = function () {
-  // jQuery("#theImage").css({ display: "block" });
-  //====== détection du type d'images ======
-  if (jQuery("#charlie").length > 0) {
-    Type_Img = "charlie";
-  } else if (jQuery("#Panorama").length) {
-    Type_Img = "panorama";
-  } else if (jQuery("#pamoorama").length) {
-    Type_Img = "pamoorama";
-  } else if (jQuery("#map").length) {
-    Type_Img = "map";
-  } else if (jQuery("#Panorama").length) {
-    Type_Img = "panorama";
-  } else if ((jQuery("#theImage" + " iframe").length + jQuery("#theImage" + " object").length + jQuery("#theImage" + " embed").length) > 0) {
-
-    if (jQuery("#theImage" + " object").length > 0) {
-
-      type_src = "object";
-
-    } else if (jQuery("#theImage" + " embed").length > 0) {
-
-      type_src = "embed";
-
-    } else {
-
-      type_src = "iframe";
-    }
-    nbf = jQuery("#theImage" + " " + type_src).length;
-    frm1 = jQuery("#theImage" + " " + type_src).get(0);
-    Type_Img = "charlie";
-
-    //'fb - xfbml - like - button
-
-    objs = jQuery("#theImage" + " div").get(0);
-    if (jQuery(objs).length > 0) {
-      id_0 = jQuery(objs).attr("id");
-      if (id_0 == "") {
-        jQuery(objs).attr("id", "charlie");
-      } else {
-        if (nbf > 1) {
-          jQuery(frm1).attr("id", "charlie");
-        } else {
-          Type_Img = "img";
-        }
-      }
-    } else {
-      jQuery(frm1).attr("id", "charlie");
-    }
-
-
-  } else if (jQuery("#theImage").find("img").length > 0) {
-    Type_Img = "img";
-  } else if (jQuery("#theImage" + "Box").find("img").length > 0) {
-    Type_Img = "img";
-    Parent = Parent + "Box";
-  } else if (jQuery("img").length > 0) {
-    Type_Img = "img_autre";
-    return;
-  } else {
-    return;
-  }
-  //===============  CHARLIE ==============================
-  if (jQuery("#charlie").length > 0) {
-    jQuery("#charlie").css({
-      paddingTop: "0px",
-      marginTop: "0px",
-      paddingBottom: "0px",
-      marginBottom: "0px"
-    });
-
-  }
-  //================ LLGBO ======================
-  marges_llgbo = 0;
-  options.marges_llgbo = 0;
-  if (jQuery(llgbo_id).length > 0) {
-    infos_llgbo = jQuery(llgbo_id).infos();
-    if (infos_llgbo.visible == true) {
-      if (infos_llgbo.height > 0) {
-        infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
-        infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
-        //=============================================
-        ll2 = infos_llgboframe1.width; // llgboframe1
-        ll1 = infos_llgboframe31.general.width; // llgboframe31
-        options.marges_llgbo = (ll1 - ll2);
-        infos_llgboh2 = jQuery("#llgboh2").infos();
-      }
-    }
-    jQuery(llgbo_id).trigger("ON");
-    marges_llgbo = options.marges_llgbo;
-  }
-
-  //  Bandeau_t = infos_entete();
-  //  Bandeau = Bandeau_t.img_top;
-  infos_theImgContainer = jQuery("#" + "theImgContainer").infos();
-  infos_description = jQuery("#" + "description").infos();
-  //=============================================================================
-
-
-
-  if (theme.match(RegExp("luciano", "g"))) {
-
-
-
-
-  } else if (Type_Img == "map") {
-
-    infos_map = jQuery("#mapPicture").infos();
-    marge_left = infos_map.width;
-
-    jQuery("#map").css({ left: marge_left + "px", padding: "0px",
-      marginLeft: "0px",
-      marginRight: "4px",
-      marginTop: "0px",
-      marginBottom: "0px",
-      position: "relative"
-    });
-
-    theMainImage_Id = "#map";
-    infos_theMainImage = jQuery(theMainImage_Id).infos();
-
-
-  } else if (jQuery("#charlie").length > 0) {
-    infos_charlie = jQuery("#charlie").infos();
-    obj_charlie = jQuery("object");
-    try {
-      tp = obj_charlie.attr();
-    } catch (e) {
-      tp = obj_charlie.prop();
-    }
-
-    if (tp != undefined) {
-      if (obj_charlie.length > 0)
-        tp = jQuery("object").attr("type") || jQuery("object").prop("type");
-      else
-        tp = jQuery("embed").attr("type") || jQuery("embed").prop("type");
-    }
-
-    if (tp == 'application/x-shockwave-flash') {
-      jQuery("#charlie").css({
-        paddingTop: "0px",
-        marginTop: "0px",
-        paddingBottom: "30px",
-        marginBottom: "0px"
-      });
-    } else {
-
-    }
-
-    var MainImage = jQuery(theMainImage_Id);
-
-    if (MainImage.length == 0) {
-      theMainImage_Id = "#charlie";
-      infos_theMainImage = jQuery(theMainImage_Id).infos();
-    } else {
-
-      infos_theMainImage = jQuery(theMainImage_Id).infos();
-
-    }
-
-
-  } else if (jQuery("#theImage" + " embed").length > 0) {
-    if (jQuery(theMainImage_Id).lenght == 0) {
-      theMainImage_Id = "#theImage" + " embed";
-      infos_theMainImage = jQuery(theMainImage_Id).infos();
-      jQuery("#theImage" + " embed").width({ width: infos_theMainImage.width + "px", height: infos_theMainImage.height + "px" });
-    } else {
-
-      infos_theMainImage = jQuery(theMainImage_Id).infos();
-      Type_Img == "charlie"
-      if (infos_theMainImage.width == 0) {
-
-        infos_theMainImage = jQuery(theMainImage_Id).infos();
-
-      }
-    }
-
-  } else if (Type_Img == "pamoorama") {
-    if (!nopano) {
-      Wait_pamoorama();
-
-    }
-    infos_theMainImage = jQuery(theMainImage_Id).infos();
-    infos_footer = jQuery("#pamoorama_footer").infos();
-    infos_theMainImage.height += parseInt(infos_theMainImage.height) + parseInt(infos_footer.height);
-
-  } else {
-    if (jQuery(theMainImage_Id).length == 0) {
-      theMainImage_Id = "#theImage" + " img[alt]";
-    } else {
-
-    }
-
-
-    if (!theMainImage_Id)
-      theMainImage_Id = "#theImage";   // sans img ??
-
-
-  }
-  //=====================================================================================
-  infos_theMainImage = jQuery(theMainImage_Id).infos();
-
-  switch (infos_theMainImage.position) {
-    case "relative":
-      break;
-    case "static":
-      break;
-    case "absolute":
-      break;
-    case "":
-      break;
-    default:
-      break;
-  }
-
-  infos_description.marge = {
-    bottom: infos_theMainImage.padding.bottom + infos_theMainImage.margin.bottom + infos_theMainImage.borderwidth.bottom,
-    top: infos_theMainImage.padding.top + infos_theMainImage.borderwidth.top + infos_theMainImage.margin.top
-  }
-
-  if (infos_llgbo.height > 0) infos_theMainImage = infos_llgbo; // format de l'image+largeur du cadre
-
-  if (theme.match(RegExp("luciano", "g"))) {
-
-    infos_theImgContainer = jQuery(theImageAndInfos_id).infos();
-    infos_description.bottom = jQuery("#imageInfo").infos().top;
-    infos_description.top = infos_theImgContainer.bottom;
-    infos_slidshowToolBar = jQuery("#slidshowToolBar").infos();
-
-    if (infos_slidshowToolBar.height > 0) {
-      correction = (infos_slidshowToolBar.height);
-      infos_description.top = infos_theMainImage.bottom;
-      infos_description.bottom = jQuery("#copyright").infos().top;
-    }
-
-    //=========================================================
-  } else if (theme.match(RegExp("stripped", "gi"))) {
-    //options.imageAutosize
-    //options.imageMargin
-
-    infos_content = jQuery("#content").infos();
-    if (options.imageAutosizeTitle == false) {
-      infos_description.top = infos_theImageBox.bottom;
-
-      infos_description.bottom = infos_HeaderBar.margin.top + infos_description.top +
-                                            infos_description.borderwidth.top +
-                                            infos_description.borderwidth.bottom +
-                                              options.imageAutosizeMargin * 2 +
-                                            (marges_llgbo / 2) + 4;
-
-    } else {
-
-
-      infos_description.top = infos_theImageBox.bottom -
-                                infos_content.top +
-                                options.imageAutosizeMargin * 2 +
-                                (marges_llgbo / 2)
-                                        ;
-      infos_description.bottom = jQuery("#tabZone").infos().top +
-                                infos_theImageAndTitle.margin.top;
-      if (msie == true) infos_description.bottom -= 4;
-    };
-    check_desc_v = true;
-
-  } else {
-    if (theme.match(RegExp("sobre", "gi"))) {
-      infos_description.marge.top = -2;
-    }
-    infos_description.bottom = infos_theImage.bottom; //482
-    infos_description.top = infos_theMainImage.height + infos_theImage.top; //410+62
-    // infos_description.bottom -= infos_theMainImage.top;
-  }
-  //
-
-  infos_description.height = infos_description.bottom - infos_description.top;
-
-  if (options.check_desc_v == false) {
-    infos_description.height = 0;
-  }
-
-  Debug_pos();
-
-  //options.cl_visible=false ;
-  return infos_description;
-} //infos_Description_f
-
-//=======================================================================================
-Debug_info = function (index, infos, nom) {
-  if (infos.height > 0) {
-    message = browser.browser + " -- > Info : " + nom + " " + infos.id + "\n" +
-                         "Info nodeName: " + infos.nodeName + "\n" +
-                         "Info width: " + infos.width + "\n" +
-                         "Info height: " + infos.height + "\n" +
-                         "Info top: " + infos.top + "\n" +
-                         "Info left: " + infos.left + "\n" +
-                         "Info position: " + infos.position + "\n";
-    myDebug = { id: "Debug" + index, texte: message,
-      css: {
-        color: "black",
-        opacity: "0.5",
-        position: "absolute",
-        height: infos.height || 100 + "px",
-        width: infos.width || 300 + "px",
-        left: infos.left || 0 + "px",
-        border: "solid 1px green",
-        top: infos.top + "px"
-      }
-    }
-    return myDebug;
-  } else {
-    if (typeof old_messages == "undefined") {
-      old_messages = new Array();
-
-    }
-    if (infos != "" && infos != "undefined") {
-      nc0 = old_messages[index];
-
-      if (typeof nc0 != "undefined") {
-        nc0 = old_messages[index].toString().split("<br />");
-        if (nc0.length > 3) nc0.shift();
-
-        old_messages[index] = nc0.join("<br />");
-      }
-      old_messages[index] += " : " + nom + " -- > " + infos + "<br />";
-
-      message = browser.browser + old_messages[index];
-
-      myDebug = { id: "Debug" + index, texte: message,
-        css: {
-          color: "black",
-          opacity: "1.0",
-          position: "absolute",
-          align: "left",
-          height: 100 + "px",
-          width: 800 + "px",
-          left: 300 + "px",
-          border: "solid 1px green",
-          top: 0 + "px"
-        }
-      }
-    }
-
-    return myDebug;
-  }
-
-
-}
-//====================================================
-function Debug_pos() {
-  return;
-  if (DEBUG_autosize == "true") {
-
-    jQuery("[id ^='Debug']").show();
-    /*
-    Debug2  background-color:yellow
-    Debug3 background-color:blue
-    Debug4 background-color:green
-    Debug5 background-color:red
-
-    */
-
-    affiche_debug({
-      Debug1: Debug_info(1, Bandeau_t, "Bandeau_t"),
-      Debug4: Debug_info(4, infos_description, "infos_description"),
-      Debug5: Debug_info(5, infos_theMainImage, "infos_theMainImage")
-    });
-  }
-}
-//==========================================================
-affiche_debug = function (aff_infos) {
-  jQuery(jQuery("[id ^='Debug']")).each(function (i) {
-    if (aff_infos[this.id]) {
-      if (aff_infos[this.id].css) {
-        jQuery("#" + this.id).css(aff_infos[this.id].css);
-        jQuery("#" + this.id).html(aff_infos[this.id].texte);
-      }
-    }
-  });
-  return;
-}
-//===========================================
-//
-//===========================================
-Set_Map = function (nds) {
-  p0 = jQuery("#map").position();
-  if (!p0) return;
-
-  infos_map = jQuery("#map").infos();
-  // if (infos_map.width == (Zone_image.container.width - p0.left))   return ;
-  nds = jQuery("#imageInfos").css("display");
-  if (nds != "none") {
-    p2 = jQuery("#infoSwitcher").infos();
-    p0.left += 35;
-  }
-  jQuery("#map").width(Zone_image.container.width - p0.left);
-  jQuery("#map").css({ position: "absolute", height: Zone_image.container.height + "px" });
-}
-
-jQuery("map [name='mapAutosize'] area").mouseover(function (e) {
-  return;
-});
-//=====================================
-//
-//=====================================
-theImage_init = function (Obj) {
-  if (jQuery("#derivativeSwitchBox").length > 0) {
-    id3 = jQuery("#derivativeCheckedAutosize");
-    var pi = jQuery("#derivativeSwitchBox > span ");
-    var px = jQuery(".derivativeSizeDetails ");
-    i = 0;
-    n = 0;
-    var pt = new Array();
-    jQuery("#derivativeSwitchBox a").each(function (i) {
-      href_path = jQuery(this).attr("href");
-      if (href_path.match(RegExp("auto", "gi"))) return true;
-      pt[i] = href_path.split("'");
-    });
-    Calcul_Image();
-    tw = Zone_image.container.width;
-    th = Zone_image.container.height;
-    n = 0;
-    jQuery(".derivativeSizeDetails").each(function (i) {
-      vn = jQuery(this).text().replace("(", "").replace(")", "").split("x");
-      h0 = parseInt(vn[1]);
-      w0 = parseInt(vn[0])
-      if (h0 > th) {
-        n = i;
-        return false;
-      }
-      if (w0 > tw) {
-        n = i;
-        return false;
-      }
-      n++;
-    });
-    if (n > pt.length - 1) n = pt.length - 1; // format le plus grand
-    if (n < 0) n = 0; // format le plus grand
-    if (typeof pt[n] == "undefined") {
-
-      n = n - 1
-    }
-
-    imgSrc = pt[n][1];
-    last_map = pt[n][5];
-    var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
-    if (theImg.useMap.match(RegExp("map", "gi"))) return;
-    if (theImg.src.match(RegExp(imgSrc, "gi"))) return;
-
-    href_path = "javascript:changeImgSrc('" + imgSrc + "', '" + last_map + "', '" + "#Autosize" + "')";
-    jQuery("#linkAutosize").attr("href", href_path);
-    changeImgSrc(imgSrc, last_map, "#Autosize");
-  }
-  return false;
-
-};
-
-//===============================================================
-//  Fonctions générales
-//===============================================================
-Set_llbgo = function (Force) {
-  if (Force)
-    if (typeof LlgboFr_Resize == "function") LlgboFr_Resize();
-  // if (typeof updateXY != "function")      return;
-  maps = jQuery("map[name^='map']");
-  maps = jQuery("map[name='Autosize']");
-  if (maps.length == 0) return;
-
-  nom_map = 'Autosize';
-  // nom_map = maps[0].name;
-  maps = jQuery("map[name='" + nom_map + "']  area");
-
-
-  nb_zone = maps.length;
-  infos_theMainImage = jQuery(theMainImage_Id).infos();          // Image 
-  var Largeur_zone = (infos_theMainImage.width / nb_zone);
-  var Hauteur_zone = (infos_theMainImage.height);
-  var init_zone = 0;
-  j = 0;
-  maps.each(function (e) {
-    init_zone = Largeur_zone * j;
-    rel = jQuery(this).attr("rel");
-    title = jQuery(this).attr("title");
-    alt = jQuery(this).attr("alt");
-    H = Hauteur_zone;
-    if (rel == "up") {
-      H = Hauteur_zone / 4;
-    }
-    coord = { x0: init_zone, y0: 0, x1: Math.ceil(init_zone + Largeur_zone), y1: Hauteur_zone };
-    jQuery(this).attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
-    j++;
-  });
-
-  return;
-}
-
-/*************************************************
-* correction pamoorama
-*************************************************/
-Set_Pamoorama = function () {
-  if (Type_Img == "pamoorama") {
-    if (typeof myPamoorama == "undefined") {
       return;
     }
-
-    Calcul_Image();
-    infos_pamoorama = jQuery("#pamoorama").infos();
-    infos_pamoorama_outter = jQuery("#pamoorama_outter").infos();
-    infos_pamoorama_inner = jQuery("#pamoorama_inner").infos();
-    infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
-    infos_pamoorama_frame = jQuery("#pamoorama_frame").infos();
-    infos_frame = jQuery(myPamoorama.frame).infos();
-
-
-    //====================================================
-    jQuery("#pamoorama").css({
-      marginLeft: "auto",
-      marginRight: "auto"
-      //  height: Zone_Affichage.height + "px" , sinon déclenchement panorama sur la hauteur;
-    });
-
-    infos_pamoorama_inner = jQuery("#pamoorama_inner").infos();
-    infos_pamoorama = jQuery("#pamoorama").infos();
-
-
-
-
-    marges_w = infos_pamoorama.borderwidth.left +
-                          infos_pamoorama.margin.left +
-                          infos_pamoorama.borderwidth.right +
-                          infos_pamoorama.margin.right;
-
-    marges_h = 10 +
-                          infos_pamoorama.borderwidth.top +
-                          infos_pamoorama.margin.top +
-                          infos_pamoorama.borderwidth.bottom +
-                          infos_pamoorama.margin.bottom;
-    marges_h += infos_pamoorama_footer.borderwidth.top +
-                          infos_pamoorama_footer.margin.top +
-                          infos_pamoorama_footer.borderwidth.bottom +
-                          infos_pamoorama_footer.margin.bottom;
-
-    jQuery("#pamoorama").css({
-      width: ""
-    });
-
-    outter_height = Zone_image.container.height - infos_pamoorama_footer.height - marges_h;
-    Zoom_pano = outter_height / Zone_image.height_init;
-
-    new_image = { height: Math.ceil(Zone_image.height_init * Zoom_pano),
-      width: Math.ceil(Zone_image.width_init * Zoom_pano)
+  }
+
+  //====================================
+  // 
+  //====================================
+  set_cl = function (Valid) {
+    if (typeof Valid == "undefined") Valid = options.useMap.match(RegExp("Autosize", "gi")) || false;
+    if (typeof options.cl_visible == "undefined") return;
+    if (typeof src1 == "undefined") return;
+
+    if (options.cl_visible) src = src1;
+    else src = src2;
+
+    if (options.cl_visible) {
+      src_info = src3;
+      src_infos_1 = src3;
+    } else {
+      src_info = src4;
+      src_infos_1 = src5;
     }
 
-    jQuery("#pamoorama_inner").css({ width: new_image.width, height: new_image.height, "background-size": "100%"
-    });
-
-    //  jQuery("#pamoorama_inner").width(Zone_image.width_init * Zoom_pano);
-    //  jQuery("#pamoorama_inner").height(Zone_image.height_init * Zoom_pano);
-
-
-    //---------- test largeur image 
-    new_width = Zone_image.container.width;
-    if (new_width > new_image.width) {
-      new_width = new_image.width;
-      jQuery("#pamoorama_outter").css({
-        position: 'absolute',
-        align: "center",
-        margin: "auto"
-      });
-    }
-    outter_width = new_width;
-
-
-    //  jQuery("#pamoorama_thumb").width(200 /  Zone_image.zoom);
-
-    jQuery("#pamoorama_outter").css({
-
-      align: 'center',
-      margin: 'auto',
-      width: outter_width + "px",
-      height: outter_height + "px"
-    });
-    //============= Mise à l'echelle ==================
-    jQuery("#pamoorama_footer").css({
-      width: Zone_image.container.width + "px"
-    });
-
-    window.myPamoorama.options.width = Math.ceil(Zone_image.container.width);
-    //==================================================================
-    new_max_left = new_image.width - outter_width;
-    //   jQuery(window.myPamoorama.inner).width(Zone_image.width_init* Zoom_pano);
-    //    jQuery(window.myPamoorama.inner).height(Zone_image.height_init * Zoom_pano);
-
-
-    window.myPamoorama.outter.scrollTo(new_max_left, 0);
-
-    window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0);
-    window.myPamoorama.ratio = Math.ceil(new_image.width / 200);
-    window.myPamoorama.imageWidth = new_image.width;
-    window.myPamoorama.imageHeight = new_image.height;
-    nf = jQuery("#pamoorama_thumb").height();
-    jQuery("#pamoorama_thumb img").width(200);
-    jQuery("#pamoorama_thumb img").height(nf);
-    // 200=window.myPamoorama.width 
-    // frame = Zone_image.container.width
-
-    nw = (window.myPamoorama.image.width * Zone_image.container.width) / window.myPamoorama.imageWidth;
-    jQuery("#pamoorama_frame").width(nw);
-    jQuery("#pamoorama").css({
-      width: "auto", height: "auto"
-    });
-
-  } // test img
-} // Set_Pamoorama
-/*********************************************************/
-
-Toggle_bp = function () {
-  options.cl_visible = !options.cl_visible;
-  Autosize_resize();
-  Wait_Affichage();
-
-}
-//====================================
-// 
-//====================================
-set_cl = function (Valid) {
-  if (typeof Valid == "undefined") Valid = options.useMap.match(RegExp("Autosize", "gi")) || false;
-
-  if (typeof options.cl_visible == "undefined") return;
-  if (typeof src1 == "undefined") return;
-
-  if (options.cl_visible) src = src1;
-  else src = src2;
-
-  if (options.cl_visible) {
-    src_info = src3;
-    src_infos_1 = src3;
-  }
-  else {
-    src_info = src4;
-    src_infos_1 = src5;
-  }
-  if (Valid) {
-    if (typeof Zone_image.image != "undefined") {
+    if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined" && Valid) {
       Zone_image.zoom = (Zone_image.image.height / Zone_image.height_init);
       zoom_cl = parseInt(100 * Zone_image.zoom);
@@ -1320,7 +2534,6 @@
         color_back = color_back.split("(")[1].split(")")[0].split(",");
         color_back = "rgb(" + Math.abs(255 - color_back[0]) + ","
-      + Math.abs(255 - color_back[1]) + ","
-      + Math.abs(255 - color_back[2]) + ")";
-
+                + Math.abs(255 - color_back[1]) + ","
+                + Math.abs(255 - color_back[2]) + ")";
       }
       else if (color_back.match(new RegExp("#", "gi")))
@@ -1328,1036 +2541,72 @@
       else
         color_back = jQuery('body').css("color");
-
-
       jQuery('#bp_cla span').css("color", color_back);
+      jQuery('#auto_details').text(" (" + Zone_image.image.width + " x " + Zone_image.image.height + ")");
+
+      //===============================================
+    } else {
+      src = src6;
+      jQuery('#auto_details').text("");
     }
-  } else {
-    src = src6;
+    bp_scr = jQuery('#bp_img_cla');
+    if (bp_scr.length > 0) {
+      src_enc = bp_scr.attr("src");
+      if (!src_enc.match(src)) {
+        bp_scr.get(0).src = src;
+        jQuery('#bp_img_cla').attr('alt', src_info);
+        jQuery('#bp_img_cla').attr('title', src_info);
+      }
+    }
+
   }
-  if (Zone_image.image)
-    jQuery('#auto_details').text(" (" + Zone_image.image.width + " x " + Zone_image.image.height + ")");
-  bp_scr = jQuery('#bp_img_cla');
-
-  if (bp_scr.length > 0) {
-    src_enc = bp_scr.attr("src");
-    if (!src_enc.match(src)) {
-      bp_scr.get(0).src = src;
-      jQuery('#bp_img_cla').attr('alt', src_info);
-      jQuery('#bp_img_cla').attr('title', src_info);
+  /********************************
+  *
+  *********************************/
+
+  Set_llbgo = function (Force) {
+    if (Type_Img == "pamoorama") {
+
     }
-  }
-}
-//====================================
-// 
-//====================================
-Calcul_Image = function () {
-  // theImageAndInfos(jaune) -> theImage(vert) -> [llgbo] -> theMainImage
-  // + infos_imageInfos(red)
-  infos_window = jQuery(window).infos();
-  infos_body = jQuery("body").infos(); // thePicturePage
-  infos_the_page = jQuery("#the_page").infos();
-  // theHeader
-  // 
-  infos_menubar = jQuery("#menubar").infos();
-  infos_menubar_dl = jQuery("#menubar dl").infos();
-  infos_content = jQuery("#content").infos();
-  // imageHeaderBar
-  // imageToolBar imageInfoBar
-  infos_imageInfoBar = jQuery("#imageInfoBar").infos();
-  infos_imageToolBar = jQuery("#imageToolBar").infos();
-  //theImageAndTitle
-  infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
-  if (infos_theImageAndInfos.width == 0)
-    infos_theImageAndInfos = jQuery("#theImageAndTitle").infos();
-  infos_theImage = jQuery("#theImage").infos();
-  /****************************************
-  * marginl r 10 10,borderwidth 5 5, padding 10 10
-  * infos_theImage width 849 , (+padding) out 869,(+border) ext 879 ,(+marge) general 899
-  * general marges width 50 l25+r25,
-  ****************************************/
-
-  infos_imageInfos = jQuery("#imageInfos").infos();
-  infos_theMainImage = jQuery(theMainImage_Id).infos();         // Image
-  infos_theMainImage.src = jQuery(theMainImage_Id).attr("src");
-
-  // commentContent
-  // copyright 
-
-  pos_top = options.pos_top;
-  pos_top = options.pos_top + infos_llgbo.top
-
-  container = {
-    height: infos_window.height - pos_top,
-    width: infos_content.width
-  }
-  marge_left = infos_theImage.general.marges.left;
-  marge_right = infos_theImage.general.marges.right;
-  marge_top = infos_theImage.general.marges.top + infos_content.general.marges.top + 2;
-  marge_bottom = infos_theImage.general.marges.bottom + Math.ceil(options.marge_basse) + infos_content.general.marges.bottom; ;
-
-  //==========================================================
-  if (theme.match(RegExp("stripped", "gi"))) {
-    infos_the_page.margin.left = 20;  //taille fleche
-    infos_the_page.margin.right = 20;
-  }
-
-
-  if (theme.match(RegExp("elegant", "gi"))) {
-    jQuery("#imageInfos").css({ position: "absolute", right: 0, margin: "auto"
-      , top: 0
+    if (Force)
+      if (typeof LlgboFr_Resize == "function") {
+
+        LlgboFr_Resize();
+      }
+
+
+    // if (typeof updateXY != "function")      return;
+    maps = jQuery("map[name^='map']");
+    maps = jQuery("map[name='Autosize']");
+    if (maps.length == 0) return;
+
+    nom_map = 'Autosize';
+    // nom_map = maps[0].name;
+    maps = jQuery("map[name='" + nom_map + "']  area");
+
+
+    nb_zone = maps.length;
+
+    infos_theMainImage = jQuery(theMainImage_Id).infos();          // Image 
+    var Largeur_zone = (infos_theMainImage.width / nb_zone);
+    var Hauteur_zone = (infos_theMainImage.height);
+    var init_zone = 0;
+    j = 0;
+    maps.each(function (e) {
+      init_zone = Largeur_zone * j;
+      rel = jQuery(this).attr("rel");
+      title = jQuery(this).attr("title");
+      alt = jQuery(this).attr("alt");
+      H = Hauteur_zone;
+      if (rel == "up") {
+        H = Hauteur_zone / 4;
+      }
+      coord = { x0: init_zone, y0: 0, x1: Math.ceil(init_zone + Largeur_zone), y1: Hauteur_zone };
+      jQuery(this).attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
+      j++;
     });
-
-
-    // marge_right += infos_content.general.marges.right;
-    if (infos_imageInfos.visible == true) {
-      marge_right += infos_imageInfos.width + 2;
-
-    } else {
-      marge_right += 15;
-
-    }
-    marge_left += 5;
-    marge_top += 20;
-
-  } else if (theme.match(RegExp("stripped", "gi"))) {
-
-  } else if (theme.match(RegExp("simple", "gi"))) {
-
-
-  } else if (theme.match(RegExp("OS", "gi"))) {
-
-  } else if (theme.match(RegExp("pur", "gi"))) {
-
-    marge_right += 25;
-
-  } else {
-    //   jQuery("#menuSwitcher").hide();
-
-    margeLeft = infos_content.margin.left;
-    if (infos_menubar_dl.visible == true) {
-      margeLeft += infos_body.general.marges.width + infos_menubar.general.width;
-    }
-    else
-
-      margeLeft += infos_thePicturePage.general.marges.width;
-    // container.width -= margeLeft;
-
-
-  }
-
-
-
-  //========== Format Image ==============  
-  retrait_img_h = Math.ceil(options.marges_llgbo || 0)
-      + infos_theMainImage.general.marges.height
-     ;
-  //===============================================================
-  retrait_img = Math.ceil(infos_theMainImage.general.marges.width);
-  retrait_img += Math.ceil(options.marges_llgbo || 0);
-  retrait_img += 0;
-
-  //================== Limite Format Image =====================
-  image_max = {
-    height: container.height - marge_top - marge_bottom - retrait_img_h,
-    width: container.width - marge_left - marge_right - retrait_img
-  }
-  //================================================================
-  if (typeof Zone_image.height_init == "undefined") {
-    init_img(theImg);
-    Zone_image.width_init = img_init.width;
-    Zone_image.height_init = img_init.height;
-    Zone_image.height_init = Math.ceil(img_init.height);
-    Zone_image.rapport_init = Math.ceil(img_init.width / Zone_image.height_init);
-    rapport = Zone_image.rapport_init;
-  }
-
-  theMainImage_str = theMainImage_Id.replace("#", "");
-  useMap_en_cours = jQuery(theMainImage_Id).attr("useMap");
-
-  var theImg = document.getElementById(theMainImage_str);
-  if (theImg) {
-    if (useMap_en_cours.match(RegExp("map", "gi"))) {
-      image_max.height = jQuery(theImg).height() - retrait_img_h;
-      image_max.width = jQuery(theImg).width() - retrait_img;
-      width_theMainImage = image_max.width;
-      height_theMainImage = image_max.height;
-    } else {
-      //=========================
-      // test débordement
-      //=========================
-      rapport = Zone_image.rapport_init;
-      width_theMainImage = Math.ceil(image_max.width);
-      height_theMainImage = Math.ceil(width_theMainImage / rapport);
-
-      container.height_interne = container.height - marge_top - marge_bottom;
-      container.width_interne = container.width - marge_left - marge_right;
-
-      if (height_theMainImage > container.height_interne) {
-        image_max.height = container.height_interne;
-        image_max.width = image_max.height * rapport;
-        width_theMainImage = Math.ceil(image_max.width);
-        height_theMainImage = Math.ceil(image_max.height);
-      }
-      if (width_theMainImage > container.width_interne) {
-        image_max.width = container.width_interne;
-        image_max.height = image_max.height / rapport;
-        width_theMainImage = Math.ceil(image_max.width);
-        height_theMainImage = Math.ceil(image_max.height);
-
-      } else if (width_theMainImage > container.width) {
-
-      } else {
-
-      }
-    }
-    //=============================================================== 
-  }
-  if (Type_Img != "pamoorama") {
-
-  }
-
-  //=================================================
-  rapport = Zone_image.rapport_init;
-
-  height_theMainImage = Math.ceil(width_theMainImage / rapport);
-  container.height = height_theMainImage + retrait_img_h + infos_theImage.general.marges.top + pos_top;
-
-  //================================================================
-  Zone_image.image = {
-    width: width_theMainImage,
-    height: height_theMainImage
-  };
-
-  Zone_image.container = {
-    width: container.width,
-    height: container.height
-
-  };
-  //=================================================================
-
-  Zone_image.src = jQuery(theMainImage_Id).attr("src");
-
-
-  Zone_image.zoom = Zone_image.image.height / Zone_image.height_init;
-
-}
-
-/*********************************************
-* Calcul l es dimensions.
-*********************************************/
-Get_dimensions = function (force, parametres) {
-  infos_theMainImage = jQuery(theMainImage_Id).infos();
-  Zone_image.src = infos_theMainImage.src;
-  if (typeof rapport == "undefined") return;
-  if (force && force == true) old_window.width = 0;
-
-
-  if (infos_theMainImage.useMap.match(RegExp("Autosize", "gi")))
-    infos_theMainImage.useMap = "#Autosize";
-
-  useMap = options.useMap;
-
-  if (theme.match("simple")) useMap = "#Autosize";
-  if (typeof useMap == "") useMap = "#Autosize";
-  if (options.useMap) {
-    //  useMap = options.useMap;
-  }
-  if (useMap) {
-    if (!useMap.match(RegExp("Autosize", "gi"))) {
-      return;
-    }
-  }
-
-  if (options.imageAutosize) {
-    return; //stripped
-  }
-
-  if (typeof options.cl_visible == "undefined") return;
-  if (!options.cl_visible == true) { return; }
-  //======================================================
-
-  var chk = eval("options." + user_status + "_enabled");
-  if (chk == "") { return; }
-
-  if (!options.useMap.match(RegExp("Autosize", "gi"))) {
 
     return;
   }
 
-  //================================================================= 
-  infos_widow = jQuery(window).infos();
-  var winwidth = infos_body.width;
-  var winheight = infos_body.height;
-  if (Type_Img == "pamoorama") {
-    theMainImage_Id = "#pamoorama";
-    Calcul_Image();
-  } else {
-    Calcul_Image();
-  }
-  img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
-  //=================================================================
-  old_window = jQuery(window).infos();
-  //========= Récupération des informations =============  
-  var Licence = jQuery(".licencetag");
-  infos_Licence = jQuery(".licencetag").infos();
-  //=================================================================
-  switch (Type_Img) {
-    case "map":
-      Set_Map(true);
-      break
-    case "panorama":
-      if (!theMainImage_Id) {
-        theMainImage_Id = "#theMainImage";
-        if (theMainImage_Id.length > 0)
-          return;
-        theMainImage_Id = jQuery().Get_Img_Maxi("#Panorama img[alt]");
-
-        if (theMainImage_Id.length > 0)
-          theMainImage_Id = theMainImage_Id[0];
-        else
-          theMainImage_Id = jQuery().Get_Img_Maxi("#Panorama img[alt]");
-      }
-      infos_theImage = jQuery(theMainImage_Id).infos();
-      infos_the_page = jQuery("#the_page").infos();
-      jQuery("#theImage").height(infos_theImage.height);
-      img_finale.height = infos_theImage.height;
-      break
-    case "img":
-
-      if (!theMainImage_Id) return;
-      if (theme.match(RegExp("luciano", "g"))) {
-
-      }
-
-      infos_the_page = jQuery("#the_page").infos();
-
-
-      break
-    case "img_autre":
-      if (!theMainImage_Id) {
-        if (DEBUG_autosize == "true") alert("The_MainImage=null");
-        return;
-
-      }
-      infos_theImage = jQuery(theMainImage_Id).infos();
-      infos_the_page = jQuery("#the_page").infos();
-
-
-      break
-    case "embed":
-      //
-      if (infos_theMainImage.width == 0)
-        infos_theMainImage = jQuery("#thePicturePage").infos();
-      if (infos_theMainImage.width == 0)
-        infos_theMainImage = jQuery("#the_page").infos();
-      infos_theImage = infos_theMainImage;
-      infos_the_page = jQuery("#the_page").infos();
-      Bandeau_bas.height = Bandeau_bas.top;
-
-      iph1 = jQuery("#theImage div").infos();
-      if ((winheight - iph1.bottom) > 0)
-        Bandeau_bas.height = (winheight - iph1.bottom) + 50;
-      else
-        Bandeau_bas.height = 50;
-
-
-      if (rapport < 0) {
-        img_height = infos_theMainImage.height;
-        img_width = infos_theMainImage.width;
-        img_reelle.height = img_height;
-        img_reelle.width = img_width;
-      }
-
-      break
-    case "charlie":
-      img_reelle = { height: img_height, width: img_width };
-      infos_theMainImage = jQuery(theMainImage_Id).infos(); ;
-      infos_the_page = jQuery("#the_page").infos();
-      if (rapport < 0) {
-        img_height = parseInt(infos_theMainImage.height);
-        img_width = parseInt(infos_theMainImage.width);
-        img_reelle.height = parseInt(infos_theMainImage.height);
-        img_reelle.width = parseInt(infos_theMainImage.width);
-      }
-      break
-
-
-    case "pamoorama":
-      img_reelle = { height: img_height, width: img_width };
-      //=========================================================
-      img_reelle.height = img_height;
-      img_reelle.width = Zone_Affichage.width;
-      if (typeof myPamoorama != "undefined") theMainImage_Id = myPamoorama.image;
-      infos_theImage = jQuery("#pamoorama").infos();
-      infos_theImage.height = infos_theImage.height;
-      infos_the_page = jQuery("#the_page").infos();
-      break
-  }
-
-  img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
-  return true;
-
-  //================= Vérification Taille image minimun autorisée ========
-  MinWidth = jQuery(theMainImage_Id).css("minWidth");
-  if (MinWidth == "0px")
-    MinWidth = options.mini_width;
-  MinHeight = jQuery(theMainImage_Id).css("minHeight");
-  if (MinHeight == "0px")
-    MinHeight = options.mini_height;
-
-  MaxWidth = jQuery(theMainImage_Id).css("maxWidth");
-  if (MaxWidth == "0px")
-    MaxWidth = winwidth;
-  MaxHeight = jQuery(theMainImage_Id).css("maxHeight");
-  if (MaxHeight == "0px")
-    MaxHeight = winheight;
-
-  //=============== Vérification taille minimale  autorizée ======================
-  var miniWidth = jQuery(theMainImage_Id).Get_Val_int(MinWidth, options.mini_width);
-  var miniHeight = jQuery(theMainImage_Id).Get_Val_int(MinHeight, options.mini_height);
-  if (winwidth < options.mini_width2) mini_width2 = winwidth;
-
-  var miniWidth2 = jQuery(theMainImage_Id).Get_Val_int(MinWidth, options.mini_width2);
-  var miniHeight2 = jQuery(theMainImage_Id).Get_Val_int(MinHeight, options.mini_height2);
-
-
-  var maxWidth = jQuery(theMainImage_Id).Get_Val_int(MaxWidth, winwidth, "0");
-  maxHeight = jQuery(theMainImage_Id).Get_Val_int(MaxHeight, winheight, "0");
-
-  mini_width = parseInt(miniWidth);
-  mini_height = parseInt(miniHeight);
-  img_reelle.width = parseInt(img_reelle.width);
-  if (img_reelle.width < mini_width)
-    return;
-  img_reelle.height = parseInt(img_reelle.height);
-  if (img_reelle.height < parseInt(mini_height))
-    return;
-
-
-
-
-  //=================================================
-  if (Zone_image.image.height < options.mini_height2)
-    Zone_image.image.height = options.mini_height2;
-  if (Zone_image.image.width < options.mini_width2)
-    Zone_image.image.width = options.mini_width2;
-  //==================================================
-  //   Image_width largeur à atteindre
-  //   Calcul du rapport d'agrandissement
-  echelle_max = parseFloat(options.echelle_max, '3');
-  if (Zone_image.zoom > echelle_max) {
-    Zone_image.zoom = echelle_max;
-    Zone_image.image.width = parseInt(Zone_image.width_init * Zone_image.zoom);
-    if (rapport > 0)
-      Zone_image.image.height = parseInt(Zone_image.width_init / rapport);
-  }
-  //=============================================================
-  var height_user = eval("options." + user_status + "_height");
-  var width_user = eval("options." + user_status + "_width");
-  var reg1 = new RegExp("%", "g");
-  //=============================================================     
-  if (height_user.match(reg1))
-    Image_height = Zone_image.height_init * parseInt(height_user) / 100;
-  else
-    Image_height = parseInt(height_user);
-  //==============================================================
-
-  Image_width = parseInt(Image_height * rapport);
-
-  //======================================================================
-  img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
-  return true;
-
-
-
-
-
-
-
-  //===================================================
-
-  img_finale.height = Image_height;
-  img_finale.width = Image_width;
-  if (theme.match(RegExp("stripped", "gi"))) {
-    img_finale.width -= (llgboframe.top * 2);
-    if (rapport > 0) img_finale.height = (img_finale.width / rapport);
-    else img_finale.height -= (llgboframe.top * 2);
-
-  }
-  zoom = echelle;
-  if (typeof (llgboframe) != "undefined" && llgboframe.height > 0) {
-    //=============LLGBO2 ===========================
-    t1 = llgboframe;
-    if (!theMainImage_Id.src) {
-      theMainImage_Id = jQuery(llgbo_id).find("img").get(0)
-      if (!theMainImage_Id.src) {
-        theMainImage_Id = jQuery("#theImage").find("div").get(0)
-      }
-    }
-    if (theMainImage_Id.src) {
-      wingbo = img_finale.width;
-      heightgbo = img_finale.height;
-      if (Type_Img == "panorama") {
-        heightgbo = infos_theImage.height;
-        img_finale.height = infos_theImage.height;
-      }
-
-
-
-
-      //    jQuery("#theImage").height(heightgbo + marges_llgbo / 2);
-    }
-  }
-
-  //================ Zone affichage =========================
-
-  //  jQuery("#theImage").css("top", "0px");
-  jQuery("#standard").css("top", 0 + "px");
-  jQuery("#comments").css("top", 0 + "px");
-  //========== Image Remise à l'échelle =======================
-
-  img_finale.height = parseInt(img_finale.height);
-  img_finale.width = parseInt(img_finale.width);
-  //=========================================================================
-  //=== cadre = theImage
-  if (theme.match(RegExp("simple", "gi"))) {
-    jQuery("#theImage").width(Zone_Affichage.width); //centrer simple black
-    jQuery("#theImage").css({ width: Zone_Affichage.width + "px",
-      marginLeft: "auto"
-    });
-
-  } else if (theme.match(RegExp("sobre", "gi")) || theme.match(RegExp("hr_", "gi")) || theme.match(RegExp("Mont", "gi"))) {
-    jQuery("#theImage").css({ width: "auto", marginLeft: "auto" });
-  } else if (theme.match(RegExp("saruka", "gi"))) {
-
-    jQuery("#theImage").css({ width: Zone_Affichage.width + "px" });
-  } else if (theme.match(RegExp("elegant", "gi"))) {
-
-    // jQuery("#theImage").css("width", "auto");
-    jQuery("#theImage").css({ height: Zone_Affichage.height + "px", width: "auto" }); //conteneur
-
-  } else {
-    jQuery("#theImage").css("width", "auto");
-
-  }
-  // ;
-
-  if (Type_Img == "panorama" || Type_Img == "pamoorama") {
-    img_finale.height = infos_theImage.height;
-    Zone_Affichage.height = img_finale.height;
-
-  }
-
-  if (typeof (gmaps) != "undefined") {
-    Gmap_ = gmaps.maps[0];
-    if (Gmap_.sizeMode == 'A') {
-      jQuery("#iGMapsIcon").css({ width: old_window.width * 0.8 + "px", height: old_window.height * 0.8 + "px" });
-
-    }
-  }
-  //============= flv,mov,mpg  ok
-  /* wmv nok
-  * avi nok
-  //===========================================
-  */
-  if (Type_Img == "charlie") {
-    t1 = jQuery("#charlie").infos();
-
-    /**/
-
-    pdf = 0;
-    jQuery("#charlie div").each(function (i) {
-
-
-      p1 = jQuery(this).infos();
-      pdf += p1.padding.right + p1.padding.left;
-    });
-    img_finale.width -= pdf;
-
-    jQuery("#charlie").css({
-      width: img_finale.width + pdf + "px",
-      height: img_finale.height + "px",
-      marginLeft: "auto"
-    });
-
-
-    if (MainImage.length > 0) {
-      img_finale.height = parseInt(img_finale.width / rapport);
-      img_finale.height -= 30;
-      img_finale.width = rapport * img_finale.height;
-
-
-      MainImage.width(img_finale.width);
-      MainImage.height(img_finale.height);
-      jQuery("#embedplayer").width(300);
-      jQuery("#embedplayer").height(15);
-    } else {
-      jQuery("#player").css("width", img_finale.width + "px");
-      jQuery("#player").css("height", img_finale.height + "px");
-
-      jQuery("#embedplayer").css("width", img_finale.width + "px");
-      jQuery("#embedplayer").css("height", img_finale.height + "px");
-
-      jQuery("embed").css({ width: img_finale.width + "px",
-        height: img_finale.height + "px"
-      });
-      jQuery("object").css({ width: img_finale.width + "px",
-        height: img_finale.height + "px"
-      });
-      jQuery("video").css({ width: img_finale.width + "px",
-        height: img_finale.height + "px"
-      });
-
-
-
-      jQuery("video").height(img_finale.height);
-      jQuery("video").width(img_finale.width);
-
-      jQuery("object").width(img_finale.width);
-      jQuery("object").height(img_finale.height);
-      //jQuery("#theImage").height(img_finale.height + Bandeau_bas.height); //??             
-
-      jQuery(theMainImage_Id).height(img_finale.height);
-      jQuery("#theImage").css("height", "auto");
-    }
-
-
-  } else if (Type_Img == "embed") {
-
-    if (MainImage.length > 0) {
-      img_finale.height = parseInt(img_finale.width / rapport);
-      img_finale.height -= 30;
-      img_finale.width = rapport * img_finale.height;
-
-
-      MainImage.width(img_finale.width);
-      MainImage.height(img_finale.height);
-      jQuery("#embedplayer").width(300);
-      jQuery("#embedplayer").height(15);
-    } else {
-      jQuery("#theImage").css("height", "auto");
-      jQuery("embed").css("height", img_finale.height);
-      jQuery("object").css({ height: img_finale.height + "px" });
-
-      jQuery("object").width(img_finale.width);
-      jQuery("object").height(img_finale.height);
-    }
-
-  } else if (Type_Img == "panorama") {
-    if (typeof asp_options != "undefined")
-      n = asp_options;
-    n1 = jQuery("#Panorama div").width();
-    jQuery(".panorama-viewport").css("margin", "auto");
-    n = infos_imageToolBar;
-
-
-  } else if (Type_Img == "pamoorama") {
-    Set_Pamoorama();
-
-
-
-
-  } else if (theMainImage_Id != null && theMainImage_Id.src) {
-    //--- background ?? ---
-    jQuery(theMainImage_Id).height(img_finale.height);
-    jQuery(theMainImage_Id).width(img_finale.width);
-    jQuery(theMainImage_Id).css({ height: img_finale.height + "px ",
-      width: img_finale.width + "px "
-    });
-
-
-  } else {
-    //===map ? luciano ===
-    //   jQuery(theMainImage_Id).css({ height: img_finale.height + "px ",  width: img_finale.width + "px });
-    //   jQuery(theMainImage_Id).height(img_finale.height );
-    //   jQuery(theMainImage_Id).width(img_finale.width );
-    //   jQuery(theMainImage_Id).attr({ width: img_finale.width  });
-    h = img_finale.height;
-    h = Zone_Affichage.height - Zone_Affichage.borderwidth.top - Zone_Affichage.borderwidth.bottom;
-    h -= (infos_theImage.borderwidth.bottom + infos_theImage.borderwidth.top);
-
-    jQuery(theMainImage_Id).attr({ height: h - 3 }); //image
-    if (theme.match(RegExp("elegant", "gi"))) {
-      return true;
-
-    }
-    if (theme.match(RegExp("luciano", "g"))) {
-      imgl = 180;
-      l = Zone_Affichage.left;
-
-      jQuery(".imageNumber").css({ left: l + "px"
-
-      });
-      jQuery("#theImage" + " #theImg IMG").css({ height: img_finale.height + "px ",
-        width: (img_finale.width - imgl) + "px ", marginTop: "0px"
-      })
-    }
-
-  }
-
-  var theImg = document.getElementById(theMainImage_Id.replace("#", ""));
-  if (theImg) {
-    theImg.removeAttribute("width");
-    theImg.removeAttribute("height");
-    jQuery(theMainImage_Id).css("width", img_finale.width + "px");
-  }
-
-  jQuery("#navThumbPrev").css({ overflow: "hidden" });
-  jQuery("#navThumbNext").css({ overflow: "hidden" });
-  n = typeof inittoolbar;
-  if (Type_Img == "map") {
-    jQuery("#navThumbNext").css({ display: 'none' });
-    jQuery("#navThumbPrev").css({ display: 'none' });
-    jQuery("#theImage").css({ marginTop: infos_imageToolBar.height + "px", marginLeft: "0px",
-      width: winwidth + "px",
-      height: winheight + "px"
-    });
-    //mapPicture 
-  }
-  try {
-    if (theme.match(RegExp("gally", "gi"))) {
-      if (typeof inittoolbar == "function") {
-        if (typeof (currentTab) == "undefined") inittoolbar();
-        else initializeImageMode("resize");
-      } else {
-        tp = gallyPP.getImageProp();
-        if (typeof (GallyPP) == "function")
-          gallyPP = new GallyPP();
-
-        iph = jQuery("#imageHeaderBar").infos();
-        jQuery("#imageToolBar").css({ top: iph.bottom + "px", position: "absolute" });
-        jQuery("#theImage").width(winwidth);
-      }
-      //===========================================================================
-      if (jQuery("#navThumbPrev").length > 0) {
-        jQuery("#navThumbPrevContainer").css({ left: "0px"
-        });
-      }
-      if (jQuery("#navThumbNext").length > 0) {
-        jQuery("#navThumbNextContainer").css({ left: "0px"
-        });
-      }
-      //=============================================================================
-      if (!theme.match(RegExp("lapis", "gi"))) {
-        if (typeof initializeImageMode == "function") {
-          initializeImageMode("resize");
-        }
-
-      }
-
-    } else if (theme.match(RegExp("simple", "g"))) {
-
-      jQuery("#imageToolBar").css({ position: "static" });
-
-      infos_imageInfoBar = jQuery("#imageInfoBar").infos();
-      if (infos_imageInfoBar.bottom < infos_theMainImage.bottom) {
-        //   jQuery("#imageInfoBar").height(infos_theMainImage.bottom);
-      }
-
-    } else {
-
-      //    jQuery("#imageToolBar").css("position", "static");
-    }
-  } catch (e) {
-
-  }
-  zoom = img_finale.height / img_height;
-  h0 = jQuery("#content").height();
-  if (h0 == null) {
-    h0 = winheight - Zone_Affichage.top;
-  }
-  h1 = (h0 - img_finale.height) / 2;
-  //  jQuery("#theImage").css({ marginTop: h1 + "px" });
-
-  zoom = parseInt(zoom * 100);
-  jQuery('#zoom ').val(zoom);
-
-
-
-  //  --- réglage de la hauteur de page en fonction du copyright-----------
-  if (typeof (pos_copyright) == "undefined") pos_copyright = jQuery("#copyright").infos();
-
-  if (theme.match(RegExp("stripped", "gi"))) {
-    var TitleBox = jQuery("#imageTitleContainer");
-    if (TitleBox.length != 0) TitleBox.css("width", img_finale.width + "px");
-  } else {
-
-  }
-
-
-  /*
-  if (!theme.match(RegExp("luciano", "gi"))) {
-  jQuery("#linkNext").css({ height: "80px", width: "200px", overflow: "hidden" });
-  jQuery("#linkPrev").css({ height: "80px", width: "200px", overflow: "hidden" });
-  jQuery(".navThumb img").css({ height: "80px", width: "", overflow: "hidden" });
-  }
-  */
-  infos_frame = jQuery("#theImage").infos();
-  if (theme.match(RegExp("stripped", "gi"))) {
-    /*
-    infos_theImageBox = jQuery("#theImageAndTitle").infos();
-    p1 = jQuery(".randomButtons").infos();
-    p2 = jQuery("#imageHeaderBar").infos();
-    p3 = infos_content.top;
-    p1 = options.imageAutosizeTitle;
-
-    jQuery("#theImage").width("width", infos_theImageBox.width + "px");
-    //jQuery("#theImageAndTitle").css("position", "relative");
-    jQuery("#content").css({ position: "relative", top: "10px", marginTop: "0px",
-    paddingTop: "0px", textAalign: "center", marginLeft: "auto"
-    });
-
-    jQuery("#theImageAndTitle").css({ position: "relative", top: "0px", marginTop: "0px",
-    paddingTop: "0px", marginLeft: "auto"
-    }); */
-    t1 = infos_theImageBox.top;
-    l1 = infos_theImageBox.left;
-    // infos_theImageBox = jQuery("#theImage").infos();
-
-  } else {
-
-    t1 = infos_frame.top;
-    l1 = infos_frame.left;
-    infos_theImageBox = jQuery("#theImage").infos(); //theImage
-  }
-  infos_theImageBox.margin.margin = infos_frame.margin.margin;
-  infos_theImageBox.top = t1;
-  infos_theImageBox.left = l1;
-  //  infos_theImageBox.position = "absolute";
-
-  Window_Affichage = infos_theImageBox;
-  if (DEBUG_autosize == "_true") {
-    //   jQuery("#theImage").css("border", "solid green");
-
-    jQuery("#Debug5").css({ background: "red",
-      position: "absolute",
-      border: "green solid 2px",
-      textAlign: align_auto,
-      margin: "auto",
-      top: Window_Affichage.top + "px",
-      left: Window_Affichage.left + "px",
-      width: Window_Affichage.width + "px",
-      height: Window_Affichage.height + "px"
-    }); //red
-    jQuery("#Debug4").css({ top: infos_frame.bottom - infos_description.height + "px" }); //green
-  }
-
-  //Wait_Affichage();
-
-  return true;
-} // Get_dimensions
-
-
-//=========================================================
-theMainImage_Id = "#theMainImage";
-if (typeof (options) == "undefined") {
-  options = { imageAutosize: false }
-}
-options = jQuery.extend(Autosize_options, options);
-var defaults = {
-  useMap: '#Autosize',
-  imageAutosizeMargin: 0,
-  imageAutosize: false,
-  marge_basse: options.imageAutosizeMargin || 0,
-  DEBUG_autosize: false
-};
-
-options = jQuery.extend(defaults, options);
-jQuery("#form_autosize_picture").addClass("Autosize_margin");
-//===== marges suplémentaires en fonction theme ===
-options.marge_haute = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("top"));
-options.marge_basse = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("bottom"));
-options.marge_gauche = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("left"));
-options.marge_droite = jQuery(".Autosize_margin").Get_Val_int(jQuery(".Autosize_margin").css("right"));
-
-
-DEBUG_autosize = options.DEBUG_autosize;
-cookies = Get_cookies();
-
-//============= Gestion Maps ================
-nom_map = "Autosize";
-a_up = jQuery("map[name='" + nom_map + "'] area[rel=up]");
-a_prev = jQuery("map[name='" + nom_map + "'] area[rel=prev]");
-a_next = jQuery("map[name='" + nom_map + "'] area[rel=next]");
-
-new_html = '<map name="Autosize" >';
-
-var theme = options.theme;
-nb_zone = jQuery("div .navigationButtons a").length;
-var infos_theMainImage = jQuery(theMainImage_Id).infos();          // Image 
-var Largeur_zone = (infos_theMainImage.width / nb_zone);
-var Hauteur_zone = (infos_theMainImage.height);
-var init_zone = 0;
-j = 0;
-jQuery("div .navigationButtons a").each(function (e) {
-  Hauteur_zone = (infos_theMainImage.height);
-  title = jQuery(this).attr("title");
-  h_ref = jQuery(this).attr("href");
-  init_zone = Largeur_zone * j;
-  if (title.match(":")) {
-    if (j == 0)
-      rel = "prev";
-    else
-      rel = "next";
-  } else {
-    rel = "up";
-    Hauteur_zone = Hauteur_zone / 4;
-  }
-  coord = init_zone + "," + 0 + "," + Math.ceil(init_zone + Largeur_zone) + "," + Hauteur_zone;
-  new_html += '<area rel="' + rel + '" title="' + title + '" href="' + h_ref + '" shape="rect" coords="' + coord + '" alt="' + title + '" />';
-
-  j++;
-});
-new_html += '</map>';
-jQuery("#theImage map:last").after(new_html);
-
-//=================== Gestion liste photos size ============================
-us = 0;
-var user_status = options.user_status;
-var type_size = eval("options." + user_status + "_type"); //limite taille
-var type_size_maxi = eval("options." + user_status + "_type"); //limite taille
-
-n = 0;
-
-var pt = new Array();
-jQuery("#derivativeSwitchBox .switchCheck").css('visibility', 'hidden');
-jQuery("#derivativeSwitchBox a").css('visibility', 'hidden');
-
-jQuery("#derivativeSwitchBox a").each(function (i) {
-  href_path = jQuery(this).attr("href");
-  pt[i] = href_path.split("'");
-  tsz = pt[i][5];
-  jQuery(this).css('visibility', 'visible');
-  //--- recherche limite ---
-  if (tsz.match(RegExp(type_size_maxi, "gi"))) {
-    return false;
-  }
-  //--- type en cours ---
-  if (tsz.match(RegExp("^" + options.type_size, "gi"))) {
-    us = n;
-  }
-
-  n++;
-});
-
-jQuery("derivativeChecked" + options.type_size).css('visibility', 'visible');
-
-
-
-//===================
-// VARIABLES  
-//===================
-var theMainImage_Id = "#theMainImage";
-type_src = "div";
-old_window = { width: 0, height: 0 };
-List_autosize = new Array();
-nu_img = 0;
-tempo = 0;
-//====================================================
-var infos_thePicturePage = jQuery("#thePicturePage").infos();
-var infos_theImageAndInfos;
-
-var theImageAndInfos_id = "#theImageAndInfos";
-if (options.theme.match(RegExp("simple", "gi"))) {
-  theImageAndInfos_id = "#content";
-
-  jQuery(theMainImage_Id).attr("position", "static");
-
-
-} else {
-  infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
-  if (infos_theImageAndInfos.visible == true)
-    theImageAndInfos_id = "#theImageAndInfos";
-  else
-    theImageAndInfos_id = "#imageContainer";
-}
-
-infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
-
-var infos_theImage = jQuery("#theImage").infos();                  // Container
-infos_theMainImage = jQuery(theMainImage_Id).infos();          // Image 
-
-if (infos_theMainImage.width == 0) {
-  infos_theMainImage = jQuery("#theImage img").infos();
-  if (infos_theMainImage.id == "")
-    jQuery("#theImage img").attr("id", "theMainImage");
-  infos_theMainImage = jQuery(theMainImage_Id).infos();
-}
-
-var infos_imageInfos = jQuery("#imageInfos").infos();              // Informations
-
-
-var infos_the_page = jQuery("#the_page").infos();
-var infos_content = jQuery("#content").infos();
-var infos_titrePage = jQuery("#titrePage").infos();
-var infos_imageInfoBar = jQuery("#imageInfoBar").infos();
-var infos_theHeader = jQuery("#theHeader").infos();
-var infos_imageToolBar = jQuery("#imageToolBar").infos();
-var infos_imageHeaderBar = jQuery("#imageHeaderBar").infos();
-var infos_body = jQuery("body").infos();
-var llgbo_id = "#llgbo0";
-
-var infos_llgbo = jQuery(llgbo_id).infos();
-var infos_llgboh2 = jQuery("#llgboh2").infos();
-
-var marges_llgbo = 0;
-var Zone_image = {
-  width_init: options.img_width,
-  height_init: options.img_height,
-  rapport_init: options.img_width / options.img_height
-};
-
-var Type_Img = "";
-
-
-
-pos_top = jQuery(theImageAndInfos_id).position();
-pos_top = pos_top.top - infos_theImageAndInfos.general.marges.top;
-pos_top += infos_content.general.marges.top;
-pos_top += infos_theImage.general.marges.top;
-options.pos_top = pos_top;
-
-
-old_window = { width: 0, height: 0 };
-
-
-//==== en cours ============
-n = pt.length - 1;
-if (n >= 0) {
-  imgSrc = pt[n][1];
-  last_map = pt[n][5];
-
-  imgSrc = pt[us][1];
-  last_map = pt[us][5];
-
-  new_html = '<br /><span class="switchCheck" id="derivativeCheckedAutosize" style="visibility:visible" >&#x2714; </span>';
-  new_html += '<a id="linkAutosize" href="javascript:changeImgSrc(\'' + imgSrc + '\', \'' + last_map + '\', \'' + type_size + '\') ">';
-  new_html += 'Autosize<span class="derivativeSizeDetails" id="auto_details" > - Autosize</span>  </a>';
-  if (type_size.match(RegExp("Autosize", "gi"))) {
-    jQuery("#derivativeSwitchBox br:last").before(new_html);
-  }
-
-  useMap = cookies.pictureMap; // #mapxxx
-  if (useMap == "#Autosize" && type_size_maxi == "Autosize") {
-
-  } else {
-    useMap = last_map;
-  }
-
-  typeSave = cookies.typeSave; //picturederiv xxx
-  options.type_size = useMap.replace("#", "");
-
-  type_size = options.type_size;
-  cookies.pictureMap = useMap; // #mapxxx
-  cookies.typeSave = last_map; //picturederiv xxx
-  cookies.imgSrc = imgSrc;
-
-  changeImgSrc(imgSrc, last_map, type_size);
-
-
-}
-
-
-});                                                                                                                                                      // ready
 
   //=====================================================================
@@ -2455,24 +2704,27 @@
 
   }
- 
-
-    /********************************************************
-    * List_autosize_resize
-    ********************************************************/
-    function List_autosize_resize(event, ui) {
-      if (typeof wait_resize == "undefined") wait_resize = false;
-      if (wait_resize == true) return;
-      wait_resize = true;
-      if (List_autosize.length == 0) return;
-      for (i = 0; i < List_autosize.length; i++) {
-        Autosize_resize(jQuery(List_autosize[i]));
-      }
-      wait_resize = false;
-      return true;
+
+  /********************************************************
+  * List_autosize_resize
+  ********************************************************/
+  function List_autosize_resize(event, ui) {
+    if (typeof wait_resize == "undefined") wait_resize = false;
+    if (wait_resize == true) return;
+    wait_resize = true;
+    if (List_autosize.length == 0) return;
+    for (i = 0; i < List_autosize.length; i++) {
+      Autosize_resize(jQuery(List_autosize[i]));
     }
-
-
-
+    wait_resize = false;
+    return true;
+  }
+
+
+  jQuery("#derivativeSwitchBox a").mouseover(function () {
+    nu_img = 0;
+  });
 
 
   /**/
+
+})(jQuery);
Index: /extensions/Autosize/js/autosize.dimensions.js
===================================================================
--- /extensions/Autosize/js/autosize.dimensions.js	(revision 17191)
+++ /extensions/Autosize/js/autosize.dimensions.js	(revision 17192)
@@ -49,6 +49,7 @@
   *
   */
-  jQuery.each(['Left', 'Top'],
+  jQuery.each(['Left', 'Top', 'Right', 'Bottom', 'All'],
     function (i, name) {
+      //========== scroll =================
       jQuery.fn['scroll' + name] = function (val) {
         if (!this[0]) return;
@@ -58,28 +59,37 @@
         }) : this[0] == window || this[0] == document ? self[(name == 'Left' ? 'pageXOffset' : 'pageYOffset')] || jQuery.boxModel && document.documentElement['scroll' + name] || document.body['scroll' + name] : this[0]['scroll' + name];
       };
-      //================================================
-      jQuery.fn['absolute' + name] = function (val) {
-        if (!this[0]) return;
+      //========= Absolute =====================
+      jQuery.fn['absolute' + name] = function (Args) {
+        if (!this[0]) return 0;
         a = jQuery(this[0]);
-        m = 0;
-        while (a.length > 0) {
-          val = jQuery(a).infos();
-          if (val.position != "absolute") {
-            m += name == 'Left' ? val.left : val.top;
-            m += name == 'Left' ? val.margin.left : val.margin.top;
-            m += name == 'Left' ? val.margin.right : val.margin.bottom;
-            m += name == 'Left' ? val.borderwidth.left : val.borderwidth.top;
-            //   m += name == 'Left' ? val.borderwidth.right : val.borderwidth.bottom;
-            //   m += name == 'Left' ? val.padding.left : val.padding.top;
-            //   m += name == 'Left' ? val.padding.right : val.padding.bottom;
-            a = jQuery(a).offsetParent();
-          } else
-            break;
+        m = { Left: 0, Top: 0, Right: 0, Bottom: 0,
+          All: {
+            Left: 0, Top: 0, Right: 0, Bottom: 0
+          }
+        };
+        pos = jQuery(this).offset();
+        pos.top = Math.ceil(pos.top);
+        pos.left = Math.ceil(pos.left);
+
+        size = { width: jQuery(this).outerWidth(), height: jQuery(this).outerHeight() };
+
+        if (name == "All") {
+          m[name]['Left'] = pos.left;
+          m[name]['Top'] = pos.top;
+          m[name]['Right'] = pos.left + size.width;
+          m[name]['Bottom'] = pos.top + size.height;
+        } else {
+         
+          if (name == 'Left' || name == 'Top') {
+            m[name] = name == 'Left' ? pos.left : (pos.top);
+          } else {
+            m[name] = name == 'Right' ? pos.left + size.width : pos.top + size.height;
+          }
+
 
         }
-        //306
-
-
-        return m;
+
+
+        return m[name];
 
 
@@ -91,5 +101,11 @@
   jQuery.fn.extend({
 
-    infos: function () {
+    infos: function (Arguments) {
+      if (!Arguments) {
+        Arguments = { pos_absolute: false, pos_externe: false };
+
+      }
+      Args = { pos_absolute: Arguments.pos_absolute || false, pos_externe: Arguments.pos_externe || false };
+
       var width = 0, height = 0;
       var elem = jQuery(this).get(0);
@@ -118,5 +134,5 @@
       myposition = "";
       results = {
-        visible:false ,
+        visible: false,
         position: "",
         top: 0,
@@ -136,5 +152,5 @@
           bottom: 0
         },
-       
+
         exterieur: {
           width: 0,
@@ -143,5 +159,5 @@
           bottom: 0
         },
-    
+
         general: {
           width: 0,
@@ -149,14 +165,14 @@
           right: 0,
           bottom: 0,
-          marges: { height:0,
-                    top: 0,
-                    bottom: 0,
-                    width: 0,
-                    left: 0,
-                    right: 0
-                    }
-                },
-        src:"",
-        useMap : "" ,
+          marges: { height: 0,
+            top: 0,
+            bottom: 0,
+            width: 0,
+            left: 0,
+            right: 0
+          }
+        },
+        src: "",
+        useMap: "",
         id: "",
         nodeName: ""
@@ -177,4 +193,7 @@
           out_width = width;
           out_height = height;
+          in_width = width; ;
+          in_height = height;
+
         } else {
 
@@ -183,12 +202,11 @@
           out_width = jQuery(elem).outerWidth();
           out_height = jQuery(elem).outerHeight();
+          in_width = jQuery(elem).innerWidth();
+          in_height = jQuery(elem).innerHeight();
           elem_parent = elem.parentElement;
           if (typeof elem_parent == "undefined") {
             elem_parent = window;
           }
-          out_width = jQuery(elem).outerWidth();
-          out_height = jQuery(elem).outerHeight();
-          in_width = jQuery(elem).innerWidth();
-          in_height = jQuery(elem).innerHeight();
+
           if (typeof Css.width != "undefined")
             width = Get_Val_int(Css.width, jQuery(elem_parent).width(), 0);
@@ -236,11 +254,39 @@
         } else {
           Cl_Position = jQuery(elem).d_position();
+
+          /*
+          margin: 5px; 
+          border: 10px ;
+          padding: 20px; 
+
+          */
+          s_elem = elem;
+          Left = Cl_Position.left; //  291
+          Top = Cl_Position.top; // 812
+          if (Args.pos_absolute == true) {
+
+            all = jQuery(elem).absoluteAll();
+
+            Top = all.Top;
+            Left = all.Left;
+            Args.pos_externe = false;
+          }
+
+          if (Args.pos_externe == true) {
+            if (elem.tagName != "BODY") {
+              nodeName = nodeName || "";
+              L1 = jQuery(elem).position();  // sans les marges ;
+              L2 = jQuery(elem).position(true); //  296 x 817 
+              Left = L1.left;
+              Top = L1.top;
+            }
+
+          }
+
+          elem = s_elem;
         }
-        Left = Cl_Position.left;
-        Top = Cl_Position.top;
-
         visible = jQuery(elem).is(':visible');
-        results = { 
-          useMap : elem.useMap || "none",
+        results = {
+          useMap: elem.useMap || "none",
           src: elem.src || "none",
           visible: visible || false,
@@ -279,11 +325,11 @@
                       margin.bottom + borderwidth.bottom +
                       padding.bottom,
-                      top:  margin.top +
+              top: margin.top +
                             borderwidth.top +
                             padding.top,
-                      bottom: margin.bottom +
+              bottom: margin.bottom +
                        borderwidth.bottom +
                         padding.bottom,
-                      width:  margin.left +
+              width: margin.left +
                               borderwidth.left +
                               padding.left +
@@ -291,14 +337,14 @@
                               borderwidth.right +
                               padding.right,
-                      left: margin.left +
+              left: margin.left +
                             borderwidth.left +
                             padding.left,
-                      right: margin.right +
+              right: margin.right +
                              borderwidth.right +
                              padding.right
-                    }
+            }
           },
           id: id,
-          nodeName: nodeName
+          nodeName: nodeName || ""
         };
 
@@ -350,8 +396,16 @@
     */
     offsetParent: function () {
-      var offsetParent = this[0].offsetParent;
-      while (offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static'))
-        offsetParent = offsetParent.offsetParent;
-      return jQuery(offsetParent);
+      if (this[0] == window) return;
+      try {
+
+        n1 = this[0].nodeName;
+        var offsetParent = this[0].offsetParent;
+
+        while (offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static'))
+          offsetParent = offsetParent.offsetParent;
+        return jQuery(offsetParent);
+      } catch (e) {
+        jQuery(offsetParent);
+      }
     },
     // getStyles(Obj) Récupérer la valeur CSS 
@@ -485,6 +539,6 @@
   };
 
- // myjQuery = jQuery;
- // my$ = $;
+  // myjQuery = jQuery;
+  // my$ = $;
 
 })(jQuery);
Index: /extensions/Autosize/main.inc.php
===================================================================
--- /extensions/Autosize/main.inc.php	(revision 17191)
+++ /extensions/Autosize/main.inc.php	(revision 17192)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: AutoSize
-Version: auto
+Version: 2.04
 Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448
@@ -33,6 +33,7 @@
 $autosize_controler = new autosize_controler();
 add_event_handler('get_admin_plugin_menu_links', array(&$autosize_controler,'cl_autosize_admin')  );
+ 
 
-// add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_1'),  EVENT_HANDLER_PRIORITY_NEUTRAL+20  );	
+add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_1'),  EVENT_HANDLER_PRIORITY_NEUTRAL+21  );	
 
 add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL+21  );
@@ -40,5 +41,6 @@
 add_event_handler('loc_end_page_tail',array(&$autosize_controler, 'cl_autosize_script_2'),  EVENT_HANDLER_PRIORITY_NEUTRAL );
 
-
+//add_event_handler('loc_after_page_header', array(&$autosize_controler, 'autosize_calcContent'),  EVENT_HANDLER_PRIORITY_NEUTRAL-1, 20  );
+add_event_handler('render_element_content', array(&$autosize_controler, 'autosize_calcContent'),40,2);
 
 ?>
Index: /extensions/Autosize/template/autosize.tpl
===================================================================
--- /extensions/Autosize/template/autosize.tpl	(revision 17191)
+++ /extensions/Autosize/template/autosize.tpl	(revision 17192)
@@ -88,12 +88,10 @@
 
 </style>
-
-
-<div id="Debug0"  align=center style="color:black;z-index:2000;position:absolute; background-color:Beige; top:0px;left:0px;width:800px;margin:auto;"></div>
-<div id="Debug1"  align=center style="color:black;z-index:2000;position:absolute; background-color:Beige; top:0px;left:0px;width:800px;margin:auto;"></div>
-<div id="Debug2"  align=center style="color:black;z-index:2000;position:absolute; background-color:yellow; top:0px;left:0px;width:800px;margin:auto;"></div>
-<div id="Debug3"  align=center style="color:black;z-index:2000;position:absolute; background-color:blue; top:0px;left:0px;width:800px;margin:auto;"></div>
-<div id="Debug4"  align=center style="color:black;z-index:2000;position:absolute; background-color:green; top:0px;left:0px;width:800px;margin:auto;"></div>
-<div id="Debug5"  align=center style="color:black;z-index:2000;position:absolute; background-color:red; top:100px;left:0px;width:300px;margin:auto;"></div>
+<div id="Debug0"  ></div>
+<div id="Debug1"  ></div>
+<div id="Debug2"  ></div>
+<div id="Debug3"  ></div>
+<div id="Debug4"  ></div>
+<div id="Debug5" ></div>
  <div id="Debug6"  align=center style="display:none"></div>
 
@@ -120,2 +118,4 @@
 <input id='zoom'  name='zoom' type='hidden' value='' />
 </form ></div>
+
+<img id='loading' src='{$AUTOSIZE_PATH}images/loading.gif' style='position:absolute;left:50%;top:50%;z-index:10; display:none' />
Index: /extensions/Autosize/template/picture.tpl
===================================================================
--- /extensions/Autosize/template/picture.tpl	(revision 17191)
+++ /extensions/Autosize/template/picture.tpl	(revision 17192)
@@ -14,6 +14,5 @@
     title="{'cl_autosize_info_2'|@translate}"
     alt="{'cl_autosize_info_2'|@translate}" />
-    <img class="button" id="bp_img_cla" alt="{'cl_autosize_info_2'|@translate}"  src="{$cl_autosize_button.ICON}"  complete="complete"/><span>
-    </span>
+    <img class="button" id="bp_img_cla" alt="{'cl_autosize_info_2'|@translate}"  src="{$cl_autosize_button.ICON}"  complete="complete"/><span></span>
   </a>
 
