Changeset 16579


Ignore:
Timestamp:
Jul 10, 2012, 12:39:20 PM (12 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4

Location:
extensions/Autosize
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/autosize.inc.php

    r16124 r16579  
    137137                        if (typeof (save_framework) == 'function')
    138138                           save_framework('".$ma_page."'); 
    139          var cookie_path   ='". cookie_path() ."'
     139       var cookie_path   ='". cookie_path() ."'
    140140                        </script>";
    141141         
  • extensions/Autosize/css/autosize.css

    r16124 r16579  
    5454
    5555#theImage {
    56  /* margin: 10px;
     56  /*margin: 10px;
    5757 border: 10px solid #f0FFf0;
    5858  padding: 10px;
    5959 
    60   background-color: #00FF00; */
     60  background-color: #00FF00; 
     61  */
    6162}
    6263#theMainImage {
     
    6970}
    7071
    71 #imageInfos {
     72#imageInfos, #imageInfoBar {
    7273/* margin : 20px;
    7374  border: 20px solid #FFf0f0;
     
    7677  background-color: #FF0000; */
    7778}
     79
     80#theImageAndTitle {  z-index: 4; }
  • extensions/Autosize/js/Affiche_script.js

    r16124 r16579  
    1 Parent = "#theImage";
     1
    22// problème avec GMaps+diaporama:
    3 // corriger   gmaps_pip.class.inc.php ajouter ligne 90 if ( !isset($_GET['slideshow']))
    4   function Toggle_bp() {
    5     cl_visible = !cl_visible; 
    6     jQuery().newResize();
    7     Wait_Affichage();
    8     set_cl();
    9   }
    10   function set_cl(){
    11   if (typeof cl_visible == "undefined") return;
    12   if (typeof src1 == "undefined") return;
    13 
    14     if (cl_visible) src = src1;
    15     else src = src2;
    16 
    17     if (cl_visible) {
    18       src_info = src3;
    19       src_infos_1 = src3;
     3// corriger   gmaps_pip.class.inc.php ajouter ligne 90 if ( !isset($_GET['slideshow']))
     4//==============================================================
     5(function (jQuery) {
     6  jQuery(document).ready(function () {
     7    //===================
     8    // VARIABLES 
     9    //===================
     10    var theMainImage_obj = "#theMainImage";
     11
     12    type_src = "div";
     13    old_window = { width: 0, height: 0 };
     14    List_autosize = new Array();
     15    nu_img = 0;
     16    tempo = 0;
     17    //====================================================
     18
     19    var infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();  // Cadre general
     20    var infos_theImage = jQuery("#theImage").infos();                  // Container
     21    var infos_theMainImage = jQuery(theMainImage_obj).infos();          // Image
     22    var infos_imageInfos = jQuery("#imageInfos").infos();              // Informations
     23
     24
     25    var infos_the_page = jQuery("#the_page").infos();
     26    var infos_content = jQuery("#content").infos();
     27    var infos_titrePage = jQuery("#titrePage").infos();
     28    var infos_imageInfoBar = jQuery("#imageInfoBar").infos();
     29    var infos_theHeader = jQuery("#theHeader").infos();
     30    var infos_imageToolBar = jQuery("#imageToolBar").infos();
     31    var infos_body = jQuery("body").infos();
     32    var infos_llgbo = jQuery("#llgbo").infos();
     33    var infos_llgboh2 = jQuery("#llgboh2").infos();
     34    if (typeof (options) == "undefined") {
     35      options = { imageAutosize: false }
    2036    }
    21     else {
    22       src_info = src4;
    23       src_infos_1 = src5;
     37
     38    // jQuery(':Autosize');
     39    old_window = { width: 0, height: 0 };
     40
     41    if (typeof (options) == "undefined") {
     42      options = { imageAutosize: false }
    2443    }
    25     zoom = jQuery('#zoom ').val() ;
    26     jQuery('#bp_cla').attr('alt', src_info);
    27     jQuery('#bp_cla').attr('title', src_info);
    28 
    29     jQuery('#bp_cla').attr('Stitle', src_info);
    30     jQuery('#bp_cla').attr('Stip', zoom + "%");
    31 
    32   //jQuery('#bp_cla span').text(src_infos_1 +"    "+ zoom + "%");
    33     jQuery('#bp_cla span').text(zoom+"%" );
    34     bp_scr = jQuery('#bp_img_cla');
    35 
    36     if (bp_scr.length > 0) {
    37         bp_scr.get(0).src = src;
    38         jQuery('#bp_img_cla').attr('alt', src_info);
    39         jQuery('#bp_img_cla').attr('title', src_info);   
     44
     45    var defaults = {
     46      id_map: 'autosize',
     47      imageAutosizeMargin: 0,
     48      imageAutosize: false
     49    };
     50    options = jQuery.extend(defaults, options);
     51
     52    //=============================================================
     53    // REPONSE ACTION
     54    //=============================================================
     55    jQuery("#reset").click(function () {
     56      location.reload();
     57    });
     58
     59    //===========================================================
     60    //  REPONSE TRIGGER
     61    //===========================================================
     62    jQuery('#pamoorama').live('ON', function (e) {
     63      jQuery(jQuery('.debug').get(1)).trigger('ON');
     64      if (typeof Bandeau_bas == "undefined" || Bandeau_bas.width == 0) {
     65        Bandeau_bas = infos_Description_f("#theImage");
     66        Bandeau = Bandeau_bas.top;
     67      }
     68    });
     69    //=============================================================
     70    jQuery('#ret_autosize').live('ON', function (e) {
     71      if (nu_img == "") nu_img = 8;
     72      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
     73
     74    });
     75
     76    //==================================
     77    // jQuery("#llgbo").trigger("ON");
     78    //==================================
     79    jQuery("#llgbo").live('ON', function (e) {
     80      infos_llgbo = jQuery("#llgbo").infos();
     81      //llgboframe
     82      marges_llgbo = 0;
     83
     84      if (infos_llgbo.height > 0) {
     85        ll2 = jQuery("#llgbo div:last").infos();
     86        ll1 = jQuery("#llgbo div:first").infos();
     87        ll2 = "";
     88        jQuery("#llgbo div").each(function (i) {
     89          if (this.id == "") return;
     90          var llgbo_frame = document.getElementById(this.id);
     91          this.removeAttribute("width");
     92          this.removeAttribute("height");
     93          ll2 = this;
     94        });
     95
     96        ll2 = jQuery(ll2).infos();
     97        ll1 = ll1.width;
     98        ll2 = ll2.width - ll2.borderwidth.left - ll2.borderwidth.right;
     99        marges_llgbo = (ll1 - ll2);
     100        infos_llgbo.borderwidth.left = parseInt(marges_llgbo / 2);
     101        infos_llgbo.borderwidth.right = parseInt(marges_llgbo / 2);
     102        infos_llgbo.borderwidth.top = parseInt(marges_llgbo / 2);
     103        infos_llgbo.borderwidth.bottom = parseInt(marges_llgbo / 2);
     104        infos_llgboh2 = jQuery("#llgboh2").infos();
     105      }
     106    });
     107    //==============================
     108    // jQuery("#mapPicture").trigger("ON");
     109    //==============================
     110    jQuery("#mapPicture").live('ON', function (e) {
     111      p2 = jQuery("#infoSwitcher").infos();
     112    });
     113    //==============================
     114    // jQuery("#map").trigger("ON");
     115    //==============================
     116    jQuery("#map").live('ON', function (e) {
     117
     118    });
     119
     120    //===================================
     121    // jQuery("#theImage").trigger("ON");
     122    //===================================
     123    jQuery("#theImage").live('ON', function (e) {
     124      theImage_init("#theImage");
     125    });
     126
     127    /***********************
     128    *
     129    **********************/
     130    jQuery("#theMainImage").error(function (e) {
     131      alert(this.src + ' Image does not exist !!');
     132    });
     133
     134    jQuery("#theMainImage,.preload, .next1 , ").load(function (e) {
     135      theImg = this;
     136      name_src = theImg.src;
     137      if (theImg.naturalWidth)
     138        img_init.width = theImg.naturalWidth;
     139      if (theImg.naturalHeight)
     140        img_init.height = theImg.naturalHeight;
     141
     142      theMainImage_obj = "#theMainImage";
     143
     144      nds = jQuery("#imageInfos").css("display"); //inline-block
     145      Zone_image = Calcul_Image(nds == "none");
     146
     147
     148      jQuery(theMainImage_obj).width(Zone_image.image.width);
     149
     150
     151
     152    });
     153
     154    //=================================================================
     155    jQuery(document).live('gallyInterfaceReady', function (e) {
     156      i = jQuery(this).text();
     157      jQuery(this).trigger('ON');
    40158    }
    41159
    42    
    43 
    44 }
    45 
    46 function Wait_pamoorama() {
    47     if (jQuery("#pamoorama").length) {
     160          );
     161    // jQuery("#theImage").trigger("OK");
     162    jQuery("#theImage").live('Start_right', function (e) {
     163      if (nu_img == "") nu_img = 7;
     164      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
     165      test_w = window.myPamoorama.autoSlideFx.to;
     166      test_w = window.myPamoorama.autoScrollFx.to;
     167    });
     168
     169    jQuery("#theImage").live('Start_left', function (e) {
     170      if (nu_img == "") nu_img = 7;
     171      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
     172      test_w = window.myPamoorama.autoSlideFx.to;
     173      test_w = window.myPamoorama.autoScrollFx.to;
     174
     175    });
     176
     177    // Custom Event, ON to turn on a debug.
     178    jQuery('.debug').live('ON', function (e) {
     179
     180      nu_img = jQuery(this).text();
     181      jQuery('.debug').trigger('OFF');
     182      jQuery(this).addClass('debugOn');
     183
     184    });
     185
     186    // On Click = debugs On
     187    jQuery('.debug').live('click', function (e) {
     188      i = jQuery(this).text();
     189      jQuery(this).trigger('ON');
     190    });
     191
     192    // Custom Event, Turn off a debug
     193    jQuery('.debug').live('OFF', function (e) {
     194      jQuery(this).removeClass('debugOn');
     195    });
     196
     197    // on Double Click, remove the debug from the DOM
     198    jQuery('.debug').live('dblclick', function () {
     199      jQuery(this).fadeOut(function () { jQuery(this).remove() });
     200    });
     201
     202    // Add another debug to the DOM
     203    jQuery('#adddebugs').click(function () {
     204      i = jQuery('.debug').length;
     205      jQuery('<div>' + i + '</div>')
     206          .addClass('debug')
     207          .appendTo('#debugsContainer');
     208    });
     209
     210
     211
     212    //=====================================================================
     213    // jQuery("#theImageAndInfos").trigger("ON");
     214    jQuery("#theImageAndInfos").live('ON', function (e) {
     215      infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
     216
     217
     218    }); // fin click #theImageAndInfos ON
     219    //=====================================================================
     220    jQuery("#infoSwitcher").click(function () {
     221      jQuery("#llgbo").trigger("ON");
     222      jQuery("#theImage").css({ textAlign: "center" });
     223
     224      Autosize_resize(true);
     225
     226    }); // fin click infoSwitcher
     227    //====================================================
     228
     229    //piwigo 2.4
     230    // Add another debug to the DOM
     231    jQuery('#derivativeCheckedAutosize').click(function () {
     232      pathnames = jQuery(this).attr("href").split(":");
     233      try {
     234        eval(pathnames[1]);
     235      } catch (e) {
     236        n = false;
     237      }
     238    }); // fin click derivativeCheckedAutosize
     239    //====================================================
     240    jQuery("#derivativeSwitchBox a").click(function () {
     241      var theImg = document.getElementById("theMainImage");
     242      if (theImg) {
     243        pathnames = jQuery(this).attr("href").split(":");
     244
     245        try {
     246          eval(pathnames[1]);
     247          n = true;
     248        } catch (e) {
     249          n = false;
     250        }
     251        n = false;
     252        infos_theMainImage = jQuery(theMainImage_obj).infos();
     253        infos_theImage = jQuery("#theImage").infos();
     254        theImg.removeAttribute("width");
     255        theImg.removeAttribute("height");
     256        rapport = parseInt(img_init.width) / parseInt(img_init.height);
     257        if (n == true) {
     258          Autosize_resize(true);
     259        } else {
     260          var nw = "100% x 100%".split("x");
     261          if (jQuery(this).text().match(RegExp("x", "gi"))) {
     262            nw = jQuery(this).text().split("(")[1].split(")")[0];
     263            nw = nw.split("x");
     264            jQuery("#theImage").css({ marginRight: "auto", marginLeft: "auto", textAlign: "center" });
     265
     266            if (theImg.naturalWidth)
     267              img_init.width = theImg.naturalWidth;
     268            if (theImg.naturalHeight)
     269              img_init.height = theImg.naturalHeight;
     270
     271            wx = parseInt(nw[0]);
     272            //wh = parseInt(wx / rapport);
     273            //jQuery("#theImage").css("height", wh + "px");
     274            jQuery(theImg).width(wx);
     275            // jQuery(theImg).height(wh);
     276          }
     277        }
     278      }
     279
     280    });  // fin click #derivativeSwitchBox a
     281    //==========================================================
     282    //=========================================================================
     283    Autosize_init = function (name, value) {
     284      // default configuration properties
     285      var defaults = {
     286        id_map: 'autosize'
     287      };
     288      options = jQuery.extend(defaults, options);
     289
     290      jQuery("#the_page").css({ top: "0px" });
     291
     292      infos_theImageAndInfos = jQuery("#theImageAndInfos").infos(); // Cadre general
     293      infos_theImage = jQuery("#theImage").infos();
     294
     295      infos_theMainImage = jQuery(theMainImage_obj).infos();         // Cadre general
     296      if (infos_theMainImage.nodeName) {
     297
     298      }
     299      if (infos_theMainImage.width == 0) {
     300        infos_theMainImage = jQuery("#theImage img").infos();
     301        if (infos_theMainImage.id == "")
     302          jQuery("#theImage img").attr("id", "theMainImage");
     303        infos_theMainImage = jQuery(theMainImage_obj).infos();
     304      }
     305      infos_imageInfos = jQuery("#imageInfos").infos();             // Cadre general
     306      infos_the_page = jQuery("#the_page").infos();
     307      infos_content = jQuery("#content").infos();
     308      infos_titrePage = jQuery("#titrePage").infos();
     309      infos_imageInfoBar = jQuery("#imageInfoBar").infos();
     310      infos_theHeader = jQuery("#theHeader").infos();
     311      infos_imageToolBar = jQuery("#imageToolBar").infos();
     312      infos_imageHeaderBar = jQuery("#imageHeaderBar").infos();
     313      Zone_Affichage = jQuery("#theImage").infos();
     314
     315      jQuery.cl_cookie('path', cookie_path, { path: cookie_path });
     316      typeMap = jQuery.cl_cookie('picture_map');
     317      typeSave = jQuery.cl_cookie('picture_deriv');
     318      old_img = jQuery.cl_cookie('img');
     319      old_img_h = jQuery.cl_cookie('img_h');
     320      old_img_w = jQuery.cl_cookie('img_w');
     321      old_window_height = jQuery.cl_cookie('window_height');
     322      old_window_width = jQuery.cl_cookie('window_width');
     323      //============================================================
     324      img_init = { height: img_height, width: img_width };  // taille initiale
     325      img_defaut = { height: scaled_height, width: scaled_width };
     326      img_reelle = { height: img_height, width: img_width };
     327      img_finale = { height: 0, width: 0 };
     328      img_top = "0";
     329      rapport = -1;
     330      marges_llgbo = 0;
     331      //=============================================================
     332      Type_Img = "";
     333      nopano = false;
     334      rapport = parseInt(img_init.width) / parseInt(img_init.height);
     335      old_window = { width: 0, height: 0 };
     336    } // Autosize_init
     337    //===========================================================================
     338    Autosize_resize = function (force, parametres) {
     339
     340      if (force && force == true) old_window.width = 0;
     341      id_map = jQuery(theMainImage_obj).attr("usemap");
     342      if (typeof id_map == "undefined") id_map = jQuery("#theImage").attr("usemap");
     343      if (typeof id_map == "undefined") id_map = "Autosize";
     344      if (options.id_map) {
     345        //  id_map = options.id_map;
     346      }
     347      if (id_map) {
     348        if (id_map.match(RegExp("#map", "gi")) || id_map.match(RegExp("original", "gi"))) {
     349          return true;
     350        }
     351      }
     352
     353      if (options.imageAutosize) {
     354        // Wait_Affichage();
     355        return true; //stripped
     356      }
     357
     358      if (typeof cl_visible == "undefined") return true;
     359      if (!cl_visible == true) { return true; }
     360      var chk = eval(user_status + "_enabled");
     361      if (chk == "") { return true; }
     362      //=================================================================
     363      var winwidth = jQuery(window).width();
     364      var winheight = jQuery(window).height();
     365      nds = jQuery("#imageInfos").css("display"); //inline-block //block simple
     366      Zone_image = Calcul_Image(nds == "none");
     367      //=============================================================
     368      if (Type_Img == "pamoorama") {
     369        if (theMainImage_obj == "#pamoorama") {
     370          Set_Pamoorama();
     371        }
     372      }
     373      if (Type_Img == "map") {
     374
     375        Set_Map();
     376
     377      }
     378
     379      //=================================================================
     380      set_cl();
     381      jQuery("#theImage").width(Zone_image.container.width);
     382      jQuery("#theImage").height(Zone_image.container.height);
     383      n = winwidth - old_window.width;
     384      if (Math.abs(n) < 1) {
     385        n = winheight - old_window.height;
     386        if (Math.abs(n) < 1) {
     387          return false;
     388        }
     389      }
     390
     391      if (Math.abs(n) > 30) nu_img = 0;
     392      nu_img++;
     393      if (nu_img > 10) return true;
     394
     395      old_window = jQuery(window).infos();
     396      //========= Récupération des informations =============       
     397
     398
     399      var Licence = jQuery(".licencetag");
     400      infos_Licence = jQuery(".licencetag").infos();
     401
     402
     403      //=================================================================
     404
     405      switch (Type_Img) {
     406        case "map":
     407
     408          Set_Map(true);
     409
     410          ;
     411
     412          break
     413        case "panorama":
     414          if (!theMainImage_obj) {
     415            theMainImage_obj = "#theMainImage";
     416            if (theMainImage_obj.length > 0)
     417              return;
     418            theMainImage_obj = jQuery().Get_Img_Maxi("#Panorama img[alt]");
     419
     420            if (theMainImage_obj.length > 0)
     421              theMainImage_obj = theMainImage_obj[0];
     422            else
     423              theMainImage_obj = jQuery().Get_Img_Maxi("#Panorama img[alt]");
     424          }
     425          infos_theImage = jQuery(theMainImage_obj).infos();
     426          infos_the_page = jQuery("#the_page").infos();
     427          jQuery("#theImage").height(infos_theImage.height);
     428          img_finale.height = infos_theImage.height;
     429
     430          break
     431        case "img":
     432
     433          if (!theMainImage_obj) return true;
     434          if (theme.match(RegExp("luciano", "g"))) {
     435            theMainImage_obj = "#the_page #The_MainImage";
     436          }
     437
     438          infos_the_page = jQuery("#the_page").infos();
     439
     440
     441          break
     442        case "img_autre":
     443          if (!theMainImage_obj) {
     444            if (DEBUG_autosize == "true") alert("The_MainImage=null");
     445            return true;
     446
     447          }
     448          infos_theImage = jQuery(theMainImage_obj).infos();
     449          infos_the_page = jQuery("#the_page").infos();
     450
     451
     452          break
     453        case "embed":
     454          //
     455          if (infos_img.width == 0)
     456            infos_img = jQuery("#thePicturePage").infos();
     457          if (infos_img.width == 0)
     458            infos_img = jQuery("#the_page").infos();
     459          infos_theImage = infos_img;
     460          infos_the_page = jQuery("#the_page").infos();
     461          Bandeau_bas.height = Bandeau_bas.top;
     462
     463          iph1 = jQuery("#theImage div").infos();
     464          if ((winheight - iph1.bottom) > 0)
     465            Bandeau_bas.height = (winheight - iph1.bottom) + 50;
     466          else
     467            Bandeau_bas.height = 50;
     468
     469
     470          if (rapport < 0) {
     471            img_height = infos_img.height;
     472            img_width = infos_img.width;
     473            img_reelle.height = img_height;
     474            img_reelle.width = img_width;
     475          }
     476
     477          break
     478        case "charlie":
     479          infos_theImage = infos_img;
     480          infos_the_page = jQuery("#the_page").infos();
     481          if (rapport < 0) {
     482            img_height = parseInt(infos_img.height);
     483            img_width = parseInt(infos_img.width);
     484            img_reelle.height = parseInt(infos_img.height);
     485            img_reelle.width = parseInt(infos_img.width);
     486          }
     487          break
     488
     489
     490        case "pamoorama":
     491          img_reelle = { height: img_height, width: img_width };
     492          //=========================================================
     493          img_reelle.height = img_height;
     494          img_reelle.width = Zone_Affichage.width;
     495          if (myPamoorama) theMainImage_obj = myPamoorama.image;
     496          infos_theImage = jQuery("#pamoorama").infos();
     497          infos_theImage.height = infos_theImage.height;
     498          infos_the_page = jQuery("#the_page").infos();
     499          break
     500      }
     501      //================= Vérification Taille image minimun autorisée ========
     502      MinWidth = jQuery(theMainImage_obj).css("minWidth");
     503      if (MinWidth == "0px")
     504        MinWidth = mini_width;
     505      MinHeight = jQuery(theMainImage_obj).css("minHeight");
     506      if (MinHeight == "0px")
     507        MinHeight = mini_height;
     508
     509      MaxWidth = jQuery(theMainImage_obj).css("maxWidth");
     510      if (MaxWidth == "0px")
     511        MaxWidth = winwidth;
     512      MaxHeight = jQuery(theMainImage_obj).css("maxHeight");
     513      if (MaxHeight == "0px")
     514        MaxHeight = mwinheight;
     515
     516      //=============== Vérification taille minimale  autorizée ======================
     517      var miniWidth = jQuery(theMainImage_obj).Get_Val_int(MinWidth, mini_width);
     518      var miniHeight = jQuery(theMainImage_obj).Get_Val_int(MinHeight, mini_height);
     519      if (winwidth < mini_width2) mini_width2 = winwidth;
     520
     521      var miniWidth2 = jQuery(theMainImage_obj).Get_Val_int(MinWidth, mini_width2);
     522      var miniHeight2 = jQuery(theMainImage_obj).Get_Val_int(MinHeight, mini_height2);
     523
     524
     525      var maxWidth = jQuery(theMainImage_obj).Get_Val_int(MaxWidth, winwidth, "0");
     526      maxHeight = jQuery(theMainImage_obj).Get_Val_int(MaxHeight, winheight, "0");
     527
     528      mini_width = parseInt(miniWidth);
     529      mini_height = parseInt(miniHeight);
     530      img_reelle.width = parseInt(img_reelle.width);
     531      if (img_reelle.width < mini_width)
     532        return true;
     533      img_reelle.height = parseInt(img_reelle.height);
     534      if (img_reelle.height < parseInt(mini_height))
     535        return true;
     536      //======================================================================
     537      set_cl();
     538      Set_Pamoorama();
     539
     540
     541
     542      //=============== Zone d'affichage ============================ 
     543      Zone_Affichage.width = Zone_image.container.width;
     544      Zone_Affichage.height = Zone_image.container.height;
     545
     546      var Licence = jQuery(".licencetag");
     547      infos_Licence = jQuery(".licencetag").infos();
     548
     549      //====================================================
     550      if (options.imageAutosizeMargin > 0) Marge_Basse = options.imageAutosizeMargin;
     551      else Marge_Basse = parseInt(marge_basse || 0); // hors bandeau
     552      //==========================================================================
     553
     554
     555
     556      //=================================================
     557      if (Zone_Affichage.height < mini_height2)
     558        Zone_Affichage.height = mini_height2;
     559      if (Zone_Affichage.width < mini_width2)
     560        Zone_Affichage.width = mini_width2;
     561      //=================================================
     562
     563
     564
     565      //=============================================================
     566      var height_user = eval(user_status + "_height");
     567      var width_user = eval(user_status + "_width");
     568      var reg1 = new RegExp("%", "g");
     569      if (height_user.match(reg1))
     570        Image_height = img_reelle.height * parseInt(height_user) / 100;
     571      else
     572        Image_height = parseInt(height_user);
     573      echelle_max = parseFloat(echelle_max, '3');
     574      var echelle = parseFloat(Image_height / img_reelle.height, 3);
     575
     576      if (echelle > echelle_max) { echelle = echelle_max; }
     577
     578      Image_height = parseInt(img_reelle.height * echelle);
     579
     580      var widthmin = winwidth;
     581
     582      if (check_auto_w == 'checked="checked"') {
     583
     584        //==== largeur à atteindre ===
     585        var width_user = eval(user_status + "_width");
     586        // Largeur maximale en fonction du statut
     587        if (width_user.match(reg1))
     588        // pourcentage
     589          Image_width = widthmin * parseInt(width_user) / 100;
     590        else
     591          Image_width = parseInt(width_user);
     592
     593      }
     594      Image_height = parseInt(Image_width / rapport);
     595      Image_width = parseInt(Image_height * rapport);
     596      //====================================================
     597      //  Zone_image.image.height = Image_height;
     598      //  Zone_image.image.width = Image_width;
     599
     600      Set_Pamoorama();
     601      set_cl();
     602      jQuery(theMainImage_obj).height(Zone_image.image.height);
     603      jQuery("#theImage").width(Zone_image.container.width);
     604      jQuery("#theImage").height(Zone_image.container.height);
     605
     606      return true;
     607
     608      //===============================================================
     609      jQuery("#theImage").width(Zone_Affichage.width);
     610      jQuery("#theImage").height(Zone_Affichage.height);
     611      jQuery(theMainImage_obj).removeAttr("width");
     612      jQuery(theMainImage_obj).css({ height: Image_height }); //image
     613
     614      //================================================================
     615
     616      align_auto = "center";
     617      if (jQuery("#theImg").css("textAlign"))
     618        align_auto = jQuery("#theImg").css("textAlign");
     619
     620
     621      var marges = 0;
     622
     623      if (typeof (infos_img) != "undefined") {
     624        widthmin -= infos_img.borderwidth.left || 0;
     625        widthmin -= infos_img.borderwidth.right || 0;
     626      }
     627      widthmin -= marges;
     628      if (typeof Bandeau_t != "undefined") {
     629        widthmin -= (Bandeau_t.borderwidth.left + Bandeau_t.borderwidth.left);
     630        Image_width -= (Bandeau_t.borderwidth.left + Bandeau_t.borderwidth.left);
     631      } else {
     632
     633        jQuery.autosize.resize();
     634      }
     635      if (Image_width > widthmin) {
     636        //   Image_width largeur à atteindre
     637        //  Calcul du rapport d'agrandissement
     638        var echelle_w = parseFloat((widthmin) / img_reelle.width, 3);
     639        if (echelle_w > echelle_max) { echelle_w = echelle_max; }
     640        Image_width = parseInt(img_reelle.width * echelle_w);
     641        if (rapport > 0)
     642          Image_height = parseInt(Image_width / rapport);
     643      }
     644
     645
     646
     647
     648      //===================================================
     649
     650      img_finale.height = Image_height;
     651      img_finale.width = Image_width;
     652      if (theme.match(RegExp("stripped", "gi"))) {
     653        img_finale.width -= (llgboframe.top * 2);
     654        if (rapport > 0) img_finale.height = (img_finale.width / rapport);
     655        else img_finale.height -= (llgboframe.top * 2);
     656
     657      }
     658      zoom = echelle;
     659      if (typeof (llgboframe) != "undefined" && llgboframe.height > 0) {
     660        //=============LLGBO2 ===========================
     661        t1 = llgboframe;
     662        if (!theMainImage_obj.src) {
     663          theMainImage_obj = jQuery("#llgbo").find("img").get(0)
     664          if (!theMainImage_obj.src) {
     665            theMainImage_obj = jQuery("#theImage").find("div").get(0)
     666          }
     667        }
     668        if (theMainImage_obj.src) {
     669          wingbo = img_finale.width;
     670          heightgbo = img_finale.height;
     671          if (Type_Img == "panorama") {
     672            heightgbo = infos_theImage.height;
     673            img_finale.height = infos_theImage.height;
     674          }
     675
     676          img_finale.width -= marges_llgbo;
     677          if (jQuery("#slideshow").infos().width > 0) {
     678            img_finale.height -= (marges_llgbo * 1.5);
     679          } else {
     680            img_finale.height -= marges_llgbo
     681          }
     682
     683
     684          if (wingbo > winwidth) {
     685            jQuery("#llgbo").width(winwidth);
     686            jQuery("#llgbo").height(winheight);
     687            jQuery("#llgbo").css("width", winwidth + "px");
     688            jQuery("#llgbo").css("height", winheight + "px");
     689          }
     690          else {
     691            jQuery("#llgbo").width(wingbo);
     692            jQuery("#llgbo").height(heightgbo);
     693            jQuery("#llgbo").css("width", wingbo + "px");
     694            jQuery("#llgbo").css("height", heightgbo + "px");
     695          }
     696
     697          a0 = jQuery("area[rel!=up][rel!=prev][rel!=next]");
     698          a1 = jQuery("area[rel=prev]");
     699          a2 = jQuery("area[rel=next]");
     700          a3 = jQuery("area[rel=up]");
     701          nb_zone = 3;
     702          if (a1.length == 0) {
     703            nb_zone -= 1;
     704          }
     705          if (a2.length == 0) {
     706            nb_zone -= 1;
     707          }
     708
     709
     710          var Largeur_zone = (img_finale.width / nb_zone);
     711          var Hauteur_zone = (img_finale.height);
     712          var init_zone = 0;
     713
     714          if (a1.length > 0) {
     715            coord = { x0: init_zone, y0: 0, x1: Largeur_zone, y1: Hauteur_zone };
     716
     717            jQuery("area[rel=prev]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
     718            init_zone += Largeur_zone;
     719          }
     720
     721          coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
     722
     723          if (a0.length > 0) {
     724            jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1 / 2) + "'" });
     725            jQuery(a0).attr({ coords: "'" + coord.x0 + "," + (coord.y1 / 2) + "," + coord.x1 + "," + (coord.y1) + "'" });
     726          } else {
     727            jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1) + "'" });
     728          }
     729          init_zone += Largeur_zone;
     730
     731          if (a2.length > 0) {
     732            coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
     733            jQuery("area[rel=next]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
     734          }
     735          //    jQuery("#theImage").height(heightgbo + marges_llgbo / 2);
     736        }
     737      }
     738
     739      //================ Zone affichage =========================
     740
     741      //  jQuery("#theImage").css("top", "0px");
     742      jQuery("#standard").css("top", 0 + "px");
     743      jQuery("#comments").css("top", 0 + "px");
     744      //========== Image Remise à l'échelle =======================
     745
     746      img_finale.height = parseInt(img_finale.height);
     747      img_finale.width = parseInt(img_finale.width);
     748      //=========================================================================
     749      //=== cadre = theImage
     750      if (theme.match(RegExp("simple", "gi"))) {
     751        jQuery("#theImage").width(Zone_Affichage.width); //centrer simple black
     752        jQuery("#theImage").css({ width: Zone_Affichage.width + "px",
     753          marginLeft: "auto"
     754        });
     755
     756      } else if (theme.match(RegExp("sobre", "gi")) || theme.match(RegExp("hr_", "gi")) || theme.match(RegExp("Mont", "gi"))) {
     757        jQuery("#theImage").css({ width: "auto", marginLeft: "auto" });
     758      } else if (theme.match(RegExp("saruka", "gi"))) {
     759
     760        jQuery("#theImage").css({ width: Zone_Affichage.width + "px" });
     761      } else if (theme.match(RegExp("elegant", "gi"))) {
     762
     763        // jQuery("#theImage").css("width", "auto");
     764        jQuery("#theImage").css({ height: Zone_Affichage.height + "px", width: "auto" }); //conteneur
     765
     766      } else {
     767        jQuery("#theImage").css("width", "auto");
     768
     769      }
     770      // ;
     771
     772      if (Type_Img == "panorama" || Type_Img == "pamoorama") {
     773        img_finale.height = infos_theImage.height;
     774        Zone_Affichage.height = img_finale.height;
     775
     776      }
     777
     778      if (typeof (gmaps) != "undefined") {
     779        Gmap_ = gmaps.maps[0];
     780        if (Gmap_.sizeMode == 'A') {
     781          jQuery("#iGMapsIcon").css({ width: old_window.width * 0.8 + "px", height: old_window.height * 0.8 + "px" });
     782
     783        }
     784      }
     785      //============= flv,mov,mpg  ok
     786      /* wmv nok
     787      * avi nok
     788      //===========================================
     789      */
     790      if (Type_Img == "charlie") {
     791        t1 = jQuery("#charlie").infos();
     792
     793        /**/
     794
     795        pdf = 0;
     796        jQuery("#charlie div").each(function (i) {
     797
     798
     799          p1 = jQuery(this).infos();
     800          pdf += p1.padding.right + p1.padding.left;
     801        });
     802        img_finale.width -= pdf;
     803
     804        jQuery("#charlie").css({
     805          width: img_finale.width + pdf + "px",
     806          height: img_finale.height + "px",
     807          marginLeft: "auto"
     808        });
     809
     810
     811        if (MainImage.length > 0) {
     812          img_finale.height = parseInt(img_finale.width / rapport);
     813          img_finale.height -= 30;
     814          img_finale.width = rapport * img_finale.height;
     815
     816
     817          MainImage.width(img_finale.width);
     818          MainImage.height(img_finale.height);
     819          jQuery("#embedplayer").width(300);
     820          jQuery("#embedplayer").height(15);
     821        } else {
     822          jQuery("#player").css("width", img_finale.width + "px");
     823          jQuery("#player").css("height", img_finale.height + "px");
     824
     825          jQuery("#embedplayer").css("width", img_finale.width + "px");
     826          jQuery("#embedplayer").css("height", img_finale.height + "px");
     827
     828          jQuery("embed").css({ width: img_finale.width + "px",
     829            height: img_finale.height + "px"
     830          });
     831          jQuery("object").css({ width: img_finale.width + "px",
     832            height: img_finale.height + "px"
     833          });
     834          jQuery("video").css({ width: img_finale.width + "px",
     835            height: img_finale.height + "px"
     836          });
     837
     838
     839
     840          jQuery("video").height(img_finale.height);
     841          jQuery("video").width(img_finale.width);
     842
     843          jQuery("object").width(img_finale.width);
     844          jQuery("object").height(img_finale.height);
     845          //jQuery("#theImage").height(img_finale.height + Bandeau_bas.height); //??             
     846
     847          jQuery(theMainImage_obj).height(img_finale.height);
     848          jQuery("#theImage").css("height", "auto");
     849        }
     850
     851
     852      } else if (Type_Img == "embed") {
     853
     854        if (MainImage.length > 0) {
     855          img_finale.height = parseInt(img_finale.width / rapport);
     856          img_finale.height -= 30;
     857          img_finale.width = rapport * img_finale.height;
     858
     859
     860          MainImage.width(img_finale.width);
     861          MainImage.height(img_finale.height);
     862          jQuery("#embedplayer").width(300);
     863          jQuery("#embedplayer").height(15);
     864        } else {
     865          jQuery("#theImage").css("height", "auto");
     866          jQuery("embed").css("height", img_finale.height);
     867          jQuery("object").css({ height: img_finale.height + "px" });
     868
     869          jQuery("object").width(img_finale.width);
     870          jQuery("object").height(img_finale.height);
     871        }
     872
     873      } else if (Type_Img == "panorama") {
     874        if (typeof asp_options != "undefined")
     875          n = asp_options;
     876        n1 = jQuery("#Panorama div").width();
     877        jQuery(".panorama-viewport").css("margin", "auto");
     878        n = infos_imageToolBar;
     879
     880
     881      } else if (Type_Img == "pamoorama") {
     882        Set_Pamoorama();
     883
     884
     885
     886
     887      } else if (theMainImage_obj != null && theMainImage_obj.src) {
     888        //--- background ?? ---
     889        jQuery(theMainImage_obj).height(img_finale.height);
     890        jQuery(theMainImage_obj).width(img_finale.width);
     891        jQuery(theMainImage_obj).css({ height: img_finale.height + "px ",
     892          width: img_finale.width + "px "
     893        });
     894
     895
     896      } else {
     897        //===map ? luciano ===
     898        //   jQuery(theMainImage_obj).css({ height: img_finale.height + "px ",  width: img_finale.width + "px });
     899        //   jQuery(theMainImage_obj).height(img_finale.height );
     900        //   jQuery(theMainImage_obj).width(img_finale.width );
     901        //   jQuery(theMainImage_obj).attr({ width: img_finale.width  });
     902        h = img_finale.height;
     903        h = Zone_Affichage.height - Zone_Affichage.borderwidth.top - Zone_Affichage.borderwidth.bottom;
     904        h -= (infos_theImage.borderwidth.bottom + infos_theImage.borderwidth.top);
     905
     906        jQuery(theMainImage_obj).attr({ height: h - 3 }); //image
     907        if (theme.match(RegExp("elegant", "gi"))) {
     908          return true;
     909
     910        }
     911        if (theme.match(RegExp("luciano", "g"))) {
     912          imgl = 180;
     913          l = Zone_Affichage.left;
     914
     915          jQuery(".imageNumber").css({ left: l + "px"
     916
     917          });
     918          jQuery("#theImage" + " #theImg IMG").css({ height: img_finale.height + "px ",
     919            width: (img_finale.width - imgl) + "px ", marginTop: "0px"
     920          })
     921        }
     922
     923      }
     924
     925      var theImg = document.getElementById("theMainImage");
     926      if (theImg) {
     927        theImg.removeAttribute("width");
     928        theImg.removeAttribute("height");
     929        jQuery(theMainImage_obj).css("width", img_finale.width + "px");
     930      }
     931
     932      jQuery("#navThumbPrev").css({ overflow: "hidden" });
     933      jQuery("#navThumbNext").css({ overflow: "hidden" });
     934      n = typeof inittoolbar;
     935      if (Type_Img == "map") {
     936        jQuery("#navThumbNext").css({ display: 'none' });
     937        jQuery("#navThumbPrev").css({ display: 'none' });
     938        jQuery("#theImage").css({ marginTop: infos_imageToolBar.height + "px", marginLeft: "0px",
     939          width: winwidth + "px",
     940          height: winheight + "px"
     941        });
     942        //mapPicture
     943      }
     944      try {
     945        if (theme.match(RegExp("gally", "gi"))) {
     946          if (typeof inittoolbar == "function") {
     947            if (typeof (currentTab) == "undefined") inittoolbar();
     948            else initializeImageMode("resize");
     949          } else {
     950            tp = gallyPP.getImageProp();
     951            if (typeof (GallyPP) == "function")
     952              gallyPP = new GallyPP();
     953
     954            iph = jQuery("#imageHeaderBar").infos();
     955            jQuery("#imageToolBar").css({ top: iph.bottom + "px", position: "absolute" });
     956            jQuery("#theImage").width(winwidth);
     957          }
     958          //===========================================================================
     959          if (jQuery("#navThumbPrev").length > 0) {
     960            jQuery("#navThumbPrevContainer").css({ left: "0px"
     961            });
     962          }
     963          if (jQuery("#navThumbNext").length > 0) {
     964            jQuery("#navThumbNextContainer").css({ left: "0px"
     965            });
     966          }
     967          //=============================================================================
     968          if (!theme.match(RegExp("lapis", "gi"))) {
     969            if (typeof initializeImageMode == "function") {
     970              initializeImageMode("resize");
     971            }
     972
     973          }
     974
     975        } else if (theme.match(RegExp("simple", "g"))) {
     976
     977          jQuery("#imageToolBar").css({ position: "static" });
     978
     979          infos_imageInfoBar = jQuery("#imageInfoBar").infos();
     980          if (infos_imageInfoBar.bottom < infos_img.bottom) {
     981            //   jQuery("#imageInfoBar").height(infos_img.bottom);
     982          }
     983
     984        } else {
     985
     986          //    jQuery("#imageToolBar").css("position", "static");
     987        }
     988      } catch (e) {
     989
     990      }
     991      zoom = img_finale.height / img_height;
     992      h0 = jQuery("#content").height();
     993      if (h0 == null) {
     994        h0 = winheight - Zone_Affichage.top;
     995      }
     996      h1 = (h0 - img_finale.height) / 2;
     997      //  jQuery("#theImage").css({ marginTop: h1 + "px" });
     998
     999      zoom = parseInt(zoom * 100);
     1000      jQuery('#zoom ').val(zoom);
     1001      set_cl();
     1002
     1003
     1004      //  --- réglage de la hauteur de page en fonction du copyright-----------
     1005      if (typeof (pos_copyright) == "undefined") pos_copyright = jQuery("#copyright").infos();
     1006
     1007      if (theme.match(RegExp("stripped", "gi"))) {
     1008        var TitleBox = jQuery("#imageTitleContainer");
     1009        if (TitleBox.length != 0) TitleBox.css("width", img_finale.width + "px");
     1010      } else {
     1011
     1012      }
     1013
     1014
     1015      /*
     1016      if (!theme.match(RegExp("luciano", "gi"))) {
     1017      jQuery("#linkNext").css({ height: "80px", width: "200px", overflow: "hidden" });
     1018      jQuery("#linkPrev").css({ height: "80px", width: "200px", overflow: "hidden" });
     1019      jQuery(".navThumb img").css({ height: "80px", width: "", overflow: "hidden" });
     1020      }
     1021      */
     1022      infos_frame = jQuery("#theImage").infos();
     1023      if (theme.match(RegExp("stripped", "gi"))) {
     1024        /*
     1025        infos_theImageBox = jQuery("#theImageAndTitle").infos();
     1026        p1 = jQuery(".randomButtons").infos();
     1027        p2 = jQuery("#imageHeaderBar").infos();
     1028        p3 = infos_content.top;
     1029        p1 = options.imageAutosizeTitle;
     1030
     1031        jQuery("#theImage").width("width", infos_theImageBox.width + "px");
     1032        //jQuery("#theImageAndTitle").css("position", "relative");
     1033        jQuery("#content").css({ position: "relative", top: "10px", marginTop: "0px",
     1034        paddingTop: "0px", textAalign: "center", marginLeft: "auto"
     1035        });
     1036
     1037        jQuery("#theImageAndTitle").css({ position: "relative", top: "0px", marginTop: "0px",
     1038        paddingTop: "0px", marginLeft: "auto"
     1039        }); */
     1040        t1 = infos_theImageBox.top;
     1041        l1 = infos_theImageBox.left;
     1042        // infos_theImageBox = jQuery("#theImage").infos();
     1043
     1044      } else {
     1045
     1046        t1 = infos_frame.top;
     1047        l1 = infos_frame.left;
     1048        infos_theImageBox = jQuery("#theImage").infos(); //theImage
     1049      }
     1050      infos_theImageBox.margin.margin = infos_frame.margin.margin;
     1051      infos_theImageBox.top = t1;
     1052      infos_theImageBox.left = l1;
     1053      //  infos_theImageBox.position = "absolute";
     1054
     1055      Window_Affichage = infos_theImageBox;
     1056      if (DEBUG_autosize == "_true") {
     1057        //   jQuery("#theImage").css("border", "solid green");
     1058
     1059        jQuery("#Debug5").css({ background: "red",
     1060          position: "absolute",
     1061          border: "green solid 2px",
     1062          textAlign: align_auto,
     1063          margin: "auto",
     1064          top: Window_Affichage.top + "px",
     1065          left: Window_Affichage.left + "px",
     1066          width: Window_Affichage.width + "px",
     1067          height: Window_Affichage.height + "px"
     1068        }); //red
     1069        jQuery("#Debug4").css({ top: infos_frame.bottom - infos_description.height + "px" }); //green
     1070      }
     1071
     1072      //Wait_Affichage();
     1073
     1074      return true;
     1075      //_____________________________________________________   
     1076    }; // Autosize
     1077
     1078
     1079
     1080    /********************************************
     1081    *  window unLOAD
     1082    ********************************************/
     1083    jQuery(window).unload(function () {
     1084      try {
     1085        if (typeof theMainImage_obj != "undefined") {
     1086          var theImg = document.getElementById("theMainImage");
     1087          jQuery.cl_cookie('img', theImg.src, cookie_path); // créer un cookie avec une valeur
     1088          theImg.useMap = theImg.useMap || "autosize";
     1089
     1090          jQuery.cl_cookie('picture_map', theImg.useMap, { path: cookie_path });
     1091          jQuery.cl_cookie('img_h', jQuery(theMainImage_obj).height(), { path: cookie_path });
     1092          jQuery.cl_cookie('img_w', jQuery(theMainImage_obj).width(), { path: cookie_path });
     1093
     1094          if (typeof Window_Affichage != "undefined") {
     1095            jQuery.cl_cookie('window_height', Window_Affichage.height, { path: cookie_path });
     1096            jQuery.cl_cookie('window_width', Window_Affichage.width, { path: cookie_path });
     1097          }
     1098        }
     1099      } catch (r) {
     1100
     1101      }
     1102
     1103    }); //unload
     1104
     1105    /********************************************
     1106    *  window LOAD
     1107    ********************************************/
     1108    jQuery(window).load(function () {
     1109      href = location.href;
     1110      var aff_ok = false;
     1111
     1112      DEBUG_autosize = (typeof DEBUG_autosize != "undefined") ? DEBUG_autosize : "false";
     1113      if (DEBUG_autosize == "true") {
     1114        for (var i = 0; i < 10; i++) {
     1115          jQuery('#adddebugs').click();
     1116        }
     1117        jQuery(jQuery('.debug').get(i - 1)).click();
     1118      }
     1119
     1120      /*
     1121      jQuery.post(href, function (data) {
     1122      nu_img--;
     1123      if (nu_img < 0) nu_img = 9;
     1124      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
     1125      //alert("Data Loaded: " + data);
     1126      Wait_Affichage();
     1127      });
     1128      */
     1129      // jQuery(':Set_Class');
     1130      if (typeof img_width == "undefined") {
     1131        if (List_autosize.length == 0) return;
     1132        wait_resize = false;
     1133        if (List_autosize_resize()) Wait_Affichage();
     1134        return true;
     1135      }
     1136      //=========================================================         
     1137
     1138
     1139
     1140
     1141      //============================================================
     1142      Autosize_init();
     1143      Bandeau_bas = infos_Description_f("#theImage");
     1144      if (typeof Bandeau_bas != "undefined") Bandeau = Bandeau_bas.top;
     1145      else Bandeau = 0;
     1146
     1147      theMainImage_obj = theMainImage_obj;
     1148      Wait_Affichage();
     1149      Autosize_resize(true, { id_map: "autosize" });
     1150
     1151
     1152    }); // window.onload
     1153    /***********************************************************
     1154    *  RESIZE
     1155    ***********************************************************/
     1156    jQuery(window).resize(
     1157                       function (event, ui) {
     1158                         List_autosize_resize(event, ui);
     1159                         if (Autosize_resize(true))
     1160                           if (Autosize_resize(true));
     1161                         Wait_Affichage();
     1162                       });
     1163
     1164    /************************************
     1165    * Extend
     1166    ************************************/
     1167    jQuery.fn.extend({
     1168      //==========================================================
     1169      infos_description: function (e) {
     1170        return infos_Description_f(e);
     1171      },
     1172      //=============================================================
     1173      on: function (e) {
     1174        return;
     1175      },
     1176      /*
     1177      * recherche la plus grande image (hauteur ou largeur)
     1178      */
     1179      Get_Img_Maxi: function (myobj) {
     1180        return Get_Img_Maxi(myobj);
     1181      },
     1182      //============================================================
     1183      affiche_debug: function (aff_infos) {
     1184        affiche_debug(aff_infos);
     1185      }
     1186
     1187
     1188    }); //  fin extend 
     1189    //=================================================================================
     1190 
     1191      /*****************
     1192      * changeImgSrc1
     1193      ******************/
     1194      changeImgSrc = function (url, typeSave, typeMap) {
     1195        var theImg = document.getElementById("theMainImage");
     1196        if (theImg) {
     1197          theImg.removeAttribute("width");
     1198          theImg.removeAttribute("height");
     1199          //  theImg.useMap = "#map" + typeMap;
     1200          if (typeMap == "Autosize") {
     1201            theImg.useMap = "#" + typeMap;
     1202          } else {
     1203            theImg.useMap = "#map" + typeSave;
     1204          }
     1205          jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
     1206          jQuery('#derivativeChecked' + typeMap).css('visibility', 'visible');
     1207
     1208          document.cookie = 'picture_deriv=' + typeSave + ';path="' + cookie_path + '" ';
     1209          jQuery.cl_cookie('picture_deriv', typeSave, { path: cookie_path });
     1210          jQuery.cl_cookie('picture_map', typeMap, { path: cookie_path });
     1211          theImg.src = url; // charge Image
     1212
     1213        }
     1214      }          //changeImgSrc1
     1215
     1216    Wait_pamoorama = function () {
     1217      if (jQuery("#pamoorama").length) {
    481218        mypanorama = window.myPamoorama;
    491219        if (!mypanorama) {
    501220          tempo = tempo + 1;
    51           if (tempo > 10)
    52           return true;
    53 
    54             setTimeout("Wait_pamoorama()", 500);
    55             return false;
     1221          if (tempo > 10)
     1222            return true;
     1223          setTimeout("Wait_pamoorama()", 500);
     1224          return false;
    561225        }
    571226        if (mypanorama.skipInit == false) {
    58             setTimeout("Wait_pamoorama()", 500);
    59             return false;
    60         }
     1227          setTimeout("Wait_pamoorama()", 500);
     1228          return false;
     1229        }
     1230        //=============================================================
    611231        infos_pamoorama = jQuery("#pamoorama").infos();
    621232        new_width = infos_pamoorama.width - (infos_pamoorama.borderwidth.left + infos_pamoorama.borderwidth.right);
    63         if (Math.abs(new_width - myPamoorama.options.width) > 10) {
    64             setTimeout("Wait_pamoorama()", 500);
    65             return false;
    66         }
    67 
     1233        Zone_image = Calcul_Image(false);
     1234        Set_Pamoorama();
     1235        if (Math.abs(infos_pamoorama.height) < 50) {
     1236          setTimeout("Wait_pamoorama()", 500);
     1237          return false;
     1238        }
    681239        nopano = true;
    69         old_window = { width: 0, height: 0 };
    70         jQuery('#pamoorama').trigger('ON');
    71 
    72     }
    73 }
    74 
    75 
    76 //==========================================================================
    77 function Wait_Affichage() {
    78  
    79   if (typeof fade_in == "undefined") fade_in = 1000;
    80     fade_in = parseInt(fade_in);
    81     /*
    82     if (!jQuery().newResize()) {
    83         setTimeout("Wait_Affichage()", 500);
    84         return
    85     }
    86  
    87     nu_img++;
    88    
    89     */
    90   if (typeof fade_in == "undefined") fade_in = 0;
    91     if (fade_in == 0) {
    92         jQuery(Parent).css({ opacity: "1" });
    93 
    94       jQuery("#theImg").css({ opacity: "1" });
    95       jQuery("#imageTitleContainer").css({ opacity: "1" });
    96       jQuery("#theImageAndTitle").css({ opacity: "1" });
    97 
    98      
    99 
    100 
    101     } else {
    102     jQuery(Parent).animate({ opacity: "1" },
    103                                          fade_in, "swing",
    104                                          function (i) {
    105                                            jQuery(Parent).css({ opacity: "1" });
    106                                            jQuery("#theImg").css({ opacity: "1" });
    107                                            jQuery("#imageTitleContainer").css({ opacity: "1" });
    108                                            jQuery("#theImageAndTitle").css({ opacity: "1" });
    109 
    110                                        if (DEBUG_autosize == "true") {
    111 
    112                                          nu_img--;
    113                                          if (nu_img < 1) nu_img = 1;
    114 
    115                                          bp1 = jQuery('.debug').get(nu_img);
    116                                          jQuery(bp1).trigger('ON');
    117                                        }
    118                                          }
    119                                        );
    120 
    121                                        }
    122 
    123 
    124     //   if (nu_img > 1) return;
    125   if(typeof stb!="undefined")
    126     stb.stop().fadeTo(3500, 0);
    127 
    128  jQuery("#theImage").trigger('ON');
    129 
    130   if (typeof The_MainImage == "undefined") return true;
    131   if (The_MainImage == null) return;
    132   if (jQuery(The_MainImage).length > 0) {
    133     if (typeof img_h == "undefined") {
    134     img_h = jQuery(The_MainImage).height();
    135     img_w = jQuery(The_MainImage).width();
    136       }
    137     jQuery("#src_img_h").val(img_h);
    138     jQuery("#src_img_w").val(img_w);
    139     jQuery("#ret_autosize").val(src_img);
    140     if (typeof Window_Affichage =="undefined" ) {
    141         Window_Affichage = { height: Zone_Affichage.height,
     1240        theMainImage_obj = "#pamoorama";
     1241      }
     1242    } // Wait_pamoorama
     1243    //====================================================================================
     1244    Wait_Affichage = function () {
     1245      if (typeof fade_in == "undefined") fade_in = 1000;
     1246      fade_in = parseInt(fade_in);
     1247      /*
     1248      if (!Autosize_resize()) {
     1249      setTimeout("Wait_Affichage()", 500);
     1250      return
     1251      } 
     1252      nu_img++;     
     1253      */
     1254      if (typeof fade_in == "undefined") fade_in = 0;
     1255      if (fade_in == 0) {
     1256        jQuery("#theImage").css({ opacity: "1" });
     1257        jQuery("#theImg").css({ opacity: "1" });
     1258        jQuery("#imageTitleContainer").css({ opacity: "1" });
     1259        jQuery("#theImageAndTitle").css({ opacity: "1" });
     1260      } else {
     1261        jQuery("#theImage").animate({ opacity: "1" },
     1262                                                 fade_in, "swing",
     1263                                                 function (i) {
     1264                                                   jQuery("#theImage").css({ opacity: "1" });
     1265                                                   jQuery("#theImg").css({ opacity: "1" });
     1266                                                   jQuery("#imageTitleContainer").css({ opacity: "1" });
     1267                                                   jQuery("#theImageAndTitle").css({ opacity: "1" });
     1268
     1269                                                   if (DEBUG_autosize == "true") {
     1270
     1271                                                     nu_img--;
     1272                                                     if (nu_img < 1) nu_img = 1;
     1273
     1274                                                     bp1 = jQuery('.debug').get(nu_img);
     1275                                                     jQuery(bp1).trigger('ON');
     1276                                                   }
     1277                                                 }
     1278                                               );
     1279
     1280      }
     1281      //   if (nu_img > 1) return;
     1282      if (typeof stb != "undefined")
     1283        stb.stop().fadeTo(3500, 0);
     1284      if (typeof theMainImage_obj == "undefined") return true;
     1285
     1286      if (theMainImage_obj.selector) {
     1287        theMainImage_obj = theMainImage_obj.selector;
     1288      }
     1289      // jQuery("#theImage").trigger("ON");
     1290      theImage_init("#theImage");
     1291
     1292      if (theMainImage_obj == null) return;
     1293      if (jQuery(theMainImage_obj).length > 0) {
     1294        if (typeof img_h == "undefined") {
     1295          img_h = jQuery(theMainImage_obj).height();
     1296          img_w = jQuery(theMainImage_obj).width();
     1297        }
     1298        jQuery("#src_img_h").val(img_h);
     1299        jQuery("#src_img_w").val(img_w);
     1300        jQuery("#ret_autosize").val(src_img);
     1301        if (typeof Window_Affichage == "undefined") {
     1302          Window_Affichage = { height: Zone_Affichage.height,
    1421303            width: Zone_Affichage.width
    143         };
    144     }
    145     jQuery("#window_height").val(Window_Affichage.height);
    146     jQuery("#window_width").val(Window_Affichage.width);
    147 
    148     jQuery("#ret_autosize").trigger('ON', {
    149         width: img_w,
    150         height: img_h,
    151         theImage: The_MainImage,
    152         src_img: src_img,
    153         window_height: Window_Affichage.height,
    154         window_width: Window_Affichage.width
    155     });
    156   }
    157  
    158 }
    159 
    160 //=======================================================================
    161 function Calcul_Image(all_width) {
    162   // theImageAndInfos(jaune) -> theImage(vert) -> [llgbo] -> theMainImage
    163   // + infos_imageInfos(red)
    164   infos_theImage = jQuery("#theImage").infos();
    165 
    166   infos_the_page = jQuery("#the_page").infos();
    167           infos_imageToolBar = jQuery("#imageToolBar").infos();
    168           infos_imageInfos = jQuery("#imageInfos").infos();
    169           //  infos_llgbo = jQuery("#llgbo").infos();
    170  
    171           infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
    172 
    173           pos_left = infos_theImage.left;
    174           x = infos_body.left;
    175           imageInfos_width = jQuery("#imageInfos").css("width");
    176           infos_body = jQuery("body").infos();
    177 
    178            retrait_w = infos_theImage.margin.left
    179                         + infos_theImage.margin.right
    180                         + infos_theImage.borderwidth.left
    181                         + infos_theImage.borderwidth.right
    182                         + infos_theImage.padding.left
    183                         + infos_theImage.padding.right;
    184 
    185            retrait_w += infos_the_page.margin.left
    186                         + infos_the_page.margin.right
    187                         + infos_the_page.borderwidth.left
    188                         + infos_the_page.borderwidth.right
    189                         + infos_the_page.padding.left
    190                         + infos_the_page.padding.right;
    191 
    192            retrait_w += infos_body.margin.left +
    193                         infos_body.margin.right;
    194 
    195            retrait_h = infos_theImage.margin.top
    196                         + infos_theImage.margin.bottom
    197                         + infos_theImage.borderwidth.top
    198                         + infos_theImage.borderwidth.bottom
    199                         + infos_theImage.padding.top
    200                         + infos_theImage.padding.bottom;
    201 
    202            t0 = infos_imageToolBar.bottom + infos_imageToolBar.margin.top + infos_imageToolBar.margin.bottom;
    203            if ((t0 > 0) && (infos_theImageAndInfos.top == 0))
    204              retrait_h += t0;
    205 
    206            else
    207              retrait_h += infos_theImageAndInfos.top;  // top+height
    208 
    209             jQuery("#theMainImage").css({margin:"auto"       
    210             });
    211 
    212            retrait_img = infos_theMainImage.borderwidth.left
    213             + infos_theMainImage.borderwidth.right
    214             + infos_theMainImage.padding.left
    215             + infos_theMainImage.padding.right;
    216            retrait_img += infos_llgbo.borderwidth.right + infos_llgbo.borderwidth.right;
    217 
    218         if (theme.match(RegExp("elegant", "gi")) ) {
    219           if (all_width != true) {
    220             new_width = 8  +
    221                         infos_imageInfos.width +
    222                         infos_imageInfos.borderwidth.left +
    223                         infos_imageInfos.borderwidth.right +
    224                         infos_imageInfos.margin.left +
    225                         infos_imageInfos.borderwidth.right +
    226                         infos_imageInfos.padding.left +
    227                         infos_imageInfos.padding.right;                   
    228               }else{
    229                   new_width=0 ;
    230               }
    231                 width_theImage= (jQuery(window).width() - new_width)
    232              
    233         }else if (theme.match(RegExp("stripped", "gi")) ) {
    234                 width_theImage = (jQuery(window).width() );
    235         }else{
    236                 width_theImage = (jQuery(window).width() );
    237           }
    238 
    239 
    240               b = 2;
    241 
    242               n = Bandeau_t;
    243               if (infos_llgbo.top > 0) {
    244                 if ((infos_llgbo.top - retrait_h)>0 ) {
    245                   b = infos_llgbo.top - retrait_h;
    246                 } else {
    247                 b = infos_llgbo.top;
    248                 }
    249               }
    250               retrait_h += (b * 2)
    251           height_theImage = jQuery(window).height() - retrait_h  ; 
    252           width_theImage -= retrait_w ;
    253           //===============================================================
    254           width_theMainImage = width_theImage - retrait_img;
    255           height_theMainImage = parseInt(width_theMainImage / rapport) - (retrait_img );
    256           //===============================================================
    257           // test débordement
    258           if ((height_theMainImage  ) > height_theImage -(retrait_img + (b*2))) {           
    259             height_theMainImage = height_theImage - (retrait_img );
    260             width_theMainImage = parseInt(height_theMainImage * rapport);
    261           } else {
    262             width_theMainImage = width_theImage - (retrait_img);
    263             height_theMainImage = parseInt(width_theMainImage / rapport);
    264           }
    265           height_theImage += (b * 2);
    266 
    267         Zone_image = {
    268           image: {  width: width_theMainImage    ,
    269                     height: height_theMainImage
    270                     },
    271                   container: {
    272                     width: width_theImage  ,
    273                     height: height_theImage 
    274                               }
    275                 };
    276  
    277            Zone_image.marge = { width: retrait_w, height: retrait_h };
    278            //============ a corriger en fonction window ====
    279        
    280              return Zone_image;
    281   }
    282 
    283 //=====================================================================
    284 function Autosize_resize(Obj) {
    285     conf = jQuery(Obj).get(0).conf;
    286     Obj = jQuery(Obj).get(0).obj;
    287     myWindow = jQuery("#" + conf.parent).infos();
    288     if (myWindow.width == 0) myWindow = jQuery(window).infos();
    289     marge_basse = 0;
    290     if (conf.MargeBasse)
    291         marge_basse = jQuery().Get_Val_int (conf.MargeBasse );
    292     marge_top = 0;
    293     if (conf.MargeHaute)
    294         marge_top = jQuery().Get_Val_int(conf.MargeHaute);
    295     infos_Obj = jQuery(Obj).infos();
    296     h1_left = jQuery(Obj).absoluteLeft();
    297     h1_top = jQuery(Obj).absoluteTop();
    298 
    299     if (h1_top < infos_Obj.height)
    300         h1 = (myWindow.height - h1_top - marge_basse - marge_top);
    301     else
    302         h1 = (myWindow.height - marge_basse);
    303     rap = infos_Obj.height / infos_Obj.width;
    304     w2 = parseInt(h1 / rap);
    305     if (w2 < infos_Obj.width)
    306         marginLeft = infos_Obj.left + parseInt((infos_Obj.width - w2) / 2) + "px";
    307     else
    308         marginLeft = "auto";
    309     jQuery(Obj).css({ width: "auto", marginTop: marge_top,
    310         marginLeft: "auto", marginBottom: 0 + "px",
    311         verticalAlign: "middle", textAlign: "center"
    312     });
    313     jQuery(Obj).height(h1);
    314     //=============================================================
    315   if (conf.ResizePicture == "true")
    316     imgs = jQuery(Obj).find("img");
    317   else
    318     imgs = jQuery(Obj).find("img");
    319   Parent = Obj;
    320 
    321     Obj_w = jQuery(Obj).width();
    322     Obj_h = jQuery(Obj).height();
    323   if (imgs.length>0) {
    324     jQuery(imgs).each(function (i) {
    325         img = jQuery(this);
    326       h1_top = jQuery(img).absoluteTop() - h1_top;
    327       h1_bottom =  Obj_h  - h1_top;
    328       infos_img = { width: conf.width[i], height: conf.height[i] }; //origine
    329         img_rap = conf.rap[i];
    330         if (infos_img.width > Obj_w) h1 = parseInt(Obj_w / img_rap);
    331       h1 -= h1_top;
    332       if (h1 > Obj_h - h1_top) {
    333         h1 = Obj_h-h1_top;       
    334       }
    335       w2 = parseInt(h1 * img_rap);
    336         if (w2 > 0 && h1 > 0 && img.length > 0) {
    337             img.height(h1);
    338             img.width(w2);
    339         }
    340     });
    341   }else{
    342   imgs = jQuery(Obj).children();
    343   jQuery(imgs).each(function (i) { 
    344     if (this.height > 0) {
    345       h1_top = jQuery(this).absoluteTop() - h1_top;
    346       h1_bottom = Obj_h - h1_top;
    347       infos_img = { width: conf.width[i], height: conf.height[i] }; //origine
    348       img_rap = conf.rap[i];
    349       if (infos_img.width > Obj_w) h1 = parseInt(Obj_w / img_rap);
    350       h1 -= h1_top;
    351       if (h1 > Obj_h - h1_top) {
    352         h1 = Obj_h - h1_top;
    353       }
    354       w2 = parseInt(h1 * img_rap);
    355       if (w2 > Obj_w ) {
    356         w2 = Obj_w;
    357       }
    358 
    359       if (w2 > 0 && h1 > 0 ) {
    360         this.height=(h1);
    361         this.width=(w2);
    362       }
    363 
    364     }
    365     name = this.name;
    366     });
    367 
    368 
    369 
    370   }
    371 
    372 }
    373     //===============================================
    374 // Extend expression
    375     //===============================================
    376 jQuery.extend(jQuery.expr[':'], {
    377   // Nom du sélecteur personnalisé
    378   Autosize: function (a) {
    379     nd = a.nodeName;
    380     n1 = a.className;
    381     // personal_block
    382     if (n1.match(RegExp("autosize", "gi"))) {
    383       //   autosize = "MargeBasse:30px; ResizePicture:false"
    384       infconf = jQuery(a).attr("autosize");
    385       n1 = typeof infconf;
    386       conf = { MargeBasse: 0, NoPicture: false }
    387       if (n1 == "undefined") {
    388 
    389       } else {
    390         tableau = infconf.split(";");
    391         for (var i = 0; i < tableau.length; i++) {
    392           tableau2 = tableau[i].split(":");
    393           conf[jQuery.trim(tableau2[0])] = jQuery.trim(tableau2[1]);
    394         }
    395         imgs = jQuery(a).find("img");
    396         rap = new Array();
    397         width = new Array();
    398         height = new Array();
    399         if (imgs.length > 0)
    400           jQuery(imgs).each(function (i) {
    401             img = jQuery(this);
    402             rap.push((img.width() / img.height()));
    403             width.push(img.width());
    404             height.push(img.height());
    405           });
    406         else {
    407           imgs = jQuery(a).children();
    408           jQuery(imgs).each(function (i) {
    409             if (this.height > 0) {
    410               rap.push(this.width / this.height);
    411               width.push(this.width);
    412               height.push(this.height);
    413             }
    414             name = this.name;
    415 
    416 
    417           });
    418         }
    419 
    420         conf['rap'] = rap;
    421         conf['width'] = width;
    422         conf['height'] = height;
    423 
    424         List_autosize.push({ obj: a, conf: conf });
    425         jQuery(a).css({ opacity: 0 });
    426       }
    427     }
    428     //  Css = jQuery(a).getStyles(a);
    429     return false;
    430 
    431   },
    432   Set_Class: function (a) {
    433     nd = a.nodeName;
    434     if (nd == "DIV") {
    435       XBrowserAddHandler(a, 'onpropertychange', onPropertyChange);
    436       //jQuery(a).find("img:nth-child(1)").css("border","Solid 5px green");
    437       img = jQuery(a).children("img");
    438       if (img.length == 0) img = jQuery(a).find("a").children("img");
    439       if (img.length > 0)
    440         if (img.length == 1) {
    441           if (img[0].src.match(RegExp(".png", "g")))
    442             return;
    443           // img[0].attachEvent('onpropertychange', onPropertyChange);
    444           XBrowserAddHandler(img[0], 'onpropertychange', onPropertyChange);
    445           jQuery(img).addClass("Image");
    446           //jQuery(img).attr("autosize", "MargeBasse:0px; ResizePicture:true");
    447         }
    448     }
    449   }
    450 });
    451 function XBrowserAddHandler(target,eventName,handlerName){
    452       if ( target.addEventListener )
    453           target.addEventListener(eventName, handlerName, false);
    454       else if ( target.attachEvent )
    455           target.attachEvent("on" + eventName, handlerName);
    456        else
    457           target["on" + eventName] = handlerName;
    458  }
    459 /*
    460  var y = 3;
    461  var txtTestBox = document.getElementById('testBox');
    462  XBrowserAddHandler(txtTestBox, 'keyup', function() {
    463   myFunctionRef(y)
    464   });
    465  var myFunctionRef = function myFunction(x, e) {
    466  var keyCode;
    467  if (!e && window.event)
    468  e = window.event;
    469  if (e)
    470  keyCode = (window.Event) ? e.which : e.keyCode;
    471  alert('You pressed: ' + keyCode + '. Event object is :' + e + '. x is: ' + x);
    472  }
    473 */
    474 function onPropertyChange(e) {
    475     var el = e.srcElement;
    476     attributs = el.attributes;
    477     if (attributs.id) id = attributs.id.value;
    478     if (attributs.style) style = attributs.style.value;
    479     /* Image */
    480     if (attributs.src) {
    481       src = attributs.src.value;
    482       if (attributs.width) width = attributs.width.value;
    483       if (attributs.height) height = attributs.height.value;
    484     }
    485          switch (e.propertyName) {
    486            case "style.opacity":
    487 
    488              break;
    489            case "style.transform":
    490              
    491              break;
    492            case "style.display":
    493            
    494              break;
    495            case "style.color":
    496 
    497              break;
    498            case "style.width":
    499             width= el.style.width;
    500              break;
    501            case "style.height":
    502              height = el.style.height;
    503              break;
    504 
    505            case 'width':
    506  
    507              break;
    508            case 'height':
    509 
    510              el.style.height = el.attributes.height.nodeValue + 'px';
    511              el.firstChild.style.height = el.clientHeight + 'px';
    512              break;
    513          }
    514        }
    515 
    516 function List_autosize_resize(event, ui) {
    517     if (typeof wait_resize == "undefined") wait_resize = false;
    518     if (wait_resize == true) return;
    519 
    520     wait_resize = true;
    521     if (List_autosize.length == 0) return;
    522     for (i = 0; i < List_autosize.length; i++) {
    523         Autosize_resize(jQuery(List_autosize[i]));
    524     }
    525     wait_resize = false;
    526     return true;
    527 
    528 }
    529 //==============================================================
    530 var infos_theImageAndInfos = jQuery("#theImageAndInfos").infos(); // Cadre general
    531 var infos_theMainImage = jQuery("#theMainImage").infos();         // Cadre general
    532 var infos_imageInfos = jQuery("#imageInfos").infos();             // Cadre general
    533 var infos_the_page = jQuery("#the_page").infos();
    534 var infos_content = jQuery("#content").infos();
    535 var infos_titrePage = jQuery("#titrePage").infos();
    536 var infos_imageInfoBar = jQuery("#imageInfoBar").infos();
    537 var infos_theHeader = jQuery("#theHeader").infos();
    538 var infos_imageToolBar = jQuery("#imageToolBar").infos();
    539 var infos_body = jQuery("body").infos();
    540 var infos_llgbo = jQuery("#llgbo").infos();
    541 var infos_llgboh2 = jQuery("#llgboh2").infos();
    542 //===============================================================
    543 
    544 jQuery(document).ready(
    545      function (jQuery) {
    546        // jQuery(':Autosize');
    547 
    548 
    549        jQuery(window).unload(function () {
    550          try {
    551            if (typeof The_MainImage != "undefined") {
    552              jQuery.cookie('img', The_MainImage.src); // créer un cookie avec une valeur
    553 
    554              jQuery.cookie('img_h', jQuery(The_MainImage).height());
    555              jQuery.cookie('img_w', jQuery(The_MainImage).width());
    556 
    557              if (typeof Window_Affichage != "undefined") {
    558                jQuery.cookie('window_height', Window_Affichage.height);
    559                jQuery.cookie('window_width', Window_Affichage.width);
    560              }
    561            }
    562          } catch (r) {
    563 
    564          }
    565 
    566        });
    567 
    568        /********************************************
    569        *  window LOAD
    570        ********************************************/
    571        jQuery(window).load(function () {
    572 
    573          href = location.href;
    574          var aff_ok = false;
    575          /*
    576          jQuery.post(href, function (data) {
    577          nu_img--;
    578          if (nu_img < 0) nu_img = 9;
    579          jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
    580          //alert("Data Loaded: " + data);
    581          Wait_Affichage();
    582          });
    583          */
    584          // jQuery(':Set_Class');
    585          if (typeof img_width == "undefined") {
    586            if (List_autosize.length == 0) return;
    587            wait_resize = false;
    588            if (List_autosize_resize()) Wait_Affichage();
    589            return true;
    590          }
    591          //=========================================================
    592          if (typeof (options) == "undefined") {
    593            options = { imageAutosizeMargin: 0, imageAutosize: false }
    594          }
    595 
    596          old_img = jQuery.cookie('img');
    597          old_img_h = jQuery.cookie('img_h');
    598          old_img_w = jQuery.cookie('img_w');
    599          old_window_height = jQuery.cookie('window_height');
    600          old_window_width = jQuery.cookie('window_width');
    601 
    602          //============================================================
    603          img_init = { height: img_height, width: img_width };  // taille initiale
    604          img_defaut = { height: scaled_height, width: scaled_width };
    605          img_reelle = { height: img_height, width: img_width };
    606          img_finale = { height: 0, width: 0 };
    607 
    608          img_top = "0";
    609          rapport = -1;
    610          marges_llgbo = 0;
    611 
    612          //=============================================================
    613          Type_Img = "";
    614          nopano = false;
    615 
    616 
    617          Zone_Affichage = { height: 0, width: 0 };
    618          //============================================================
    619          jQuery("#the_page").css({ top: "0px" });
    620 
    621          infos_theImageAndInfos = jQuery("#theImageAndInfos").infos(); // Cadre general
    622          infos_theMainImage = jQuery("#theMainImage").infos();         // Cadre general
    623          infos_imageInfos = jQuery("#imageInfos").infos();             // Cadre general
    624         infos_the_page = jQuery("#the_page").infos();
    625          infos_content = jQuery("#content").infos();
    626          infos_titrePage = jQuery("#titrePage").infos();
    627          infos_imageInfoBar = jQuery("#imageInfoBar").infos();
    628          infos_theHeader = jQuery("#theHeader").infos();
    629          infos_imageToolBar = jQuery("#imageToolBar").infos();
    630          infos_imageHeaderBar = jQuery("#imageHeaderBar").infos();
    631 
    632          Parent = "#theImage";
    633          infos_theImage = jQuery(Parent).infos();
    634          Zone_Affichage = jQuery(Parent).infos();
    635          //
    636          var old_window = { width: 0, height: 0 };
    637 
    638          Bandeau_bas = infos_Description_f(Parent);
    639          if (typeof Bandeau_bas != "undefined") Bandeau = Bandeau_bas.top;
    640          else Bandeau = 0;
    641 
    642 
    643          rapport = parseInt(img_init.width) / parseInt(img_init.height);
    644 
    645 
    646 
    647 
    648          old_window = { width: 0, height: 0 };
    649          jQuery().newResize(true);
    650          Wait_Affichage();
    651 
    652 
    653 
    654          //============== initialisation ===================
    655 
    656          var pos;
    657          var set_p = false;
    658 
    659 
    660        }); // window.onload
    661 
    662 
    663        /***********************************************************
    664        *  RESIZE
    665        ***********************************************************/
    666        old_window = { width: 0, height: 0 };
    667        jQuery(window).resize(
    668                function (event, ui) {
    669                  List_autosize_resize(event, ui);
    670                  if (jQuery().newResize())
    671                    Wait_Affichage();
    672                });
    673 
    674        /************************************
    675        * Extend
    676        ************************************/
    677        jQuery.fn.extend({
    678          //==========================================================
    679          infos_description: function (e) {
    680            return infos_Description_f(e);
    681 
    682          },
    683          //=============================================================
    684          onPropertyChange: function (e) {
    685 
    686            return;
    687 
    688          },
    689          /*
    690          * recherche la plus grande image (hauteur ou largeur)
    691          */
    692          Get_Img_Maxi: function (myobj) {
    693            return Get_Img_Maxi(myobj);
    694          },
    695          //============================================================
    696          affiche_debug: function (aff_infos) {
    697            affiche_debug(aff_infos);
    698          },
    699          //====================================================
    700          newResize: function (force) {
    701            if (force && force == true) old_window.width = 0;
    702            id2 = jQuery("#theImage img").attr("usemap");
    703            if (typeof id2 == "undefined") id2 = jQuery("#theImage").attr("usemap");
    704            if (id2) {
    705              if (id2.match(RegExp("#map", "gi"))) {
    706                return true;
    707              }
    708            }
    709            if (typeof options != "undefined")
    710              if (options.imageAutosize) {
    711                // Wait_Affichage();
    712                return true; //stripped
    713              }         
    714            if (typeof Bandeau_bas == "undefined")
    715              return true;
    716            if (typeof cl_visible == "undefined") return true;
    717            if (!cl_visible == true) { return true; }
    718            var chk = eval(user_status + "_enabled");
    719            if (chk == "") { return true; }
    720            //=================================================================
    721            
    722            nds = jQuery("#imageInfos").css("display");
    723            Zone_image = Calcul_Image(nds == "none");
    724 
    725            var winwidth = jQuery(window).width();
    726            var winheight = jQuery(window).height();
    727 
    728 
    729            n = winwidth - old_window.width;
    730            if (Math.abs(n) < 1) {
    731              n = winheight - old_window.height;
    732              if (Math.abs(n) < 1) {
    733                return false;
    734              }
    735            }
    736 
    737            if (Math.abs(n) > 30) nu_img = 0;
    738            nu_img++;
    739            if (nu_img > 10) return true;
    740 
    741            old_window = jQuery(window).infos();
    742            //========= Récupération des informations =============       
    743 
    744 
    745            var marge = 0;
    746            var marge_right = 0;
    747            var marge_left = 0;
    748 
    749            var Licence = jQuery(".licencetag");
    750            infos_Licence = jQuery(".licencetag").infos();
    751 
    752            if (theme.match(RegExp("simple", "gi"))) {
    753              if (infos_imageToolBar.width > 0)
    754                marge = (Zone_Affichage.width - infos_imageToolBar.width) / 2;
    755              else if (infos_the_page.width > 0)
    756                marge = (Zone_Affichage.width - infos_the_page.width) / 2;
    757 
    758              marge_right = marge;
    759              marge_left = marge;
    760 
    761              if (infos_content.width > 100) {
    762 
    763                marge_left = (infos_imageInfoBar.margin.left) + 1;
    764                marge_right = (marge_left + infos_imageInfoBar.margin.right) + 1;
    765                winwidth = infos_content.width;
    766                marge_right = infos_imageInfoBar.width + marge_right;
    767 
    768              }
    769            } else if (theme.match(RegExp("elegant", "gi"))) {
    770 
    771              infos_theMainImage = jQuery("#theMainImage").infos(); // Image
    772              infos_imageHeaderBar = jQuery("#imageHeaderBar").infos();
    773              infos_window = jQuery(window).infos();
    774 
    775              infos_theImage = jQuery("#theImage").infos(); // conteneur image
    776              infos_imageInfos = jQuery("#imageInfos").infos(); // conteneur infos
    777 
    778              if (jQuery("#imageInfos").is(":hidden")) {
    779 
    780                marge_right = infos_imageInfos.margin.left + infos_imageInfos.margin.right;
    781                marge_right += infos_imageInfos.borderwidth.left + infos_imageInfos.borderwidth.right;
    782 
    783                marge_left = infos_imageInfos.left + 2;
    784              } else {
    785 
    786                marge_right = infos_imageInfos.margin.left + infos_imageInfos.margin.right;
    787                marge_right += infos_imageInfos.width + infos_imageInfos.borderwidth.left + infos_imageInfos.borderwidth.right;
    788 
    789                marge_left = infos_imageInfos.left + 2;
    790              }
    791 
    792            } else {
    793              infos_imageHeaderBar = jQuery("#imageHeaderBar").infos();
    794              if (theme.match(RegExp("stripped", "gi")) || theme.match(RegExp("elegant", "gi"))) {
    795                marge = (infos_the_page.width - infos_content.width) / 2;
    796                marge_right = marge + 2;
    797                marge_left = marge + 2;
    798              } else if (infos_imageToolBar.width > 0) {
    799                marge = (infos_the_page.width - infos_imageToolBar.width) / 2;
    800 
    801                marge_right = marge + infos_the_page.left;
    802                marge_left = marge;
    803 
    804              }
    805              winwidth = infos_the_page.width;
    806            }
    807 
    808 
    809 
    810            marge_right += Zone_Affichage.borderwidth.right;
    811            marge_left += Zone_Affichage.borderwidth.left;
    812            if ((marge_right + marge_left) < winwidth) {
    813              winwidth -= (marge_right + marge_left);
    814            }
    815    
    816 
    817 
    818            if (Type_Img == "pamoorama") {
    819 
    820              mypanorama = window.myPamoorama;
    821              //============================================================
    822              if (typeof (mypanorama) == "undefined") return false;
    823              var myPamoorama = mypanorama;
    824              if (typeof (myPamoorama.skipInit) == "undefined") return false;
    825              //
    826 
    827              if (myPamoorama.skipInit == false) {
    828 
    829                return false;
    830              }
    831 
    832              var infos_pamoorama = jQuery("#pamoorama").infos();
    833              var infos_pamoorama_outter = jQuery("#pamoorama_outter").infos();
    834              var infos_pamoorama_inner = jQuery("#pamoorama_inner").infos();
    835              var infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
    836              var infos_pamoorama_frame = jQuery("#pamoorama_frame").infos();
    837              The_MainImage = jQuery("#pamoorama");
    838              obj = The_MainImage.get(0);
    839 
    840            } else {
    841 
    842 
    843 
    844 
    845            }
    846            //=================================================================
    847 
    848 
    849            switch (Type_Img) {
    850              case "map":
    851 
    852 
    853                ;
    854 
    855                break
    856 
    857 
    858              case "panorama":     
    859                if (!The_MainImage) {
    860                  The_MainImage = jQuery("#theMainImage");
    861                  if (The_MainImage.length > 0)
    862                    return;
    863                  The_MainImage = jQuery().Get_Img_Maxi("#Panorama img[alt]");
    864                
    865                  if (The_MainImage.length > 0)
    866                    The_MainImage = The_MainImage[0];
    867                  else
    868                    The_MainImage = jQuery().Get_Img_Maxi("#Panorama img[alt]");
    869                }
    870                infos_theImage = jQuery(The_MainImage).infos();
    871                infos_the_page = jQuery("#the_page").infos();
    872                jQuery("#theImage").height(infos_theImage.height);
    873                img_finale.height = infos_theImage.height;
    874 
    875                break
    876              case "img":
    877 
    878                if (!The_MainImage) return true;
    879                if (theme.match(RegExp("luciano", "g"))) {
    880                  The_MainImage = jQuery("#the_page #The_MainImage");
    881                }
    882 
    883                infos_the_page = jQuery("#the_page").infos();
    884 
    885 
    886                break
    887              case "img_autre":
    888                if (!The_MainImage) {
    889                  if (DEBUG_autosize == "true") alert("The_MainImage=null");
    890                  return true;
    891 
    892                }
    893                infos_theImage = jQuery(The_MainImage).infos();
    894                infos_the_page = jQuery("#the_page").infos();
    895 
    896 
    897                break
    898              case "embed":
    899                //
    900                if (infos_img.width == 0)
    901                  infos_img = jQuery("#thePicturePage").infos();
    902                if (infos_img.width == 0)
    903                  infos_img = jQuery("#the_page").infos();
    904                infos_theImage = infos_img;
    905                infos_the_page = jQuery("#the_page").infos();
    906                Bandeau_bas.height = Bandeau_bas.top;
    907 
    908                iph1 = jQuery("#theImage div").infos();
    909                if ((winheight - iph1.bottom) > 0)
    910                  Bandeau_bas.height = (winheight - iph1.bottom) + 50;
    911                else
    912                  Bandeau_bas.height = 50;
    913 
    914 
    915                if (rapport < 0) {
    916                  img_height = infos_img.height;
    917                  img_width = infos_img.width;
    918                  img_reelle.height = img_height;
    919                  img_reelle.width = img_width;
    920                }
    921 
    922                break
    923              case "charlie":
    924                infos_theImage = infos_img;
    925                infos_the_page = jQuery("#the_page").infos();
    926                if (rapport < 0) {
    927                  img_height = parseInt(infos_img.height);
    928                  img_width = parseInt(infos_img.width);
    929                  img_reelle.height = parseInt(infos_img.height);
    930                  img_reelle.width = parseInt(infos_img.width);
    931                }
    932                break
    933 
    934 
    935              case "pamoorama":
    936                img_reelle = { height: img_height, width: img_width };
    937                //=========================================================
    938                img_reelle.height = img_height;
    939                img_reelle.width = Zone_Affichage.width;
    940                The_MainImage = myPamoorama.image;
    941                infos_theImage = jQuery("#pamoorama").infos();
    942                infos_theImage.height = infos_theImage.height;
    943                infos_the_page = jQuery("#the_page").infos();
    944                break
    945            }
    946  //================= Vérification taille image ==================
    947            MinWidth = jQuery(The_MainImage).css("minWidth");
    948            if (MinWidth == "0px")
    949              MinWidth = mini_width;
    950            MinHeight = jQuery(The_MainImage).css("minHeight");
    951            if (MinHeight == "0px")
    952              MinHeight = mini_height;
    953 
    954            MaxWidth = jQuery(The_MainImage).css("maxWidth");
    955            if (MaxWidth == "0px")
    956              MaxWidth = winwidth;
    957            MaxHeight = jQuery(The_MainImage).css("maxHeight");
    958            if (MaxHeight == "0px")
    959              MaxHeight = mwinheight;
    960 
    961            //=============== Vérification taille minimale  autorizée ======================
    962            var miniWidth = jQuery(The_MainImage).Get_Val_int(MinWidth, mini_width);
    963            var miniHeight = jQuery(The_MainImage).Get_Val_int(MinHeight, mini_height);
    964            if (winwidth < mini_width2) mini_width2 = winwidth;
    965 
    966            var miniWidth2 = jQuery(The_MainImage).Get_Val_int(MinWidth, mini_width2);
    967            var miniHeight2 = jQuery(The_MainImage).Get_Val_int(MinHeight, mini_height2);
    968 
    969 
    970            var maxWidth = jQuery(The_MainImage).Get_Val_int(MaxWidth, winwidth, "0");
    971            maxHeight = jQuery(The_MainImage).Get_Val_int(MaxHeight, winheight, "0");
    972 
    973            mini_width = parseInt(miniWidth);
    974            mini_height = parseInt(miniHeight);
    975 
    976            img_reelle.width = parseInt(img_reelle.width);
    977 
    978            if (img_reelle.width < mini_width)
    979              return true;
    980          
    981 
    982            img_reelle.height = parseInt(img_reelle.height);
    983            if (img_reelle.height < parseInt(mini_height))
    984              return true;
    985 //======================================================================
    986            jQuery("#theMainImage").width(Zone_image.image.width);
    987            jQuery("#theMainImage").height(Zone_image.image.height);
    988            jQuery("#theImage").width(Zone_image.container.width);
    989            jQuery("#theImage").height(Zone_image.container.height);
    990          
    991 return true;
    992  //=============== Zone d'affichage ============================ 
    993            Zone_Affichage.width = winwidth;
    994            borderH = Zone_Affichage.borderwidth.top;
    995            borderH += Zone_Affichage.borderwidth.bottom;
    996 
    997            Zone_Affichage.height = winheight - borderH;
    998 
    999            var Licence = jQuery(".licencetag");
    1000            infos_Licence = jQuery(".licencetag").infos();
    1001 
    1002            var MainImage = jQuery("#theMainImage");
    1003 
    1004            if (MainImage.length == 0) jQuery(Parent + " #theImg IMG").css("marginTop", "0px");
    1005 
    1006            //========== Correction en fonction du thème =============================
    1007            var correction = 0;
    1008            if (theme.match(RegExp("sobre", "g"))) {
    1009 
    1010              //   correction = -infos_Licence.padding.top;
    1011              if (Type_Img == 'img') {
    1012                if (msie == true) correction = 0;
    1013                else correction = 0;
    1014                correction = 10;
    1015              }
    1016 
    1017            } else if (theme.match(RegExp("Pure", "g"))) {
    1018              correction += 0; //??
    1019            } else if (theme.match(RegExp("luciano", "g"))) {
    1020              correction = 0; //??
    1021 
    1022            } else if (theme.match(RegExp("simple", "g"))) {
    1023              correction += 0; //??
    1024            } else if (theme.match(RegExp("gally", "g"))) {
    1025              correction += 0; //??
    1026            } else if (theme.match(RegExp("os", "g"))) {
    1027              correction += 0; //??
    1028            } else if (theme.match(RegExp("elegant", "gi"))) {
    1029              correction += 0; //??
    1030            }
    1031            //====================================================
    1032            if (options.imageAutosizeMargin > 0) Marge_Basse = options.imageAutosizeMargin;
    1033            else Marge_Basse = parseInt(marge_basse || 0); // hors bandeau
    1034            //==========================================================================
    1035            h = 0;
    1036            Bandeau = 0;
    1037            infos_body = jQuery("body").infos();
    1038            h = (Zone_Affichage.padding.bottom + Zone_Affichage.padding.top + Zone_Affichage.margin.top + Zone_Affichage.margin.bottom);
    1039            h -= infos_body.margin.bottom;
    1040            h -= infos_body.margin.top;
    1041            if (typeof Bandeau_t != "undefined") {
    1042              Bandeau = Bandeau_t.top | 0;
    1043 
    1044            }
    1045            Zone_Affichage.height -= Bandeau + Marge_Basse - correction - h; // 784 -127
    1046 
    1047 
    1048            //=========================================================================
    1049            if (Zone_Affichage.height < mini_height2)
    1050              Zone_Affichage.height = mini_height2;
    1051            if (Zone_Affichage.width < mini_width2)
    1052              Zone_Affichage.width = mini_width2;
    1053            //=========================================================================
    1054            /*
    1055            if (typeof (Bandeau_bas) != "undefined") {
    1056            if (Bandeau_bas.height < Zone_Affichage.height)
    1057            Zone_Affichage.height += (Bandeau_bas.height + Bandeau_bas.marge.top + Bandeau_bas.marge.bottom);
    1058            } else {
    1059 
    1060            }
    1061            */
    1062 
    1063 
    1064 
    1065            img_finale.width = Zone_Affichage.width - (Zone_Affichage.borderwidth.left + Zone_Affichage.borderwidth.right);
    1066            img_finale.height = Zone_Affichage.height - (Zone_Affichage.borderwidth.left + Zone_Affichage.borderwidth.bottom);
    1067 
    1068 
    1069            var Image_height = img_finale.height;
    1070 
    1071            //=============================================================
    1072            var height_user = eval(user_status + "_height");
    1073            var reg1 = new RegExp("%", "g");
    1074            if (height_user.match(reg1))
    1075              Image_height = Image_height * parseInt(height_user) / 100;
    1076            else
    1077              Image_height = parseInt(height_user);
    1078 
    1079            echelle_max = parseFloat(echelle_max, '3');
    1080            var echelle = parseFloat(Image_height / img_reelle.height, 3);
    1081 
    1082            if (echelle > echelle_max) { echelle = echelle_max; }
    1083            Image_height = parseInt(img_reelle.height * echelle);
    1084            //============================================================
    1085            var Image_width;
    1086            if (rapport > 0)
    1087              Image_width = parseInt(Image_height * rapport);
    1088            else if (Type_Img == "map") {
    1089              Image_width = Zone_Affichage.width - marge_left - marge_right;
    1090            } else {
    1091              Image_width = Zone_Affichage.width;
    1092            }
    1093 
    1094            //===============================================================
    1095            jQuery(Cadre).width(Zone_Affichage.width);
    1096            jQuery(Cadre).height(Zone_Affichage.height);
    1097            jQuery(The_MainImage).removeAttr("width");
    1098            jQuery(The_MainImage).css({ height: Image_height }); //image
    1099 
    1100 
    1101 
    1102            align_auto = "center";
    1103            if (jQuery("#theImg").css("textAlign"))
    1104              align_auto = jQuery("#theImg").css("textAlign");
    1105            var widthmin = winwidth;
    1106 
    1107            if (check_auto_w == 'checked="checked"') {
    1108              // if (Type_Img != "pamoorama" && Type_Img != "panorama" ) {
    1109              //==== largeur à atteindre ===
    1110              var width_user = eval(user_status + "_width");
    1111              // Largeur maximale en fonction du statut
    1112              if (width_user.match(reg1))
    1113              // pourcentage
    1114                widthmin = widthmin * parseInt(width_user) / 100;
    1115              else
    1116                widthmin = parseInt(width_user);
    1117 
    1118              var marges = 0;
    1119 
    1120              if (typeof (infos_img) != "undefined") {
    1121                widthmin -= infos_img.borderwidth.left || 0;
    1122                widthmin -= infos_img.borderwidth.right || 0;
    1123              }
    1124              widthmin -= marges;
    1125              if (typeof Bandeau_t != "undefined") {
    1126                widthmin -= (Bandeau_t.borderwidth.left + Bandeau_t.borderwidth.left);
    1127                Image_width -= (Bandeau_t.borderwidth.left + Bandeau_t.borderwidth.left);
    1128              } else {
    1129 
    1130                jQuery().newResize();
    1131              }
    1132              if (Image_width > widthmin) {
    1133                //   Image_width largeur à atteindre
    1134                //  Calcul du rapport d'agrandissement
    1135                var echelle_w = parseFloat((widthmin) / img_reelle.width, 3);
    1136                if (echelle_w > echelle_max) { echelle_w = echelle_max; }
    1137                Image_width = parseInt(img_reelle.width * echelle_w);
    1138                if (rapport > 0)
    1139                  Image_height = parseInt(Image_width / rapport);
    1140              }
    1141 
    1142 
    1143 
    1144            }
    1145 
    1146 
    1147            // }
    1148            //===================================================
    1149 
    1150            img_finale.height = Image_height;
    1151            img_finale.width = Image_width;
    1152            if (theme.match(RegExp("stripped", "gi"))) {
    1153              img_finale.width -= (llgboframe.top * 2);
    1154              if (rapport > 0) img_finale.height = (img_finale.width / rapport);
    1155              else img_finale.height -= (llgboframe.top * 2);
    1156 
    1157            }
    1158            zoom = echelle;
    1159            if (typeof (llgboframe) != "undefined" && llgboframe.height > 0) {
    1160              //=============LLGBO2 ===========================
    1161              t1 = llgboframe;
    1162              if (!The_MainImage.src) {
    1163                The_MainImage = jQuery("#llgbo").find("img").get(0)
    1164                if (!The_MainImage.src) {
    1165                  The_MainImage = jQuery(Parent).find("div").get(0)
    1166                }
    1167              }
    1168              if (The_MainImage.src) {
    1169                wingbo = img_finale.width;
    1170                heightgbo = img_finale.height;
    1171                if (Type_Img == "panorama") {
    1172                  heightgbo = infos_theImage.height;
    1173                  img_finale.height = infos_theImage.height;
    1174                }
    1175 
    1176                img_finale.width -= marges_llgbo;
    1177                if (jQuery("#slideshow").infos().width > 0) {
    1178                  img_finale.height -= (marges_llgbo * 1.5);
    1179                } else {
    1180                  img_finale.height -= marges_llgbo
    1181                }
    1182 
    1183 
    1184                if (wingbo > winwidth) {
    1185                  jQuery("#llgbo").width(winwidth);
    1186                  jQuery("#llgbo").height(winheight);
    1187                  jQuery("#llgbo").css("width", winwidth + "px");
    1188                  jQuery("#llgbo").css("height", winheight + "px");
    1189                }
    1190                else {
    1191                  jQuery("#llgbo").width(wingbo);
    1192                  jQuery("#llgbo").height(heightgbo);
    1193                  jQuery("#llgbo").css("width", wingbo + "px");
    1194                  jQuery("#llgbo").css("height", heightgbo + "px");
    1195                }
    1196 
    1197                a0 = jQuery("area[rel!=up][rel!=prev][rel!=next]");
    1198                a1 = jQuery("area[rel=prev]");
    1199                a2 = jQuery("area[rel=next]");
    1200                a3 = jQuery("area[rel=up]");
    1201                nb_zone = 3;
    1202                if (a1.length == 0) {
    1203                  nb_zone -= 1;
    1204                }
    1205                if (a2.length == 0) {
    1206                  nb_zone -= 1;
    1207                }
    1208 
    1209 
    1210                var Largeur_zone = (img_finale.width / nb_zone);
    1211                var Hauteur_zone = (img_finale.height);
    1212                var init_zone = 0;
    1213 
    1214                if (a1.length > 0) {
    1215                  coord = { x0: init_zone, y0: 0, x1: Largeur_zone, y1: Hauteur_zone };
    1216 
    1217                  jQuery("area[rel=prev]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
    1218                  init_zone += Largeur_zone;
    1219                }
    1220 
    1221                coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
    1222 
    1223                if (a0.length > 0) {
    1224                  jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1 / 2) + "'" });
    1225                  jQuery(a0).attr({ coords: "'" + coord.x0 + "," + (coord.y1 / 2) + "," + coord.x1 + "," + (coord.y1) + "'" });
    1226                } else {
    1227                  jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1) + "'" });
    1228                }
    1229                init_zone += Largeur_zone;
    1230 
    1231                if (a2.length > 0) {
    1232                  coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
    1233                  jQuery("area[rel=next]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
    1234                }
    1235                //    jQuery("#theImage").height(heightgbo + marges_llgbo / 2);
    1236              }
    1237            }
    1238 
    1239            //================ Zone affichage =========================
    1240 
    1241            //  jQuery(Cadre).css("top", "0px");
    1242            jQuery("#standard").css("top", 0 + "px");
    1243            jQuery("#comments").css("top", 0 + "px");
    1244            //========== Image Remise à l'échelle =======================
    1245 
    1246            img_finale.height = parseInt(img_finale.height);
    1247            img_finale.width = parseInt(img_finale.width);
    1248            //=========================================================================
    1249            //=== cadre = theImage
    1250            if (theme.match(RegExp("simple", "gi"))) {
    1251              jQuery(Cadre).width(Zone_Affichage.width); //centrer simple black
    1252              jQuery(Cadre).css({ width: Zone_Affichage.width + "px",
    1253                marginLeft: "auto"
    1254              });
    1255 
    1256            } else if (theme.match(RegExp("sobre", "gi")) || theme.match(RegExp("hr_", "gi")) || theme.match(RegExp("Mont", "gi"))) {
    1257              jQuery(Cadre).css({ width: "auto", marginLeft: "auto" });
    1258            } else if (theme.match(RegExp("saruka", "gi"))) {
    1259 
    1260              jQuery(Cadre).css({ width: Zone_Affichage.width + "px" });
    1261            } else if (theme.match(RegExp("elegant", "gi"))) {
    1262 
    1263              // jQuery(Cadre).css("width", "auto");
    1264              jQuery(Cadre).css({ height: Zone_Affichage.height + "px", width: "auto" }); //conteneur
    1265 
    1266            } else {
    1267              jQuery(Cadre).css("width", "auto");
    1268 
    1269            }
    1270            // ;
    1271 
    1272            if (Type_Img == "panorama" || Type_Img == "pamoorama") {
    1273              img_finale.height = infos_theImage.height;
    1274              Zone_Affichage.height = img_finale.height;
    1275 
    1276            }
    1277 
    1278            if (typeof (gmaps) != "undefined") {
    1279              Gmap_ = gmaps.maps[0];
    1280              if (Gmap_.sizeMode == 'A') {
    1281                jQuery("#iGMapsIcon").css({ width: old_window.width * 0.8 + "px", height: old_window.height * 0.8 + "px" });
    1282 
    1283              }
    1284            }
    1285            //============= flv,mov,mpg  ok
    1286            /* wmv nok
    1287            * avi nok
    1288            //===========================================
    1289            */
    1290            if (Type_Img == "charlie") {
    1291              t1 = jQuery("#charlie").infos();
    1292 
    1293              /**/
    1294 
    1295              pdf = 0;
    1296              jQuery("#charlie div").each(function (i) {
    1297 
    1298 
    1299                p1 = jQuery(this).infos();
    1300                pdf += p1.padding.right + p1.padding.left;
    1301              });
    1302              img_finale.width -= pdf;
    1303 
    1304              jQuery("#charlie").css({
    1305                width: img_finale.width + pdf + "px",
    1306                height: img_finale.height + "px",
    1307                marginLeft: "auto"
    1308              });
    1309 
    1310 
    1311              if (MainImage.length > 0) {
    1312                img_finale.height = parseInt(img_finale.width / rapport);
    1313                img_finale.height -= 30;
    1314                img_finale.width = rapport * img_finale.height;
    1315 
    1316 
    1317                MainImage.width(img_finale.width);
    1318                MainImage.height(img_finale.height);
    1319                jQuery("#embedplayer").width(300);
    1320                jQuery("#embedplayer").height(15);
    1321              } else {
    1322                jQuery("#player").css("width", img_finale.width + "px");
    1323                jQuery("#player").css("height", img_finale.height + "px");
    1324 
    1325                jQuery("#embedplayer").css("width", img_finale.width + "px");
    1326                jQuery("#embedplayer").css("height", img_finale.height + "px");
    1327 
    1328                jQuery("embed").css({ width: img_finale.width + "px",
    1329                  height: img_finale.height + "px"
    1330                });
    1331                jQuery("object").css({ width: img_finale.width + "px",
    1332                  height: img_finale.height + "px"
    1333                });
    1334                jQuery("video").css({ width: img_finale.width + "px",
    1335                  height: img_finale.height + "px"
    1336                });
    1337 
    1338 
    1339 
    1340                jQuery("video").height(img_finale.height);
    1341                jQuery("video").width(img_finale.width);
    1342 
    1343                jQuery("object").width(img_finale.width);
    1344                jQuery("object").height(img_finale.height);
    1345                //jQuery(Cadre).height(img_finale.height + Bandeau_bas.height); //??             
    1346 
    1347                jQuery(The_MainImage).height(img_finale.height);
    1348                jQuery(Cadre).css("height", "auto");
    1349              }
    1350 
    1351 
    1352            } else if (Type_Img == "embed") {
    1353 
    1354              if (MainImage.length > 0) {
    1355                img_finale.height = parseInt(img_finale.width / rapport);
    1356                img_finale.height -= 30;
    1357                img_finale.width = rapport * img_finale.height;
    1358 
    1359 
    1360                MainImage.width(img_finale.width);
    1361                MainImage.height(img_finale.height);
    1362                jQuery("#embedplayer").width(300);
    1363                jQuery("#embedplayer").height(15);
    1364              } else {
    1365                jQuery(Cadre).css("height", "auto");
    1366                jQuery("embed").css("height", img_finale.height);
    1367                jQuery("object").css({ height: img_finale.height + "px" });
    1368 
    1369                jQuery("object").width(img_finale.width);
    1370                jQuery("object").height(img_finale.height);
    1371              }
    1372 
    1373            } else if (Type_Img == "panorama") {
    1374              if (typeof asp_options != "undefined")
    1375                n = asp_options;
    1376              n1 = jQuery("#Panorama div").width();
    1377              jQuery(".panorama-viewport").css("margin", "auto");
    1378              n = infos_imageToolBar;
    1379 
    1380 
    1381            } else if (Type_Img == "pamoorama") {
    1382 
    1383 
    1384 
    1385              infos_theImage.height = Zone_Affichage.height;
    1386              img_height = myPamoorama.imageHeight
    1387              if (theme.match(RegExp("simple", "g"))) {
    1388                //  marge_right = 2;
    1389              }
    1390              new_width = Zone_Affichage.width - marge_right - marge_left;
    1391              new_width = Zone_Affichage.width - (infos_theImage.borderwidth.right + infos_theImage.borderwidth.left);
    1392              if (new_width > myPamoorama.imageWidth)
    1393                new_width = myPamoorama.imageWidth;
    1394 
    1395 
    1396 
    1397              Zone_Affichage.height += infos_pamoorama_footer.height;
    1398              zoom = infos_theImage.height / img_height;
    1399              myPamoorama.options.width = new_width * zoom;
    1400              //  if(msie || safari) jQuery("#pamoorama_inner ").css({ zoom: zoom });
    1401              //====================================================
    1402              jQuery("#pamoorama").css({
    1403                marginLeft: "auto",
    1404                marginRight: "auto",
    1405                //height: Zone_Affichage.height + "px", sinon déclenchement panorama sur la hauteur;
    1406                width: new_width + "px"
    1407              });
    1408              jQuery("#pamoorama").width(new_width);
    1409 
    1410              //====================================================
    1411              infos_pamoorama = jQuery("#pamoorama").infos();
    1412              img_finale.height = infos_pamoorama.height - infos_pamoorama_footer.height;
    1413              img_finale.width = new_width;
    1414 
    1415              jQuery("#pamoorama_outter").width(new_width);
    1416 
    1417              jQuery("#pamoorama_thumb").width(200 / zoom);
    1418              // commenter sinon outter augmente à chaque resize
    1419              //  jQuery("#pamoorama_outter").height(infos_pamoorama.height - infos_pamoorama_footer.height);
    1420              // pamoorama_frame
    1421 
    1422 
    1423              jQuery("#pamoorama_outter").css({ width: new_width + "px" });
    1424              jQuery("#pamoorama_footer").css({ width: new_width + "px" });
    1425              //
    1426              //====================================================
    1427              infos_pamoorama = jQuery("#pamoorama").infos();
    1428              infos_pamoorama_outter = jQuery("#pamoorama_outter").infos();
    1429              infos_pamoorama_inner = jQuery("#pamoorama_inner").infos();
    1430              infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
    1431              infos_pamoorama_frame = jQuery("#pamoorama_frame").infos();
    1432 
    1433              infos_frame = jQuery(myPamoorama.frame).infos();
    1434 
    1435 
    1436 
    1437            } else if (The_MainImage != null && The_MainImage.src) {
    1438              //--- background ?? ---
    1439              jQuery(The_MainImage).height(img_finale.height);
    1440              jQuery(The_MainImage).width(img_finale.width);
    1441              jQuery(The_MainImage).css({ height: img_finale.height + "px ",
    1442                width: img_finale.width + "px "
    1443              });
    1444 
    1445 
    1446            } else {
    1447              //===map ? luciano ===
    1448              //   jQuery(The_MainImage).css({ height: img_finale.height + "px ",  width: img_finale.width + "px });
    1449              //   jQuery(The_MainImage).height(img_finale.height );
    1450              //   jQuery(The_MainImage).width(img_finale.width );
    1451              //   jQuery(The_MainImage).attr({ width: img_finale.width  });
    1452              h = img_finale.height;
    1453              h = Zone_Affichage.height - Zone_Affichage.borderwidth.top - Zone_Affichage.borderwidth.bottom;
    1454              h -= (infos_theImage.borderwidth.bottom + infos_theImage.borderwidth.top);
    1455 
    1456              jQuery(The_MainImage).attr({ height: h - 3 }); //image
    1457              if (theme.match(RegExp("elegant", "gi"))) {
    1458                return true;
    1459 
    1460              }
    1461              if (theme.match(RegExp("luciano", "g"))) {
    1462                imgl = 180;
    1463                l = Zone_Affichage.left;
    1464 
    1465                jQuery(".imageNumber").css({ left: l + "px"
    1466 
    1467                });
    1468                jQuery(Parent + " #theImg IMG").css({ height: img_finale.height + "px ",
    1469                  width: (img_finale.width - imgl) + "px ", marginTop: "0px"
    1470                })
    1471              }
    1472 
    1473            }
    1474 
    1475            var theImg = document.getElementById("theMainImage");
    1476            if (theImg) {
    1477              theImg.removeAttribute("width");
    1478              theImg.removeAttribute("height");
    1479              jQuery(The_MainImage).css("width", img_finale.width + "px");
    1480            }
    1481 
    1482            jQuery("#navThumbPrev").css({ overflow: "hidden" });
    1483            jQuery("#navThumbNext").css({ overflow: "hidden" });
    1484            n = typeof inittoolbar;
    1485            if (Type_Img == "map") {
    1486              jQuery("#navThumbNext").css({ display: 'none' });
    1487              jQuery("#navThumbPrev").css({ display: 'none' });
    1488              jQuery("#theImage").css({ marginTop: infos_imageToolBar.height + "px", marginLeft: "0px",
    1489                width: winwidth + "px",
    1490                height: winheight + "px"
    1491              });
    1492              //mapPicture
    1493            }
    1494            try {
    1495              if (theme.match(RegExp("gally", "gi"))) {
    1496                if (typeof inittoolbar == "function") {
    1497                  if (typeof (currentTab) == "undefined") inittoolbar();
    1498                  else initializeImageMode("resize");
    1499                } else {
    1500                  tp = gallyPP.getImageProp();
    1501                  if (typeof (GallyPP) == "function")
    1502                    gallyPP = new GallyPP();
    1503 
    1504                  iph = jQuery("#imageHeaderBar").infos();
    1505                  jQuery("#imageToolBar").css({ top: iph.bottom + "px", position: "absolute" });
    1506                  jQuery("#theImage").width(winwidth);
    1507                }
    1508                //===========================================================================
    1509                if (jQuery("#navThumbPrev").length > 0) {
    1510                  jQuery("#navThumbPrevContainer").css({ left: "0px"
    1511                  });
    1512                }
    1513                if (jQuery("#navThumbNext").length > 0) {
    1514                  jQuery("#navThumbNextContainer").css({ left: "0px"
    1515                  });
    1516                }
    1517                //=============================================================================
    1518                if (!theme.match(RegExp("lapis", "gi"))) {
    1519                  if (typeof initializeImageMode == "function") {
    1520                    initializeImageMode("resize");
    1521                  }
    1522 
    1523                }
    1524 
    1525              } else if (theme.match(RegExp("simple", "g"))) {
    1526 
    1527                jQuery("#imageToolBar").css({ position: "static" });
    1528 
    1529                infos_imageInfoBar = jQuery("#imageInfoBar").infos();
    1530                if (infos_imageInfoBar.bottom < infos_img.bottom) {
    1531                  //   jQuery("#imageInfoBar").height(infos_img.bottom);
    1532                }
    1533 
    1534              } else {
    1535 
    1536                //    jQuery("#imageToolBar").css("position", "static");
    1537              }
    1538            } catch (e) {
    1539 
    1540            }
    1541            zoom = img_finale.height / img_height;
    1542            h0 = jQuery("#content").height();
    1543            if (h0 == null) {
    1544              h0 = winheight - Zone_Affichage.top;
    1545            }
    1546            h1 = (h0 - img_finale.height) / 2;
    1547            //  jQuery(Parent).css({ marginTop: h1 + "px" });
    1548 
    1549            zoom = parseInt(zoom * 100);
    1550            jQuery('#zoom ').val(zoom);
    1551            set_cl();
    1552 
    1553 
    1554            //  --- réglage de la hauteur de page en fonction du copyright-----------
    1555            if (typeof (pos_copyright) == "undefined") pos_copyright = jQuery("#copyright").infos();
    1556 
    1557            if (theme.match(RegExp("stripped", "gi"))) {
    1558              var TitleBox = jQuery("#imageTitleContainer");
    1559              if (TitleBox.length != 0) TitleBox.css("width", img_finale.width + "px");
    1560            } else {
    1561 
    1562            }
    1563 
    1564 
    1565            /*
    1566            if (!theme.match(RegExp("luciano", "gi"))) {
    1567            jQuery("#linkNext").css({ height: "80px", width: "200px", overflow: "hidden" });
    1568            jQuery("#linkPrev").css({ height: "80px", width: "200px", overflow: "hidden" });
    1569            jQuery(".navThumb img").css({ height: "80px", width: "", overflow: "hidden" });
    1570            }
    1571            */
    1572            infos_frame = jQuery(Cadre).infos();
    1573            if (theme.match(RegExp("stripped", "gi"))) {
    1574              /*
    1575              infos_theImageBox = jQuery("#theImageAndTitle").infos();
    1576              p1 = jQuery(".randomButtons").infos();
    1577              p2 = jQuery("#imageHeaderBar").infos();
    1578              p3 = infos_content.top;
    1579              p1 = options.imageAutosizeTitle;
    1580 
    1581              jQuery("#theImage").width("width", infos_theImageBox.width + "px");
    1582              //jQuery("#theImageAndTitle").css("position", "relative");
    1583              jQuery("#content").css({ position: "relative", top: "10px", marginTop: "0px",
    1584              paddingTop: "0px", textAalign: "center", marginLeft: "auto"
    1585              });
    1586 
    1587              jQuery("#theImageAndTitle").css({ position: "relative", top: "0px", marginTop: "0px",
    1588              paddingTop: "0px", marginLeft: "auto"
    1589              }); */
    1590              t1 = infos_theImageBox.top;
    1591              l1 = infos_theImageBox.left;
    1592              // infos_theImageBox = jQuery(Parent).infos();
    1593 
    1594            } else {
    1595 
    1596              t1 = infos_frame.top;
    1597              l1 = infos_frame.left;
    1598              infos_theImageBox = jQuery(Parent).infos(); //theImage
    1599            }
    1600            infos_theImageBox.margin.margin = infos_frame.margin.margin;
    1601            infos_theImageBox.top = t1;
    1602            infos_theImageBox.left = l1;
    1603            //  infos_theImageBox.position = "absolute";
    1604 
    1605            Window_Affichage = infos_theImageBox;
    1606            if (DEBUG_autosize == "_true") {
    1607              //   jQuery(Cadre).css("border", "solid green");
    1608 
    1609              jQuery("#Debug5").css({ background: "red",
    1610                position: "absolute",
    1611                border: "green solid 2px",
    1612                textAlign: align_auto,
    1613                margin: "auto",
    1614                top: Window_Affichage.top + "px",
    1615                left: Window_Affichage.left + "px",
    1616                width: Window_Affichage.width + "px",
    1617                height: Window_Affichage.height + "px"
    1618              }); //red
    1619              jQuery("#Debug4").css({ top: infos_frame.bottom - infos_description.height + "px" }); //green
    1620            }
    1621 
    1622            //Wait_Affichage();
    1623 
    1624            return true;
    1625            //_____________________________________________________
    1626          } // Resize();
    1627 
    1628 
    1629          //======================================================================
    1630 
    1631 
    1632        });            // fin extend
    1633 
    1634 
    1635 
    1636      } // function
    1637 );
    1638 
    1639 
    1640 /*
    1641 * recherche la plus grande image (hauteur ou largeur)
    1642 */
    1643 function Get_Img_Maxi(myobj) {
    1644     var w00 = 0;
    1645     var myImg = null;
    1646  
    1647     img = jQuery("#theMainImage");
    1648     if (img != null) {
    1649       return;
    1650 
    1651     } 
    1652      img = jQuery(myobj);
    1653 
    1654     img = jQuery('img[alt]');
    1655 
    1656     jQuery(myobj).each(function (i) {
     1304          };
     1305        }
     1306        jQuery("#window_height").val(Window_Affichage.height);
     1307        jQuery("#window_width").val(Window_Affichage.width);
     1308
     1309        jQuery("#ret_autosize").trigger('ON', {
     1310          width: img_w,
     1311          height: img_h,
     1312          theImage: theMainImage_obj,
     1313          src_img: src_img,
     1314          window_height: Window_Affichage.height,
     1315          window_width: Window_Affichage.width
     1316        });
     1317      }
     1318    } // Wait_affichage
     1319
     1320
     1321
     1322
     1323
     1324    /*****************************************************
     1325    * recherche la plus grande image (hauteur ou largeur)
     1326    *****************************************************/
     1327    Get_Img_Maxi = function (myobj) {
     1328      var w00 = 0;
     1329      var myImg = null;
     1330
     1331      img = jQuery(theMainImage_obj);
     1332      if (img != null) {
     1333        return;
     1334
     1335      }
     1336      img = jQuery(myobj);
     1337
     1338      img = jQuery('img[alt]');
     1339
     1340      jQuery(myobj).each(function (i) {
    16571341        w0 = img_reelle.width;
    16581342        h0 = img_reelle.height;
    16591343        if (h0 > w0) w0 = h0;
    16601344        if (w0 > w00) {
    1661             if (!this.src.match(RegExp(".png", "g")))
    1662                 if (!this.src.match(RegExp(thumbnail, "g"))) {
    1663                     myImg = this;
    1664                     jQuery( myImg).addClass("Image");
    1665                     w00 = w0;
    1666                 }
    1667 
    1668         }
    1669     });
    1670     return myImg;
    1671 }
    1672 
    1673 //============================================================
    1674 /*
    1675 *
    1676 */
    1677 
    1678 function infos_entete(Parent) {
    1679 
    1680     infos_imageToolBar = jQuery("#imageToolBar").infos();
    1681     if (typeof (marge_top) != "undefined") return result;
    1682 
    1683     if (infos_imageToolBar.position == "absolute") {
     1345          if (!this.src.match(RegExp(".png", "g")))
     1346            if (!this.src.match(RegExp(thumbnail, "g"))) {
     1347              myImg = this;
     1348              jQuery(myImg).addClass("Image");
     1349              w00 = w0;
     1350            }
     1351
     1352        }
     1353      });
     1354      return myImg;
     1355    } // Get_Img_Maxi
     1356
     1357
     1358    /*************************************************************
     1359    *
     1360    **************************************************************/
     1361    infos_entete = function () {
     1362      infos_imageToolBar = jQuery("#imageToolBar").infos();
     1363      if (typeof (marge_top) != "undefined") return result;
     1364
     1365      if (infos_imageToolBar.position == "absolute") {
    16841366        jQuery("#imageToolBar").css("position", "relative");
    16851367        jQuery("#imageToolBar").css("top", 0 + "px");
    1686     }
    1687     optiontop = 0;
    1688 
    1689 
    1690     infos_imageInfoBar = jQuery("#imageInfoBar").infos();
    1691 
    1692     jQuery("#" + "theImgContainer").css("marginTop", "0px");
    1693     infos_thePicturePage = jQuery("#thePicturePage").infos();
    1694     infos_theImage = jQuery(Parent).infos();
    1695     if (theme.match(RegExp("stripped", "gi"))) {
     1368      }
     1369      optiontop = 0;
     1370      infos_imageInfoBar = jQuery("#imageInfoBar").infos();
     1371      jQuery("#" + "theImgContainer").css("marginTop", "0px");
     1372      infos_thePicturePage = jQuery("#thePicturePage").infos();
     1373      infos_theImage = jQuery("#theImage").infos();
     1374      if (theme.match(RegExp("stripped", "gi"))) {
    16961375        infos_theImageAndTitle = jQuery("#theImageAndTitle").infos();
    16971376        infos_theImageBox = jQuery("#theImageBox").infos();
    16981377        optiontop = (marges_llgbo / 2) + infos_theImageAndTitle.margin.top;
    1699     }
    1700 
    1701     if (infos_theImage.position == "relative") {
     1378      }
     1379
     1380      if (infos_theImage.position == "relative") {
    17021381        //--- passage relative ==> static ===/
    1703         jQuery(Parent).css("position", "static");
    1704         infos_theImage = jQuery(Parent).infos();
    1705 
    1706     } else {
    1707 
    1708     }
    1709     if (infos_theImage.position == "absolute") {
     1382        jQuery("#theImage").css("position", "static");
     1383        infos_theImage = jQuery("#theImage").infos();
     1384
     1385      } else {
     1386
     1387      }
     1388      if (infos_theImage.position == "absolute") {
    17101389        //--- passage absolute ==> static ===/
    1711         jQuery(Parent).css("position", "static");
    1712         infos_theImage = jQuery(Parent).infos();
    1713 
    1714     }
    1715 
    1716     marge_top = Math.ceil(infos_the_page.top +
    1717                                      infos_the_page.borderwidth.top +
    1718                                      infos_theImage.borderwidth.top +
    1719                                      infos_thePicturePage.margin.top
    1720                                      );
    1721 
    1722     img_top = Math.ceil(infos_theImage.top +
    1723                         infos_theImage.padding.top +
    1724                         infos_theImage.borderwidth.top +
    1725                         infos_thePicturePage.margin.top + optiontop);
    1726     result = infos_imageToolBar;
    1727    // result.width = "20%";
    1728    // result.left = "40%";
    1729     result.marge_top = marge_top;
    1730     result.img_top = img_top;
    1731     //=== Afficher le titre de l'image sur le cadre ===
    1732 
    1733 
    1734     if (infos_llgboh2.top > 0) {
    1735       result.img_top = infos_llgboh2.top;
    1736 
    1737     }
    1738     else if (marges_llgbo > 0) {
    1739       result.img_top -= (8);
    1740     }
    1741  
    1742     return result;
    1743 
    1744 }
    1745 
    1746 /* Récupère les informations sur la description.
    1747 *
    1748 */
    1749 type_src = "div";
    1750 old_window = { width: 0, height: 0 };
    1751 List_autosize = new Array();
    1752 nu_img = 0;
    1753 tempo = 0;
    1754 //====================================================
    1755 function infos_Description_f(Parent) {
    1756    // jQuery(Parent).css({ display: "block" });
    1757     //====== détection du type d'images ======
    1758     if (jQuery("#charlie").length > 0) {
    1759       Type_Img = "charlie";
    1760     }else    if (jQuery("#Panorama").length) {
     1390        jQuery("#theImage").css("position", "static");
     1391        infos_theImage = jQuery("#theImage").infos();
     1392
     1393      }
     1394
     1395      marge_top = Math.ceil(infos_the_page.top +
     1396                                             infos_the_page.borderwidth.top +
     1397                                             infos_theImage.borderwidth.top +
     1398                                             infos_thePicturePage.margin.top
     1399                                             );
     1400
     1401      img_top = Math.ceil(infos_theImage.top +
     1402                                infos_theImage.padding.top +
     1403                                infos_theImage.borderwidth.top +
     1404                                infos_thePicturePage.margin.top + optiontop);
     1405      result = infos_imageToolBar;
     1406      // result.width = "20%";
     1407      // result.left = "40%";
     1408      result.marge_top = marge_top;
     1409      result.img_top = img_top;
     1410      //=== Afficher le titre de l'image sur le cadre ===
     1411
     1412
     1413      if (infos_llgboh2.top > 0) {
     1414        result.img_top = infos_llgboh2.top;
     1415
     1416      }
     1417      else if (marges_llgbo > 0) {
     1418        result.img_top -= (8);
     1419      }
     1420      return result;
     1421    } // infos_entete
     1422    /*************************************************
     1423    * Récupère les informations sur la description.
     1424    *
     1425    *************************************************/
     1426    infos_Description_f = function () {
     1427      // jQuery("#theImage").css({ display: "block" });
     1428      //====== détection du type d'images ======
     1429      if (jQuery("#charlie").length > 0) {
     1430        Type_Img = "charlie";
     1431      } else if (jQuery("#Panorama").length) {
    17611432        Type_Img = "panorama";
    1762     } else if (jQuery("#pamoorama").length) {
     1433      } else if (jQuery("#pamoorama").length) {
    17631434        Type_Img = "pamoorama";
    1764      } else if (jQuery("#map").length) {
     1435      } else if (jQuery("#map").length) {
    17651436        Type_Img = "map";
    1766      } else if (jQuery("#Panorama").length) {
     1437      } else if (jQuery("#Panorama").length) {
    17671438        Type_Img = "panorama";
    1768     } else  if ( (jQuery(Parent + " iframe").length + jQuery(Parent + " object").length + jQuery(Parent + " embed").length ) > 0) {
    1769  
    1770     if (jQuery(Parent + " object").length > 0) {     
    1771 
    1772         type_src = "object";
    1773 
    1774     } else if (jQuery(Parent + " embed").length > 0) {
    1775 
    1776         type_src = "embed";
    1777 
    1778     } else {
    1779 
    1780         type_src = "iframe";
    1781     }
    1782         nbf = jQuery(Parent + " " + type_src).length;
    1783         frm1 = jQuery(Parent + " " + type_src).get(0) ;
     1439      } else if ((jQuery("#theImage" + " iframe").length + jQuery("#theImage" + " object").length + jQuery("#theImage" + " embed").length) > 0) {
     1440
     1441        if (jQuery("#theImage" + " object").length > 0) {
     1442
     1443          type_src = "object";
     1444
     1445        } else if (jQuery("#theImage" + " embed").length > 0) {
     1446
     1447          type_src = "embed";
     1448
     1449        } else {
     1450
     1451          type_src = "iframe";
     1452        }
     1453        nbf = jQuery("#theImage" + " " + type_src).length;
     1454        frm1 = jQuery("#theImage" + " " + type_src).get(0);
    17841455        Type_Img = "charlie";
    17851456
    17861457        //'fb - xfbml - like - button
    17871458
    1788         objs = jQuery(Parent + " div").get(0);
     1459        objs = jQuery("#theImage" + " div").get(0);
    17891460        if (jQuery(objs).length > 0) {
    1790           id_0 = jQuery(objs).attr("id");     
    1791         if (id_0 == "") {
    1792           jQuery(objs).attr("id", "charlie");
     1461          id_0 = jQuery(objs).attr("id");
     1462          if (id_0 == "") {
     1463            jQuery(objs).attr("id", "charlie");
     1464          } else {
     1465            if (nbf > 1) {
     1466              jQuery(frm1).attr("id", "charlie");
     1467            } else {
     1468              Type_Img = "img";
     1469            }
     1470          }
    17931471        } else {
    1794           if (nbf > 1) {
    1795             jQuery(frm1).attr("id", "charlie");
    1796           } else {
    1797             Type_Img = "img";
    1798           }           
    1799         }
    1800         } else {
    1801          jQuery(frm1).attr("id", "charlie");
    1802         }
    1803        
    1804 
    1805     } else if (jQuery(Parent).find("img").length > 0) {
     1472          jQuery(frm1).attr("id", "charlie");
     1473        }
     1474
     1475
     1476      } else if (jQuery("#theImage").find("img").length > 0) {
    18061477        Type_Img = "img";
    1807     } else if (jQuery(Parent + "Box").find("img").length > 0) {
     1478      } else if (jQuery("#theImage" + "Box").find("img").length > 0) {
    18081479        Type_Img = "img";
    18091480        Parent = Parent + "Box";
    1810     } else if (jQuery("img").length > 0) {
     1481      } else if (jQuery("img").length > 0) {
    18111482        Type_Img = "img_autre";
    18121483        return;
    1813     } else {
     1484      } else {
    18141485        return;
    1815     }
    1816       //=========================================================
     1486      }
     1487      //===============  CHARLIE ==============================
    18171488      if (jQuery("#charlie").length > 0) {
    18181489        jQuery("#charlie").css({
     
    18231494        });
    18241495
    1825       }
    1826     // jQuery(Parent + " p:not(:contains(' ')) ").remove();
    1827     // jQuery(Parent + " p:(:contains('')) ").remove();
    1828      
    1829       jQuery("#llgbo").trigger("ON");
    1830       llgboframe = infos_llgbo;
    1831 
    1832     marges_llgbo = 0;
    1833 
    1834     if (llgboframe.height > 0) {
    1835       marges_llgbo = llgboframe.borderwidth.left * 2;
    1836 
    1837     }
    1838 
    1839       Bandeau_t = infos_entete(Parent);
    1840 
    1841     Bandeau = Bandeau_t.img_top;
    1842     infos_theImgContainer = jQuery("#" + "theImgContainer").infos();
    1843     infos_description = jQuery("#" + "description").infos();
    1844     //=============================================================================
    1845     //   jQuery(Parent + " p").css({ padding: "0px", margin: "0px "    });
    1846     if (theme.match(RegExp("simple", "gi"))) {
    1847         jQuery(Parent).css({ padding: "0px",
    1848             marginLeft: "0px",
    1849             marginRight: "auto",
    1850             marginTop: "0px",
    1851             marginBottom: "0px"
     1496      }
     1497      //================ LLGBO ======================
     1498      marges_llgbo = 0;
     1499      if (jQuery("#llgbo").length > 0) {
     1500        jQuery("#llgbo").trigger("ON");
     1501        if (infos_llgbo.height > 0) {
     1502          marges_llgbo = infos_llgbo.borderwidth.left * 2;
     1503        }
     1504      }
     1505
     1506      Bandeau_t = infos_entete();
     1507      Bandeau = Bandeau_t.img_top;
     1508      infos_theImgContainer = jQuery("#" + "theImgContainer").infos();
     1509      infos_description = jQuery("#" + "description").infos();
     1510      //=============================================================================
     1511      //   jQuery("#theImage" + " p").css({ padding: "0px", margin: "0px "    });
     1512      if (theme.match(RegExp("simple", "gi"))) {
     1513        jQuery("#theImage").css({ padding: "0px",
     1514          marginLeft: "0px",
     1515          marginRight: "auto",
     1516          marginTop: "0px",
     1517          marginBottom: "0px"
    18521518
    18531519        });
    1854     }
    1855 
    1856 
    1857     if (theme.match(RegExp("luciano", "g"))) {
     1520      }
     1521
     1522
     1523      if (theme.match(RegExp("luciano", "g"))) {
    18581524        jQuery("#imageContainer").css({ height: "auto" });
    1859         The_MainImage = jQuery(Parent + " #theImg img");
    1860         infos_img = jQuery(The_MainImage).infos();
    1861 
    1862 
    1863     } else if (Type_Img == "map") {
     1525        theMainImage_obj = "#theImage" + " #theImg img";
     1526        infos_img = jQuery(theMainImage_obj).infos();
     1527
     1528
     1529      } else if (Type_Img == "map") {
    18641530
    18651531        infos_map = jQuery("#mapPicture").infos();
     
    18671533
    18681534        jQuery("#map").css({ left: marge_left + "px", padding: "0px",
    1869             marginLeft: "0px",
    1870             marginRight: "4px",
    1871             marginTop: "0px",
    1872             marginBottom: "0px",
    1873             position: "relative"
     1535          marginLeft: "0px",
     1536          marginRight: "4px",
     1537          marginTop: "0px",
     1538          marginBottom: "0px",
     1539          position: "relative"
    18741540        });
    18751541
    1876         The_MainImage = jQuery("#map");
    1877         infos_img = jQuery(The_MainImage).infos();
     1542        theMainImage_obj = "#map";
     1543        infos_img = jQuery(theMainImage_obj).infos();
    18781544
    18791545
     
    18871553        }
    18881554
    1889         if (tp!=undefined) {
     1555        if (tp != undefined) {
    18901556          if (obj_charlie.length > 0)
    18911557            tp = jQuery("object").attr("type") || jQuery("object").prop("type");
     
    18941560        }
    18951561
    1896      if (tp == 'application/x-shockwave-flash') {
     1562        if (tp == 'application/x-shockwave-flash') {
    18971563          jQuery("#charlie").css({
    18981564            paddingTop: "0px",
     
    19021568          });
    19031569        } else {
    1904        
    1905         }
    1906 
    1907         var MainImage = jQuery("#theMainImage");
     1570
     1571        }
     1572
     1573        var MainImage = jQuery(theMainImage_obj);
    19081574
    19091575        if (MainImage.length == 0) {
    1910           The_MainImage = jQuery("#charlie");
    1911           infos_img = jQuery(The_MainImage).infos();
     1576          theMainImage_obj = "#charlie";
     1577          infos_img = jQuery(theMainImage_obj).infos();
    19121578        } else {
    1913           The_MainImage = jQuery("#theMainImage");
    1914           infos_img = jQuery(The_MainImage).infos();
    1915          
    1916         }
    1917  
    1918  
    1919     } else if (jQuery(Parent + " embed").length > 0) {
    1920     if (jQuery("#theMainImage").lenght == 0) {
    1921       The_MainImage = jQuery(Parent + " embed");
    1922       infos_img = jQuery(The_MainImage).infos();
    1923       jQuery(Parent + " embed").width({ width: infos_img.width + "px", height: infos_img.height + "px" });
    1924     } else {
    1925       The_MainImage = jQuery("#theMainImage");
    1926       infos_img = jQuery(The_MainImage).infos();
    1927       Type_Img == "charlie"
    1928       if (infos_img.width == 0) {
    1929         The_MainImage = jQuery("#theMainImage");
    1930         infos_img = jQuery(The_MainImage).infos();
    1931 
    1932       }
    1933     }
    1934 
    1935     } else if (Type_Img == "pamoorama") {
     1579
     1580          infos_img = jQuery(theMainImage_obj).infos();
     1581
     1582        }
     1583
     1584
     1585      } else if (jQuery("#theImage" + " embed").length > 0) {
     1586        if (jQuery(theMainImage_obj).lenght == 0) {
     1587          theMainImage_obj = "#theImage" + " embed";
     1588          infos_img = jQuery(theMainImage_obj).infos();
     1589          jQuery("#theImage" + " embed").width({ width: infos_img.width + "px", height: infos_img.height + "px" });
     1590        } else {
     1591
     1592          infos_img = jQuery(theMainImage_obj).infos();
     1593          Type_Img == "charlie"
     1594          if (infos_img.width == 0) {
     1595
     1596            infos_img = jQuery(theMainImage_obj).infos();
     1597
     1598          }
     1599        }
     1600
     1601      } else if (Type_Img == "pamoorama") {
    19361602        if (!nopano) {
    1937             Wait_pamoorama();
    1938             return infos_description;
    1939         }
    1940         The_MainImage = jQuery("#pamoorama");
    1941         infos_img = jQuery(The_MainImage).infos();
     1603          Wait_pamoorama();
     1604        }
     1605        infos_img = jQuery(theMainImage_obj).infos();
    19421606        infos_footer = jQuery("#pamoorama_footer").infos();
    1943         infos_img.height = parseInt(img_reelle.height) + parseInt(infos_footer.height);
     1607
     1608        infos_img.height += parseInt(infos_img.height) + parseInt(infos_footer.height);
    19441609
    19451610      } else {
    1946         var MainImage = jQuery("#theMainImage");
     1611        var MainImage = jQuery(theMainImage_obj);
    19471612
    19481613        if (MainImage.length == 0) {
    1949           The_MainImage = jQuery(Parent + " img[alt]");
     1614          theMainImage_obj = "#theImage" + " img[alt]";
    19501615        } else {
    1951           The_MainImage = MainImage;   
    1952         }
    1953 
    1954      
    1955         if (!The_MainImage)
    1956             The_MainImage = jQuery(Parent);   // sans img ??
    1957         if (The_MainImage.length > 1) {
    1958         The_MainImage = The_MainImage[0];
    1959           }
    1960 
    1961         infos_img = jQuery(The_MainImage).infos();
    1962     }
    1963     //=====================================================================================
    1964 
    1965     switch (infos_img.position) {
     1616
     1617        }
     1618
     1619
     1620        if (!theMainImage_obj)
     1621          theMainImage_obj = "#theImage";   // sans img ??
     1622
     1623        infos_img = jQuery(theMainImage_obj).infos();
     1624      }
     1625      //=====================================================================================
     1626
     1627      switch (infos_img.position) {
    19661628        case "relative":
    1967             break;
     1629          break;
    19681630        case "static":
    1969             break;
     1631          break;
    19701632        case "absolute":
    1971             break;
     1633          break;
    19721634        case "":
    1973             break;
     1635          break;
    19741636        default:
    1975             break;
    1976     }
    1977 
    1978     infos_description.marge = {
     1637          break;
     1638      }
     1639
     1640      infos_description.marge = {
    19791641        bottom: infos_img.padding.bottom + infos_img.margin.bottom + infos_img.borderwidth.bottom,
    19801642        top: infos_img.padding.top + infos_img.borderwidth.top + infos_img.margin.top
    1981     }
    1982 
    1983     if (llgboframe.height > 0) infos_img = llgboframe; // format de l'image+largeur du cadre
    1984 
    1985     if (theme.match(RegExp("luciano", "g"))) {
     1643      }
     1644
     1645      if (infos_llgbo.height > 0) infos_img = infos_llgbo; // format de l'image+largeur du cadre
     1646
     1647      if (theme.match(RegExp("luciano", "g"))) {
    19861648
    19871649        infos_theImgContainer = jQuery("#imageContainer").infos();
     
    19911653
    19921654        if (infos_slidshowToolBar.height > 0) {
    1993             correction = (infos_slidshowToolBar.height);
    1994             infos_description.top = infos_img.bottom;
    1995             infos_description.bottom = jQuery("#copyright").infos().top;
     1655          correction = (infos_slidshowToolBar.height);
     1656          infos_description.top = infos_img.bottom;
     1657          infos_description.bottom = jQuery("#copyright").infos().top;
    19961658        }
    19971659
    19981660        //=========================================================
    1999     } else if (theme.match(RegExp("stripped", "gi"))) {
     1661      } else if (theme.match(RegExp("stripped", "gi"))) {
    20001662        //options.imageAutosize
    2001           //options.imageMargin
    2002           jQuery("#content").css({paddingTop:"5px"});
    2003     infos_content = jQuery("#content").infos();
     1663        //options.imageMargin
     1664        jQuery("#content").css({ paddingTop: "5px" });
     1665        infos_content = jQuery("#content").infos();
    20041666        if (options.imageAutosizeTitle == false) {
    2005             infos_description.top =   infos_theImageBox.bottom ;
    2006 
    2007             infos_description.bottom =infos_HeaderBar.margin.top+ infos_description.top +
    2008                                     infos_description.borderwidth.top +
    2009                                     infos_description.borderwidth.bottom +
    2010                                       options.imageAutosizeMargin*2 +
    2011                                     (marges_llgbo / 2)+4;
     1667          infos_description.top = infos_theImageBox.bottom;
     1668
     1669          infos_description.bottom = infos_HeaderBar.margin.top + infos_description.top +
     1670                                            infos_description.borderwidth.top +
     1671                                            infos_description.borderwidth.bottom +
     1672                                              options.imageAutosizeMargin * 2 +
     1673                                            (marges_llgbo / 2) + 4;
    20121674
    20131675        } else {
    20141676
    20151677
    2016             infos_description.top = infos_theImageBox.bottom -
    2017                         infos_content.top +
    2018                         options.imageAutosizeMargin * 2 +
    2019                         (marges_llgbo / 2)
    2020                                 ;
    2021             infos_description.bottom = jQuery("#tabZone").infos().top +
    2022                         infos_theImageAndTitle.margin.top;
    2023            if (msie == true) infos_description.bottom -= 4;
     1678          infos_description.top = infos_theImageBox.bottom -
     1679                                infos_content.top +
     1680                                options.imageAutosizeMargin * 2 +
     1681                                (marges_llgbo / 2)
     1682                                        ;
     1683          infos_description.bottom = jQuery("#tabZone").infos().top +
     1684                                infos_theImageAndTitle.margin.top;
     1685          if (msie == true) infos_description.bottom -= 4;
    20241686        };
    20251687        check_desc_v = true;
     
    20301692        }
    20311693        infos_description.bottom = infos_theImage.bottom; //482
    2032         infos_description.top = infos_img.height + infos_theImage.top ; //410+62
     1694        infos_description.top = infos_img.height + infos_theImage.top; //410+62
    20331695        // infos_description.bottom -= infos_img.top;
     1696      }
     1697      //
     1698
     1699      infos_description.height = infos_description.bottom - infos_description.top;
     1700
     1701      if (check_desc_v == false) {
     1702        infos_description.height = 0;
     1703      }
     1704
     1705      Debug_pos();
     1706
     1707      //cl_visible=false ;
     1708      return infos_description;
     1709    } //infos_Description_f
     1710
     1711    //=======================================================================================
     1712    Debug_info = function (index, infos, nom) {
     1713      if (infos.height > 0) {
     1714        message = browser.browser + " -- > Info : " + nom + " " + infos.id + "\n" +
     1715                         "Info nodeName: " + infos.nodeName + "\n" +
     1716                         "Info width: " + infos.width + "\n" +
     1717                         "Info height: " + infos.height + "\n" +
     1718                         "Info top: " + infos.top + "\n" +
     1719                         "Info left: " + infos.left + "\n" +
     1720                         "Info position: " + infos.position + "\n";
     1721        myDebug = { id: "Debug" + index, texte: message,
     1722          css: {
     1723            color: "black",
     1724            opacity: "0.5",
     1725            position: "absolute",
     1726            height: infos.height || 100 + "px",
     1727            width: infos.width || 300 + "px",
     1728            left: infos.left || 0 + "px",
     1729            border: "solid 1px green",
     1730            top: infos.top + "px"
     1731          }
     1732        }
     1733        return myDebug;
     1734      } else {
     1735        if (typeof old_messages == "undefined") {
     1736          old_messages = new Array();
     1737
     1738        }
     1739        if (infos != "" && infos != "undefined") {
     1740          nc0 = old_messages[index];
     1741
     1742          if (typeof nc0 != "undefined") {
     1743            nc0 = old_messages[index].toString().split("<br />");
     1744            if (nc0.length > 3) nc0.shift();
     1745
     1746            old_messages[index] = nc0.join("<br />");
     1747          }
     1748          old_messages[index] += " : " + nom + " -- > " + infos + "<br />";
     1749
     1750          message = browser.browser + old_messages[index];
     1751
     1752          myDebug = { id: "Debug" + index, texte: message,
     1753            css: {
     1754              color: "black",
     1755              opacity: "1.0",
     1756              position: "absolute",
     1757              align: "left",
     1758              height: 100 + "px",
     1759              width: 800 + "px",
     1760              left: 300 + "px",
     1761              border: "solid 1px green",
     1762              top: 0 + "px"
     1763            }
     1764          }
     1765        }
     1766
     1767        return myDebug;
     1768      }
     1769
     1770
    20341771    }
    2035     //
    2036 
    2037     infos_description.height =   infos_description.bottom - infos_description.top;
    2038 
    2039     if (check_desc_v == false) {
    2040         infos_description.height = 0;
    2041     }
    2042 
    2043     Debug_pos();
    2044 
    2045     //cl_visible=false ;
    2046     return infos_description;
    2047 }
    2048 
    2049 //====================================================
    2050 function Debug_info(index, infos, nom) {
    2051 
    2052     if (infos.height > 0) {
    2053 
    2054         message = browser.browser + " -- > Info : " + nom + " " + infos.id + "\n" +
    2055                  "Info nodeName: " + infos.nodeName + "\n" +
    2056                  "Info width: " + infos.width + "\n" +
    2057                  "Info height: " + infos.height + "\n" +
    2058                  "Info top: " + infos.top + "\n" +
    2059                  "Info left: " + infos.left + "\n" +
    2060                  "Info position: " + infos.position + "\n";
    2061 
    2062         myDebug = { id: "Debug" + index, texte: message,
    2063             css: {
    2064                 color: "black",
    2065                 opacity: "0.5",
    2066                 position: "absolute",
    2067                 height: infos.height || 100 + "px",
    2068                 width: infos.width || 300 + "px",
    2069                 left: infos.left || 0 + "px",
    2070                 border: "solid 1px green",
    2071                 top: infos.top + "px"
    2072 
    2073             }
    2074         }
    2075         return myDebug;
    2076     } else {
    2077         return null;
    2078     }
    2079 
    2080 
    2081 }
    2082 //====================================================
    2083 function Debug_pos() {
    2084   return;
    2085     if (DEBUG_autosize == "true") {
     1772    //====================================================
     1773    function Debug_pos() {
     1774      return;
     1775      if (DEBUG_autosize == "true") {
    20861776
    20871777        jQuery("[id ^='Debug']").show();
     
    20951785
    20961786        affiche_debug({
    2097             Debug1: Debug_info(1, Bandeau_t, "Bandeau_t"),
    2098             Debug4: Debug_info(4, infos_description, "infos_description"),
    2099             Debug5: Debug_info(5, infos_img, "infos_img")
     1787          Debug1: Debug_info(1, Bandeau_t, "Bandeau_t"),
     1788          Debug4: Debug_info(4, infos_description, "infos_description"),
     1789          Debug5: Debug_info(5, infos_img, "infos_img")
    21001790        });
     1791      }
    21011792    }
    2102 }
    2103 
    2104 function affiche_debug(aff_infos) {
    2105     jQuery(jQuery("[id ^='Debug']")).each(function (i) {
     1793    //==========================================================
     1794    affiche_debug = function (aff_infos) {
     1795      jQuery(jQuery("[id ^='Debug']")).each(function (i) {
    21061796        if (aff_infos[this.id]) {
    2107             if (aff_infos[this.id].css) {
    2108                 jQuery("#" + this.id).css(aff_infos[this.id].css);
    2109                 jQuery("#" + this.id).text(aff_infos[this.id].texte);
    2110             }
    2111         }
    2112     });
    2113     return;
    2114 
    2115 }
    2116 
    2117 
    2118 
    2119 
    2120 jQuery(function () {
    2121   jQuery('#pamoorama').live('ON', function (e) {
    2122     jQuery(jQuery('.debug').get(1)).trigger('ON');
    2123     if (typeof Bandeau_bas == "undefined" || Bandeau_bas.width == 0) {
    2124       Bandeau_bas = infos_Description_f(Parent);
    2125       Bandeau = Bandeau_bas.top;
    2126       old_window = { width: 0, height: 0 };
    2127       jQuery(window).resize();
    2128 
     1797          if (aff_infos[this.id].css) {
     1798            jQuery("#" + this.id).css(aff_infos[this.id].css);
     1799            jQuery("#" + this.id).html(aff_infos[this.id].texte);
     1800          }
     1801        }
     1802      });
     1803      return;
    21291804    }
    2130 
    2131   });
    2132   //=============================================================
    2133 
    2134 
    2135   jQuery("#infoSwitcher").click(function () {
    2136     jQuery("#llgbo").trigger("ON");
    2137     jQuery("#theImage").css({ textAlign: "center" });
    2138     nds = jQuery("#imageInfos").css("display");
    2139 
    2140     Zone_image = Calcul_Image(nds != "none");
    2141     jQuery("#theMainImage").width(Zone_image.image.width);
    2142     jQuery("#theMainImage").height(Zone_image.image.height);
    2143 
    2144     jQuery("#theImage").width(Zone_image.container.width);
    2145     jQuery("#theImage").height(Zone_image.container.height);
    2146     Set_Map(nds);
    2147 
    2148   });
    2149 
    2150   jQuery('#ret_autosize').live('ON', function (e) {
    2151     if (nu_img == "") nu_img = 8;
    2152     jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
    2153 
    2154   });
    2155 
    2156 
    2157   jQuery("#reset").click(function () {
    2158     location.reload();
    2159   });
    2160 
    2161   //=====================================================================
    2162   // jQuery("#llgbo").trigger("ON");
    2163   jQuery("#llgbo").live('ON', function (e) {
    2164     infos_llgbo = jQuery("#llgbo").infos();
    2165     //llgboframe
    2166     marges_llgbo = 0;
    2167 
    2168     if (infos_llgbo.height > 0) {
    2169       ll2 = jQuery("#llgbo div:last").infos();
    2170       ll1 = jQuery("#llgbo div:first").infos();
    2171       ll2 = "";
    2172       jQuery("#llgbo div").each(function (i) {
    2173         if (this.id == "") return;
    2174         var llgbo_frame = document.getElementById(this.id);
    2175         this.removeAttribute("width");
    2176         this.removeAttribute("height");
    2177         ll2 = this;
     1805    //===========================================
     1806    //
     1807    //===========================================
     1808    Set_Map = function (nds) {
     1809      p0 = jQuery("#map").position();
     1810      if (!p0) return;
     1811
     1812      infos_map = jQuery("#map").infos();
     1813      // if (infos_map.width == (Zone_image.container.width - p0.left))   return ;
     1814      nds = jQuery("#imageInfos").css("display");
     1815      if (nds != "none") {
     1816        p2 = jQuery("#infoSwitcher").infos();
     1817        p0.left += 35;
     1818      }
     1819      jQuery("#map").width(Zone_image.container.width - p0.left);
     1820      jQuery("#map").css({ position: "absolute", height: Zone_image.container.height + "px" });
     1821    }
     1822    //=====================================
     1823    //
     1824    //=====================================
     1825    theImage_init = function (Obj) {
     1826      if (jQuery("#derivativeSwitchBox").length > 0) {
     1827        id3 = jQuery("#derivativeCheckedAutosize");
     1828
     1829
     1830        var pi = jQuery("#derivativeSwitchBox > span ");
     1831        var px = jQuery(".derivativeSizeDetails ");
     1832
     1833        i = 0;
     1834        n = 0;
     1835        var pt = new Array();
     1836        jQuery("#derivativeSwitchBox a").each(function (i) {
     1837          href_path = jQuery(this).attr("href");
     1838          if (href_path.match(RegExp("auto", "gi"))) return true;
     1839          pt[i] = href_path.split("'");
     1840        });
     1841
     1842        th = jQuery(window).height();
     1843        tw = jQuery(window).width();
     1844
     1845        nds = jQuery("#imageInfos").css("display"); //inline-block
     1846        Zone_image = Calcul_Image(false);
     1847        n0 = 0;
     1848        n1 = 0;
     1849        t0 = 0;
     1850        th = th - Zone_image.top;
     1851        tw = Zone_image.container.width;
     1852        th = Zone_image.container.height;
     1853        n = 0;
     1854
     1855        jQuery(".derivativeSizeDetails").each(function (i) {
     1856          vn = jQuery(this).text().replace("(", "").replace(")", "").split("x");
     1857          h0 = parseInt(vn[1]);
     1858          w0 = parseInt(vn[0])
     1859          if (h0 > th) {
     1860            n = i;
     1861            return false;
     1862          }
     1863          if (w0 > tw) {
     1864            n = i;
     1865            return false;
     1866          }
     1867          n++;
     1868        });
     1869
     1870
     1871        if (n > pt.length - 1) n = pt.length - 1; // format le plus grand
     1872        if (n < 0) n = 0; // format le plus grand
     1873
     1874
     1875
     1876        id_en_cours = pt[n][1];
     1877        last_map = pt[n][5];
     1878        var theImg = document.getElementById("theMainImage");
     1879
     1880        if (id3.length > 0) {
     1881          if (theImg.useMap.match(RegExp("map", "gi"))) return true;
     1882              changeImgSrc(id_en_cours, last_map, "Autosize");
     1883        } else {
     1884
     1885          new_html = '<br /><span class="switchCheck" id="derivativeCheckedAutosize" style="visibility:hidden" >&#x2714; </span>';
     1886          new_html += '<a href="javascript:changeImgSrc(\'' + id_en_cours + '\', \'' + last_map + '\', \'Autosize\') ">';
     1887          new_html += 'Autosize<span class="derivativeSizeDetails"> - Autosize</span>  </a>';
     1888          jQuery("#derivativeSwitchBox br:last").before(new_html);
     1889
     1890          theImg.useMap = typeMap;
     1891          if (theImg.useMap.match(RegExp("map", "gi"))) {
     1892            return true
     1893          };
     1894          jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
     1895          jQuery('#derivativeCheckedAutosize').css('visibility', 'visible');
     1896
     1897          if (theImg) {
     1898            theImg.removeAttribute("width");
     1899            theImg.removeAttribute("height");
     1900            theImg.src = id_en_cours;
     1901            theImg.useMap = "Autosize";
     1902            return true;
     1903          }
     1904        }
     1905
     1906
     1907        if (nu_img == "") nu_img = 7;
     1908      }
     1909      return true;
     1910
     1911      p2 = jQuery("#infoSwitcher").css("display");
     1912      Set_Map(p2);
     1913      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
     1914      Autosize_resize(true);
     1915    };
     1916
     1917    //===============================================================
     1918    //  Fonctions générales
     1919    //===============================================================
     1920
     1921
     1922    /*************************************************
     1923    * correction pamoorama
     1924    *************************************************/
     1925    Set_Pamoorama = function () {
     1926      if (Type_Img == "pamoorama") {
     1927        if (typeof myPamoorama == "undefined") {
     1928          return;
     1929        }
     1930
     1931
     1932        infos_pamoorama = jQuery("#pamoorama").infos();
     1933        infos_pamoorama_outter = jQuery("#pamoorama_outter").infos();
     1934        infos_pamoorama_inner = jQuery("#pamoorama_inner").infos();
     1935        infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
     1936        infos_pamoorama_frame = jQuery("#pamoorama_frame").infos();
     1937        infos_frame = jQuery(myPamoorama.frame).infos();
     1938
     1939
     1940        //====================================================
     1941        jQuery("#pamoorama").css({
     1942          marginLeft: "auto",
     1943          marginRight: "auto"
     1944          //  height: Zone_Affichage.height + "px" , sinon déclenchement panorama sur la hauteur;
     1945        });
     1946
     1947        infos_pamoorama_inner = jQuery("#pamoorama_inner").infos();
     1948        infos_pamoorama = jQuery("#pamoorama").infos();
     1949
     1950
     1951
     1952
     1953        marges_w = infos_pamoorama.borderwidth.left +
     1954                          infos_pamoorama.margin.left +
     1955                          infos_pamoorama.borderwidth.right +
     1956                          infos_pamoorama.margin.right;
     1957
     1958        marges_h = 10 +
     1959                          infos_pamoorama.borderwidth.top +
     1960                          infos_pamoorama.margin.top +
     1961                          infos_pamoorama.borderwidth.bottom +
     1962                          infos_pamoorama.margin.bottom;
     1963        marges_h += infos_pamoorama_footer.borderwidth.top +
     1964                          infos_pamoorama_footer.margin.top +
     1965                          infos_pamoorama_footer.borderwidth.bottom +
     1966                          infos_pamoorama_footer.margin.bottom;
     1967
     1968        jQuery("#pamoorama").css({
     1969          width: ""
     1970        });
     1971
     1972        outter_height = Zone_image.container.height - infos_pamoorama_footer.height - marges_h;
     1973        Zoom_pano = outter_height / Zone_image.height_init;
     1974
     1975        new_image = { height: Math.ceil(Zone_image.height_init * Zoom_pano),
     1976          width: Math.ceil(Zone_image.width_init * Zoom_pano)
     1977        }
     1978
     1979        jQuery("#pamoorama_inner1").css({
     1980          "transform": "scale(" + Zoom_pano + ")",
     1981          "-ms-transform": "scale(" + Zoom_pano + ")", /* IE 9 */
     1982          "-webkit-transform": "scale(" + Zoom_pano + ")", /* Safari and Chrome */
     1983          "-o-transform": "scale(" + Zoom_pano + ")", /* Opera */
     1984          "-moz-transform": "scale(" + Zoom_pano + ")", /* Firefox */
     1985          "transform-origin": "0 0",
     1986          "-ms-transform-origin": "0 0", /* IE 9 */
     1987          "-webkit-transform-origin": "0 0", /* Safari and Chrome */
     1988          "-moz-transform-origin": "0 0", /* Firefox */
     1989          "-o-transform-origin": "0 0", /* Opera */
     1990          "background-size": "100%"
     1991        });
     1992        jQuery("#pamoorama_inner").css({ width: new_image.width, height: new_image.height, "background-size": "100%"
     1993        });
     1994
     1995        //  jQuery("#pamoorama_inner").width(Zone_image.width_init * Zoom_pano);
     1996        //  jQuery("#pamoorama_inner").height(Zone_image.height_init * Zoom_pano);
     1997
     1998
     1999        //---------- test largeur image
     2000        new_width = Zone_image.container.width;
     2001        if (new_width > new_image.width) {
     2002          new_width = new_image.width;
     2003          jQuery("#pamoorama_outter").css({
     2004            position: 'absolute',
     2005            align: "center",
     2006            margin: "auto"
     2007          });
     2008        }
     2009        outter_width = new_width;
     2010
     2011
     2012        //  jQuery("#pamoorama_thumb").width(200 /  Zone_image.zoom);
     2013        jQuery("#pamoorama_thumb").css({ "width": "" });
     2014        jQuery("#pamoorama_outter").css({
     2015
     2016          align: 'center',
     2017          margin: 'auto',
     2018          width: outter_width + "px",
     2019          height: outter_height + "px"
     2020        });
     2021        //============= Mise à l'echelle ==================
     2022        jQuery("#pamoorama_footer").css({
     2023          width: Zone_image.container.width + "px"
     2024        });
     2025
     2026
     2027        jQuery("#pamoorama_thumb").width(200);
     2028        window.myPamoorama.options.width = Math.ceil(Zone_image.container.width);
     2029        //==================================================================
     2030        new_max_left = new_image.width - outter_width;
     2031        //   jQuery(window.myPamoorama.inner).width(Zone_image.width_init* Zoom_pano);
     2032        //    jQuery(window.myPamoorama.inner).height(Zone_image.height_init * Zoom_pano);
     2033
     2034
     2035
     2036        window.myPamoorama.outter.scrollTo(new_max_left, 0);
     2037
     2038        window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0);
     2039        window.myPamoorama.ratio = Math.ceil(new_image.width / 200);
     2040        window.myPamoorama.imageWidth = new_image.width;
     2041        window.myPamoorama.imageHeight = new_image.height;
     2042
     2043        //  200 = new_image.width
     2044        thumb_z = (Zone_image.container.width / window.myPamoorama.ratio);
     2045        thumb_h = (new_image.height / window.myPamoorama.ratio) * Zoom_pano;
     2046
     2047        jQuery("#pamoorama_frame").css({
     2048          width: thumb_z + "px"
     2049
     2050        });
     2051
     2052        window.myPamoorama.frame.setStyle('width', thumb_z);
     2053      } // test img
     2054    } // Set_Pamoorama
     2055    /*********************************************************/
     2056
     2057    Toggle_bp = function () {
     2058      cl_visible = !cl_visible;
     2059      Autosize_resize();
     2060      Wait_Affichage();
     2061      set_cl();
     2062    }
     2063    //====================================
     2064    //
     2065    //====================================
     2066    set_cl = function () {
     2067      if (typeof cl_visible == "undefined") return;
     2068      if (typeof src1 == "undefined") return;
     2069
     2070      if (cl_visible) src = src1;
     2071      else src = src2;
     2072
     2073      if (cl_visible) {
     2074        src_info = src3;
     2075        src_infos_1 = src3;
     2076      }
     2077      else {
     2078        src_info = src4;
     2079        src_infos_1 = src5;
     2080      }
     2081      Zone_image.zoom = (Zone_image.image.height / Zone_image.height_init);
     2082      zoom_cl = parseInt(100 * Zone_image.zoom);
     2083      jQuery('#zoom ').val(zoom_cl);
     2084      zoom_cl = jQuery('#zoom ').val();
     2085      jQuery('#bp_cla').attr('alt', src_info);
     2086      jQuery('#bp_cla').attr('title', src_info);
     2087      jQuery('#bp_cla').attr('Stitle', src_info);
     2088      jQuery('#bp_cla').attr('Stip', zoom_cl + "%");
     2089
     2090      //jQuery('#bp_cla span').text(src_infos_1 +"    "+ zoom + "%");
     2091      jQuery('#bp_cla span').text(zoom_cl + "%");
     2092      bp_scr = jQuery('#bp_img_cla');
     2093
     2094      if (bp_scr.length > 0) {
     2095        src_enc = bp_scr.attr("src");
     2096        if (!src_enc.match(src)) {
     2097          bp_scr.get(0).src = src;
     2098          jQuery('#bp_img_cla').attr('alt', src_info);
     2099          jQuery('#bp_img_cla').attr('title', src_info);
     2100        }
     2101      }
     2102    }
     2103    //====================================
     2104    //
     2105    //====================================
     2106    Calcul_Image = function (all_width) {
     2107      // theImageAndInfos(jaune) -> theImage(vert) -> [llgbo] -> theMainImage
     2108      // + infos_imageInfos(red)
     2109      infos_body = jQuery("body").infos(); // thePicturePage
     2110      infos_the_page = jQuery("#the_page").infos();
     2111      // theHeader
     2112      //
     2113      infos_content = jQuery("#content").infos();
     2114      // imageHeaderBar
     2115      // imageToolBar imageInfoBar
     2116      infos_imageInfoBar = jQuery("#imageInfoBar").infos();
     2117      infos_imageToolBar = jQuery("#imageToolBar").infos();
     2118      //theImageAndTitle
     2119      infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
     2120      if (infos_theImageAndInfos.width == 0)
     2121        infos_theImageAndInfos = jQuery("#theImageAndTitle").infos();
     2122      infos_theImage = jQuery("#theImage").infos();
     2123      infos_imageInfos = jQuery("#imageInfos").infos();
     2124      infos_theMainImage = jQuery(theMainImage_obj).infos();         // Image
     2125      infos_theMainImage.src = jQuery(theMainImage_obj).attr("src");
     2126      //  infos_llgbo = jQuery("#llgbo").infos();
     2127      // commentContent
     2128      // copyright
     2129      pos_bottom = infos_content.bottom - infos_content.margin.bottom;
     2130      pos_left = infos_theImage.left;
     2131      x = infos_body.left;
     2132      imageInfos_width = jQuery("#imageInfos").css("width");
     2133
     2134      if (theme.match(RegExp("stripped", "gi"))) {
     2135        infos_the_page.margin.left = 20;  //taille fleche
     2136        infos_the_page.margin.right = 20;
     2137      }
     2138
     2139      retrait_w = Math.ceil(infos_theImage.margin.left
     2140                                + infos_theImage.margin.right
     2141                                + infos_theImage.borderwidth.left
     2142                                + infos_theImage.borderwidth.right
     2143                                + infos_theImage.padding.left
     2144                                + infos_theImage.padding.right);
     2145
     2146      retrait_w += Math.ceil(infos_the_page.margin.left
     2147                                + infos_the_page.margin.right
     2148                                + infos_the_page.borderwidth.left
     2149                                + infos_the_page.borderwidth.right
     2150                                + infos_the_page.padding.left
     2151                                + infos_the_page.padding.right);
     2152
     2153      retrait_w += Math.ceil(infos_body.margin.left +
     2154                                infos_body.margin.right);
     2155
     2156
     2157
     2158      pos_top = Math.ceil(infos_theImageAndInfos.top
     2159                     + infos_theImageAndInfos.margin.top
     2160                     + infos_content.borderwidth.top
     2161                     + infos_content.borderwidth.bottom
     2162                     + infos_content.margin.top
     2163                     + infos_content.margin.bottom);
     2164
     2165      retrait_h = Math.ceil(pos_top
     2166                         + infos_theImage.margin.top
     2167                                + infos_theImage.margin.bottom
     2168                                + infos_theImage.borderwidth.top
     2169                                + infos_theImage.borderwidth.bottom
     2170                                + infos_theImage.padding.top
     2171                                + infos_theImage.padding.bottom);
     2172
     2173
     2174
     2175      jQuery(theMainImage_obj).css({ margin: "auto"
    21782176      });
    21792177
    2180       ll2 = jQuery(ll2).infos();
    2181       ll1 = ll1.width;
    2182       ll2 = ll2.width - ll2.borderwidth.left - ll2.borderwidth.right;
    2183       marges_llgbo = (ll1 - ll2);
    2184       infos_llgbo.borderwidth.left = parseInt(marges_llgbo / 2);
    2185       infos_llgbo.borderwidth.right = parseInt(marges_llgbo / 2);
    2186       infos_llgbo.borderwidth.top = parseInt(marges_llgbo / 2);
    2187       infos_llgbo.borderwidth.bottom = parseInt(marges_llgbo / 2);
    2188 
    2189       infos_llgboh2 = jQuery("#llgboh2").infos();
    2190 
    2191 
    2192     }
    2193 
    2194 
    2195   });
    2196   //=====================================================================
    2197   // jQuery("#theImageAndInfos").trigger("ON");
    2198   jQuery("#theImageAndInfos").live('ON', function (e) {
    2199     infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
    2200 
    2201 
    2202   });
    2203   //=====================================================================
    2204   // jQuery("#map").trigger("ON");
    2205   jQuery("#mapPicture").live('ON', function (e) {
    2206     p2 = jQuery("#infoSwitcher").infos();
    2207   });
    2208   function Set_Map(nds) {
    2209     p0 = jQuery("#map").position();
    2210     if (!p0) return;
    2211 
    2212     infos_map = jQuery("#map").infos();
    2213     // if (infos_map.width == (Zone_image.container.width - p0.left))   return ;
    2214     nds = jQuery("#imageInfos").css("display");
    2215     if (nds !="none") {
    2216       p2 = jQuery("#infoSwitcher").infos();
    2217       p0.left += 35;
    2218     }
    2219     jQuery("#map").width(Zone_image.container.width - p0.left);
    2220     jQuery("#map").css({ height: '100%' });
    2221   }
    2222 
    2223   jQuery("#map").live('ON', function (e) {
    2224 
    2225   });
    2226   //=====================================================================
    2227   // jQuery("#theImage").trigger("ON");
    2228   jQuery("#theImage").live('ON', function (e) {
    2229 
    2230     infos_theImage = jQuery("#theImage").infos();
    2231 
    2232     idi = jQuery("#theImage img").attr("src"); ;
    2233     id2 = jQuery("#theImage img").attr("usemap");
    2234     if (id2) {
    2235       id3 = jQuery("#derivativeCheckedAutosize");
    2236       id4 = id2.replace('#map', ''); // en cours
    2237       id0 = idi.split('-');
    2238       id5 = id0[id0.length - 1].split(".")[1];
    2239       id6 = id0[id0.length - 1];
    2240 
    2241       id4 = idi.replace("-" + id0[id0.length - 1], "-xx") + "." + id5;
    2242       idi = id4;
    2243       id4 = 'xxlarge';
    2244       path = document.URL;
    2245       if (id3.length == 0) {
    2246 
    2247         //derivativeCheckedxxlarge
    2248         jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
    2249         // jQuery('#derivativeChecked' + typeSave).css('visibility', 'visible');
    2250 
    2251         new_html = '<br /><span class="switchCheck" id="derivativeCheckedAutosize" style="visibility:visible" >&#x2714; </span>';
    2252         new_html += '<a href="javascript:changeImgSrc1(\'' + idi + '\', \'' + id4 + '\', \'Autosize\') ">';
    2253         new_html += 'Autosize<span class="derivativeSizeDetails"> - Autosize</span>  </a>';
    2254 
    2255 
    2256         htm = jQuery("#derivativeSwitchBox")[0].innerHTML;
    2257         jQuery("#derivativeSwitchBox br:last").before(new_html);
    2258         // cl_visible = false;
    2259         htm1 = jQuery("#derivativeSwitchBox")[0].innerHTML;
    2260 
    2261         var theImg = document.getElementById("theMainImage");
    2262         if (theImg) {
    2263 
    2264           theImg.removeAttribute("width");
    2265           theImg.removeAttribute("height");
    2266           theImg.src = idi;
    2267           //  theImg.useMap =  ;
    2268           theImg.useMap = "Autosize";
    2269         }
    2270       }
    2271     }
    2272     if (nu_img == "") nu_img = 7;
    2273 
    2274 
    2275     jQuery().newResize(false);
    2276     p2 = jQuery("#infoSwitcher").css("display");
    2277     Set_Map(p2);
    2278     jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
    2279 
    2280   });
    2281   //=================================================================
    2282   jQuery(document).live('gallyInterfaceReady', function (e) {
    2283     i = jQuery(this).text();
    2284     jQuery(this).trigger('ON');
    2285   }
    2286 
    2287   );
    2288   jQuery(Parent).live('OK', function (e) {
    2289     if (nu_img == "") nu_img = 7;
    2290     jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
    2291     jQuery().newResize(false);
    2292     jQuery().newResize(false);
    2293 
    2294     jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
    2295   });
    2296   // Custom Event, ON to turn on a debug.
    2297   jQuery('.debug').live('ON', function (e) {
    2298 
    2299     nu_img = jQuery(this).text();
    2300     jQuery('.debug').trigger('OFF');
    2301     jQuery(this).addClass('debugOn');
    2302 
    2303   });
    2304 
    2305   // On Click = debugs On
    2306   jQuery('.debug').live('click', function (e) {
    2307     i = jQuery(this).text();
    2308     jQuery(this).trigger('ON');
    2309   });
    2310 
    2311   // Custom Event, Turn off a debug
    2312   jQuery('.debug').live('OFF', function (e) {
    2313     jQuery(this).removeClass('debugOn');
    2314   });
    2315 
    2316   // on Double Click, remove the debug from the DOM
    2317   jQuery('.debug').live('dblclick', function () {
    2318     jQuery(this).fadeOut(function () { jQuery(this).remove() });
    2319   });
    2320 
    2321   // Add another debug to the DOM
    2322   jQuery('#adddebugs').click(function () {
    2323     i = jQuery('.debug').length;
    2324     jQuery('<div>' + i + '</div>')
    2325             .addClass('debug')
    2326             .appendTo('#debugsContainer');
    2327   });
    2328 
    2329   // Add 10 testing debugs to start with
    2330   jQuery(window).load(function () {
    2331     DEBUG_autosize = (typeof DEBUG_autosize != "undefined") ? DEBUG_autosize : "false";
    2332     if (DEBUG_autosize == "true") {
    2333       for (var i = 0; i < 10; i++) {
    2334         jQuery('#adddebugs').click();
    2335       }
    2336       jQuery(jQuery('.debug').get(i - 1)).click();
    2337     }
    2338 
    2339 
    2340 
    2341     //piwigo 2.4
    2342     // Add another debug to the DOM
    2343     jQuery('#derivativeCheckedAutosize').click(function () {
    2344 
    2345 
    2346     });
    2347 
    2348     jQuery("#derivativeSwitchBox a").click(function () {
     2178      retrait_img = Math.ceil(infos_theMainImage.borderwidth.left
     2179                    + infos_theMainImage.borderwidth.right
     2180                    + infos_theMainImage.padding.left
     2181                    + infos_theMainImage.padding.right);
     2182      retrait_img += Math.ceil(infos_llgbo.borderwidth.right + infos_llgbo.borderwidth.right);
     2183
     2184      if (theme.match(RegExp("elegant", "gi"))) {
     2185        if (all_width != true) {
     2186          new_width = Math.ceil(8 +
     2187                                infos_imageInfos.width +
     2188                                infos_imageInfos.borderwidth.left +
     2189                                infos_imageInfos.borderwidth.right +
     2190                                infos_imageInfos.margin.left +
     2191                                infos_imageInfos.borderwidth.right +
     2192                                infos_imageInfos.padding.left +
     2193                                infos_imageInfos.padding.right);
     2194        } else {
     2195          new_width = 0;
     2196        }
     2197        width_theImage = (jQuery(window).width() - new_width)
     2198
     2199      } else if (theme.match(RegExp("stripped", "gi"))) {
     2200        width_theImage = (jQuery(window).width());
     2201      } else if (theme.match(RegExp("simple", "gi"))) {
     2202        width_theImage = infos_imageInfoBar.left + infos_theImage.left - infos_imageInfoBar.margin.left - 5;
     2203
     2204
     2205      } else {
     2206        width_theImage = (jQuery(window).width());
     2207      }
     2208
     2209
     2210      b = 0;
     2211
     2212
     2213      if (infos_llgbo.top > 0) {
     2214        if ((infos_llgbo.top - retrait_h) > 0) {
     2215          b = infos_llgbo.top - retrait_h;
     2216        } else {
     2217          b = infos_llgbo.top;
     2218        }
     2219      }
     2220      retrait_h += (b * 2)
     2221      height_theImage = jQuery(window).height() - retrait_h;
     2222      width_theImage -= retrait_w;
     2223      //===============================================================
     2224      width_theMainImage = width_theImage - retrait_img;
     2225      height_theMainImage = parseInt(width_theImage / rapport) - (retrait_img);
     2226
     2227      //===============================================================
     2228      // test débordement
     2229      if ((height_theMainImage) > height_theImage - (retrait_img + (b * 2))) {
     2230        height_theMainImage = height_theImage - (retrait_img);
     2231        width_theMainImage = parseInt(height_theMainImage * rapport);
     2232      } else {
     2233        width_theMainImage = width_theImage - (retrait_img);
     2234        height_theMainImage = parseInt(width_theMainImage / rapport);
     2235      }
     2236      //==================================================================
    23492237      var theImg = document.getElementById("theMainImage");
    23502238      if (theImg) {
    2351         try {
    2352           n = eval(this.pathname);
    2353         } catch (e) {
    2354           n = false;
    2355         }
    2356         infos_theMainImage = jQuery("#theMainImage").infos();
    2357         infos_theImage = jQuery("#theImage").infos();
    2358         theImg.removeAttribute("width");
    2359         theImg.removeAttribute("height");
    2360         rapport = parseInt(img_init.width) / parseInt(img_init.height);
    2361         if (n == true) {
    2362           old_window.width = 0; // force autosize
    2363           jQuery(window).resize();
     2239
     2240
     2241        if (theImg.useMap.match(RegExp("map", "gi"))) {
     2242          height_theMainImage = jQuery(theImg).height() - (retrait_img);
     2243          width_theMainImage = jQuery(theImg).width() - retrait_img;
     2244        }
     2245      }
     2246      width_theMainImage = parseInt(height_theMainImage * rapport);
     2247      height_theMainImage = parseInt(width_theMainImage / rapport);
     2248
     2249      height_theImage += (b * 2);
     2250      if (height_theImage > height_theMainImage + retrait_h) {
     2251        height_theImage = height_theMainImage + retrait_h;
     2252      }
     2253
     2254      Zone_image = {
     2255        image: { width: width_theMainImage,
     2256          height: height_theMainImage
     2257        },
     2258        container: {
     2259          width: width_theImage,
     2260          height: height_theImage
     2261        }
     2262      };
     2263      Zone_image.top = retrait_h;
     2264      Zone_image.marge = { width: retrait_w, height: retrait_h };
     2265
     2266      Zone_image.src = jQuery(theMainImage_obj).attr("src");
     2267
     2268
     2269      Zone_image.width_init = img_init.width;
     2270      Zone_image.height_init = img_init.height;
     2271
     2272      if (!Zone_image.height_init) {
     2273        Zone_image.height_init = parseInt(img_init.height);
     2274        Zone_image.rapport_init = parseInt(img_init.width) / Zone_image.height_init;
     2275      }
     2276
     2277      Zone_image.rapport_init = Zone_image.width_init / Zone_image.height_init;
     2278      Zone_image.zoom = Zone_image.image.height / Zone_image.height_init;
     2279
     2280      return Zone_image;
     2281    }
     2282
     2283
     2284    /**************************************************
     2285    *  onProperty
     2286    **************************************************/
     2287    onPropertyChange = function (e, obj) {
     2288      var el = obj;
     2289      attributs = el.attributes;
     2290      type_action = e.type;
     2291      style = "";
     2292      alt = "";
     2293      src = "";
     2294
     2295      if (attributs.id) id = attributs.id.value;
     2296      if (attributs.style) style = attributs.style.value;
     2297      if (attributs.alt) alt = attributs.alt.value;
     2298      /* Image */
     2299      if (attributs.src) {
     2300        src = attributs.src.value;
     2301        if (attributs.width) width = attributs.width.value;
     2302        if (attributs.height) height = attributs.height.value;
     2303      }
     2304      affiche_debug({
     2305        Debug1: Debug_info(1, type_action + " : " + src, id + " action ")
     2306
     2307      });
     2308
     2309
     2310      if (style)
     2311        switch (style) {
     2312        case "style.opacity":
     2313
     2314          break;
     2315        case "style.transform":
     2316
     2317          break;
     2318        case "style.display":
     2319
     2320          break;
     2321        case "style.color":
     2322
     2323          break;
     2324        case "style.width":
     2325          width = el.style.width;
     2326          break;
     2327        case "style.height":
     2328          height = el.style.height;
     2329          break;
     2330
     2331        case 'width':
     2332
     2333          break;
     2334        case 'height':
     2335
     2336          el.style.height = el.attributes.height.nodeValue + 'px';
     2337          el.firstChild.style.height = el.clientHeight + 'px';
     2338          break;
     2339      }
     2340    }
     2341
     2342
     2343    Autosize_resize(true);
     2344
     2345
     2346  });  // ready
     2347})(jQuery);
     2348
     2349
     2350  //=====================================================================
     2351  //
     2352  //  Fonctions supplémentaires
     2353  //
     2354  //=====================================================================
     2355  function Autosize_resize(Obj) {
     2356    conf = jQuery(Obj).get(0).conf;
     2357    Obj = jQuery(Obj).get(0).obj;
     2358    myWindow = jQuery("#" + conf.parent).infos();
     2359    if (myWindow.width == 0) myWindow = jQuery(window).infos();
     2360    marge_basse = 0;
     2361    if (conf.MargeBasse)
     2362      marge_basse = jQuery().Get_Val_int(conf.MargeBasse);
     2363    marge_top = 0;
     2364    if (conf.MargeHaute)
     2365      marge_top = jQuery().Get_Val_int(conf.MargeHaute);
     2366    infos_Obj = jQuery(Obj).infos();
     2367    h1_left = jQuery(Obj).absoluteLeft();
     2368    h1_top = jQuery(Obj).absoluteTop();
     2369
     2370    if (h1_top < infos_Obj.height)
     2371      h1 = (myWindow.height - h1_top - marge_basse - marge_top);
     2372    else
     2373      h1 = (myWindow.height - marge_basse);
     2374    rap = infos_Obj.height / infos_Obj.width;
     2375    w2 = parseInt(h1 / rap);
     2376    if (w2 < infos_Obj.width)
     2377      marginLeft = infos_Obj.left + parseInt((infos_Obj.width - w2) / 2) + "px";
     2378    else
     2379      marginLeft = "auto";
     2380    jQuery(Obj).css({ width: "auto", marginTop: marge_top,
     2381      marginLeft: "auto", marginBottom: 0 + "px",
     2382      verticalAlign: "middle", textAlign: "center"
     2383    });
     2384    jQuery(Obj).height(h1);
     2385    //=============================================================
     2386    if (conf.ResizePicture == "true")
     2387      imgs = jQuery(Obj).find("img");
     2388    else
     2389      imgs = jQuery(Obj).find("img");
     2390    Parent = Obj;
     2391
     2392    Obj_w = jQuery(Obj).width();
     2393    Obj_h = jQuery(Obj).height();
     2394    if (imgs.length > 0) {
     2395      jQuery(imgs).each(function (i) {
     2396        img = jQuery(this);
     2397        h1_top = jQuery(img).absoluteTop() - h1_top;
     2398        h1_bottom = Obj_h - h1_top;
     2399        infos_img = { width: conf.width[i], height: conf.height[i] }; //origine
     2400        img_rap = conf.rap[i];
     2401        if (infos_img.width > Obj_w) h1 = parseInt(Obj_w / img_rap);
     2402        h1 -= h1_top;
     2403        if (h1 > Obj_h - h1_top) {
     2404          h1 = Obj_h - h1_top;
     2405        }
     2406        w2 = parseInt(h1 * img_rap);
     2407        if (w2 > 0 && h1 > 0 && img.length > 0) {
     2408          img.height(h1);
     2409          img.width(w2);
     2410        }
     2411      });
     2412    } else {
     2413      imgs = jQuery(Obj).children();
     2414      jQuery(imgs).each(function (i) {
     2415        if (this.height > 0) {
     2416          h1_top = jQuery(this).absoluteTop() - h1_top;
     2417          h1_bottom = Obj_h - h1_top;
     2418          infos_img = { width: conf.width[i], height: conf.height[i] }; //origine
     2419          img_rap = conf.rap[i];
     2420          if (infos_img.width > Obj_w) h1 = parseInt(Obj_w / img_rap);
     2421          h1 -= h1_top;
     2422          if (h1 > Obj_h - h1_top) {
     2423            h1 = Obj_h - h1_top;
     2424          }
     2425          w2 = parseInt(h1 * img_rap);
     2426          if (w2 > Obj_w) {
     2427            w2 = Obj_w;
     2428          }
     2429
     2430          if (w2 > 0 && h1 > 0) {
     2431            this.height = (h1);
     2432            this.width = (w2);
     2433          }
     2434
     2435        }
     2436        name = this.name;
     2437      });
     2438
     2439
     2440
     2441    }
     2442
     2443  }
     2444  //===============================================
     2445  // Extend expression jQuery(":Autozise") ;
     2446  //===============================================
     2447  jQuery.extend(jQuery.expr[':'], {
     2448    // Nom du sélecteur personnalisé
     2449    Autosize: function (a) {
     2450      nd = a.nodeName;
     2451      n1 = a.className;
     2452      // personal_block
     2453      if (n1.match(RegExp("autosize", "gi"))) {
     2454        //   autosize = "MargeBasse:30px; ResizePicture:false"
     2455        infconf = jQuery(a).attr("autosize");
     2456        n1 = typeof infconf;
     2457        conf = { MargeBasse: 0, NoPicture: false }
     2458        if (n1 == "undefined") {
     2459
    23642460        } else {
    2365           nw = "100% x 100%".split("x");
    2366           if (jQuery(this).text().match(RegExp("x", "gi"))) {
    2367             nw = jQuery(this).text().split("(")[1].split(")")[0];
    2368             nw = nw.split("x");
    2369             jQuery("#theImage").css({ marginRight: "auto", marginLeft: "auto", textAlign: "center" });
    2370 
    2371             wx = parseInt(nw[0]);
    2372             jQuery(theImg).width(wx);
    2373             jQuery(theImg).height(wx / rapport);
    2374             /*  n = jQuery("#imageInfos").css("display");
    2375             Zone_image = Calcul_Image(n == "none");
    2376             jQuery("#theImage").width(wx+(Zone_image.marge.width * 1.5));
    2377             jQuery("#theImage").height((wx / rapport) + Zone_image.marge.height);
    2378             */
    2379 
    2380 
    2381 
    2382 
    2383 
    2384           }
    2385         }
    2386 
    2387 
    2388 
    2389       }
    2390 
    2391     });
    2392 
    2393     function changeImgSrc1(url, typeSave, typeMap) {
    2394       var theImg = document.getElementById("theMainImage");
    2395       if (theImg) {
    2396         theImg.removeAttribute("width");
    2397         theImg.removeAttribute("height");
    2398         theImg.src = url;
    2399         //  theImg.useMap = "#map" + typeMap;
    2400         if (typeMap == "Autosize") {
    2401           theImg.useMap = "#" + typeMap;
    2402         } else {
    2403           theImg.useMap = "#map" + typeSave;
    2404         }
    2405         jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
    2406         jQuery('#derivativeChecked' + typeMap).css('visibility', 'visible');
    2407         document.cookie = 'picture_deriv=' + typeSave + ';path="' + cookie_path + '" ';
    2408       }
     2461          tableau = infconf.split(";");
     2462          for (var i = 0; i < tableau.length; i++) {
     2463            tableau2 = tableau[i].split(":");
     2464            conf[jQuery.trim(tableau2[0])] = jQuery.trim(tableau2[1]);
     2465          }
     2466          imgs = jQuery(a).find("img");
     2467          rap = new Array();
     2468          width = new Array();
     2469          height = new Array();
     2470          if (imgs.length > 0)
     2471            jQuery(imgs).each(function (i) {
     2472              img = jQuery(this);
     2473              rap.push((img.width() / img.height()));
     2474              width.push(img.width());
     2475              height.push(img.height());
     2476            });
     2477          else {
     2478            imgs = jQuery(a).children();
     2479            jQuery(imgs).each(function (i) {
     2480              if (this.height > 0) {
     2481                rap.push(this.width / this.height);
     2482                width.push(this.width);
     2483                height.push(this.height);
     2484              }
     2485              name = this.name;
     2486
     2487
     2488            });
     2489          }
     2490          conf['rap'] = rap;
     2491          conf['width'] = width;
     2492          conf['height'] = height;
     2493          List_autosize.push({ obj: a, conf: conf });
     2494          jQuery(a).css({ opacity: 0 });
     2495        }
     2496      }
     2497      //  Css = jQuery(a).getStyles(a);
     2498      return false;
     2499    }, // jQuery.Autosize
     2500    Set_Class: function (a) {
     2501      nd = a.nodeName;
     2502      if (nd == "DIV") {
     2503        XBrowserAddHandler(a, 'onpropertychange', onPropertyChange);
     2504        //jQuery(a).find("img:nth-child(1)").css("border","Solid 5px green");
     2505        img = jQuery(a).children("img");
     2506        if (img.length == 0) img = jQuery(a).find("a").children("img");
     2507        if (img.length > 0)
     2508          if (img.length == 1) {
     2509            if (img[0].src.match(RegExp(".png", "g")))
     2510              return;
     2511            // img[0].attachEvent('onpropertychange', onPropertyChange);
     2512            XBrowserAddHandler(img[0], 'onpropertychange', onPropertyChange);
     2513            jQuery(img).addClass("Image");
     2514            //jQuery(img).attr("autosize", "MargeBasse:0px; ResizePicture:true");
     2515          }
     2516      }
     2517    }  //jQuery().Set_Class
     2518
     2519
     2520  }); // Extend expression
     2521
     2522  /**************************************************
     2523  * TEST
     2524  **************************************************/
     2525  /*
     2526  var y = 3;
     2527  var txtTestBox = document.getElementById('testBox');
     2528  XBrowserAddHandler(txtTestBox, 'keyup', function() {
     2529  myFunctionRef(y)
     2530  });
     2531  var myFunctionRef = function myFunction(x, e) {
     2532  var keyCode;
     2533  if (!e && window.event)
     2534  e = window.event;
     2535  if (e)
     2536  keyCode = (window.Event) ? e.which : e.keyCode;
     2537  alert('You pressed: ' + keyCode + '. Event object is :' + e + '. x is: ' + x);
     2538  }
     2539
     2540  */
     2541  /**************************************************
     2542  * XBrowserAddHandler
     2543  **************************************************/
     2544  function XBrowserAddHandler(target, eventName, handlerName) {
     2545    if (target.addEventListener)
     2546      target.addEventListener(eventName, handlerName, false);
     2547    else if (target.attachEvent)
     2548      target.attachEvent("on" + eventName, handlerName);
     2549    else
     2550      target["on" + eventName] = handlerName;
     2551  }
     2552
     2553  /********************************************************
     2554  * List_autosize_resize
     2555  ********************************************************/
     2556  function List_autosize_resize(event, ui) {
     2557    if (typeof wait_resize == "undefined") wait_resize = false;
     2558    if (wait_resize == true) return;
     2559    wait_resize = true;
     2560    if (List_autosize.length == 0) return;
     2561    for (i = 0; i < List_autosize.length; i++) {
     2562      Autosize_resize(jQuery(List_autosize[i]));
    24092563    }
    2410 
    2411 
    2412   }); //on load
    2413 });
    2414 
    2415 function changeImgSrc1(url, typeSave, typeMap) {
    2416   old_window.width = 0; // force autosize
    2417   jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
    2418   jQuery('#derivativeChecked' + typeMap).css('visibility', 'visible');
    2419   jQuery(window).resize();
    2420 };
     2564    wait_resize = false;
     2565    return true;
     2566  }
     2567
  • extensions/Autosize/js/autosize.cookie.js

    r10845 r16579  
    5454 * @author Klaus Hartl/klaus.hartl@stilbuero.de
    5555 */
    56 jQuery.cookie = function(name, value, options) {
     56jQuery.cl_cookie = function(name, value, options) {
    5757    if (typeof value != 'undefined') { // name and value given, set cookie
    5858        options = options || {};
     
    9494        return cookieValue;
    9595    }
    96 };
     96    };
     97
     98 
  • extensions/Autosize/js/autosize.dimensions.js

    r12683 r16579  
    206206        Top = Cl_Position.top;
    207207
    208         results = {
     208        results = {src: elem.src || "none",
    209209          position: myposition,
    210210          top: Top,
  • extensions/Autosize/template/header_2_1.tpl

    r11429 r16579  
    44{known_script id="conflit_script" src = $AUTOSIZE_PATH|@cat:"js/conflit.js" }
    55{known_script id="autosize.dimensions" src = $AUTOSIZE_PATH|@cat:"js/autosize.dimensions.js" }
    6 {known_script id="autosize.cookie" src = $AUTOSIZE_PATH|@cat:"js/autosize.cookie.js" }
     6{*known_script id="autosize.cookie" src = $AUTOSIZE_PATH|@cat:"js/autosize.cookie.js" *}
    77{/html_head}
  • extensions/Autosize/template/header_2_2.tpl

    r11461 r16579  
    1212{combine_script id="jquery.cluetip" path = "themes/default/js/plugins/jquery.cluetip.js" require="jquery" }
    1313{combine_script id="autosize.dimensions" path = $AUTOSIZE_PATH|@cat:"js/autosize.dimensions.js" require="jquery"}
    14 {combine_script id="autosize.cookie" path = $AUTOSIZE_PATH|@cat:"js/autosize.cookie.js" require="jquery"}
     14{combine_script id="autosize.cookie" path = $AUTOSIZE_PATH|@cat:"js/autosize.cookie.js" require="jquery" }
    1515
    1616
  • extensions/Autosize/template/picture_2_2.tpl

    r16124 r16579  
    1 {combine_script id="Affiche_script" path= $AUTOSIZE_PATH|@cat:"js/Affiche_script.js" require='jquery,autosize.cookie,conflit_script'  }
     1{combine_script id="Affiche_script" path= $AUTOSIZE_PATH|@cat:"js/Affiche_script.js" require='jquery,conflit_script'  }
Note: See TracChangeset for help on using the changeset viewer.