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

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

[extensions] Autosize fix compatibility with 2.4, fix left menu

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