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

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

[extensions] Autosize fix compatibility with theme hr_os_xl

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