source: extensions/Autosize/js/Affiche_script.js @ 16594

Last change on this file since 16594 was 16594, checked in by cljosse, 12 years ago

[extensions] Autosize fix compatibility with 2.4

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