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

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

[extensions] Autosize fix compatibility with 2.4

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