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

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

[extensions] Autosize fix compatibility with theme simple

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