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

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

[extensions] Autosize fix compatibility with 2.4

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