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

Last change on this file since 13512 was 13512, 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           if ((marge_right + marge_left) < winwidth ) {
670           winwidth -= (marge_right + marge_left);
671           }
672
673           if (Type_Img == "pamoorama") {
674
675             mypanorama = window.myPamoorama;
676             //============================================================
677             if (typeof (mypanorama) == "undefined") return false;
678             var myPamoorama = mypanorama;
679             if (typeof (myPamoorama.skipInit) == "undefined") return false;
680             //
681
682             if (myPamoorama.skipInit == false) {
683
684               return false;
685             }
686
687             var info_pamoorama = jQuery("#pamoorama").infos();
688             var info_pamoorama_outter = jQuery("#pamoorama_outter").infos();
689             var info_pamoorama_inner = jQuery("#pamoorama_inner").infos();
690             var info_pamoorama_footer = jQuery("#pamoorama_footer").infos();
691             var info_pamoorama_frame = jQuery("#pamoorama_frame").infos();
692             The_MainImage = jQuery("#pamoorama");
693             obj = The_MainImage.get(0);
694
695           } else {
696
697
698
699
700           }
701           //=================================================================
702
703
704           switch (Type_Img) {
705             case "map":
706               img_reelle.height = winheight; // info_img.height;
707               info_map = jQuery("#mapPicture").infos();
708               jQuery("#map").css("left", info_map.width + "px");
709               Bandeau_bas.height = 10;
710
711               if (theme.match(RegExp("simple", "g"))) {
712                 img_reelle.width = winwidth; //- info_map.width -marge_right;
713               } else {
714                 img_reelle.width = winwidth - info_map.width - marge_right;
715               }
716
717
718               info_the_page = jQuery("#the_page").infos();
719               winwidth = img_reelle.width;
720
721               ;
722
723               break
724
725
726             case "panorama":
727               //  return true;
728
729               //the theMainImage ??
730               if (!The_MainImage) {
731                 The_MainImage = jQuery("#theMainImage");
732                 if (The_MainImage.length > 0)
733                   return;
734                 The_MainImage = jQuery().Get_Img_Maxi("#Panorama img[alt]");
735                 // return;
736                 if (The_MainImage.length > 0)
737                   The_MainImage = The_MainImage[0];
738                 else
739                   The_MainImage = jQuery().Get_Img_Maxi("#Panorama img[alt]");
740               }
741               info_theImage = jQuery(The_MainImage).infos();
742               info_the_page = jQuery("#the_page").infos();
743               jQuery("#theImage").height(info_theImage.height);
744               img_finale.height = info_theImage.height;
745
746               break
747             case "img":
748
749               if (!The_MainImage) return true;
750               if (theme.match(RegExp("luciano", "g"))) {
751                 The_MainImage = jQuery("#the_page #The_MainImage");
752               }
753
754               info_the_page = jQuery("#the_page").infos();
755
756
757               break
758             case "img_autre":
759               if (!The_MainImage) {
760                 if (DEBUG_autosize == "true") alert("The_MainImage=null");
761                 return true;
762
763               }
764               info_theImage = jQuery(The_MainImage).infos();
765               info_the_page = jQuery("#the_page").infos();
766
767
768               break
769             case "embed":
770               //
771               if (info_img.width == 0)
772                 info_img = jQuery("#thePicturePage").infos();
773               if (info_img.width == 0)
774                 info_img = jQuery("#the_page").infos();
775               info_theImage = info_img;
776               info_the_page = jQuery("#the_page").infos();
777               Bandeau_bas.height = Bandeau_bas.top;
778
779               iph1 = jQuery("#theImage div").infos();
780               if ((winheight - iph1.bottom)>0)
781               Bandeau_bas.height =(winheight - iph1.bottom) + 50;
782               else
783               Bandeau_bas.height = 50;
784
785
786               if (rapport < 0) {
787                 img_height = info_img.height;
788                 img_width = info_img.width;
789                 img_reelle.height = img_height;
790                 img_reelle.width = img_width;
791               }
792
793               break
794             case "charlie":
795               info_theImage = info_img;
796               info_the_page = jQuery("#the_page").infos();
797               if (rapport < 0) {
798                 img_height = parseInt(info_img.height);
799                 img_width = parseInt(info_img.width);
800
801                 img_reelle.height = parseInt(info_img.height);
802                 img_reelle.width = parseInt(info_img.width);
803               }
804               break
805
806
807             case "pamoorama":
808
809               img_reelle = { height: img_height, width: img_width };
810
811               //=========================================================
812               img_reelle.height = img_height;
813               img_reelle.width = Zone_Affichage.width;
814
815
816               The_MainImage = myPamoorama.image;
817               info_theImage = jQuery("#pamoorama").infos();
818               //img_finale.height = info_theImage.height;
819               //info_theImage.height = img_reelle.height;
820
821               info_theImage.height = info_theImage.height;
822
823               info_the_page = jQuery("#the_page").infos();
824
825               break
826
827
828           }
829           //================= Vérification taille image ==================
830           MinWidth = jQuery(The_MainImage).css("minWidth");
831           if (MinWidth == "0px")
832             MinWidth = mini_width;
833           MinHeight = jQuery(The_MainImage).css("minHeight");
834           if (MinHeight == "0px")
835             MinHeight = mini_height;
836
837           MaxWidth = jQuery(The_MainImage).css("maxWidth");
838           if (MaxWidth == "0px")
839             MaxWidth = winwidth;
840           MaxHeight = jQuery(The_MainImage).css("maxHeight");
841           if (MaxHeight == "0px")
842             MaxHeight = mwinheight;
843
844           //=============== Vérification taille minimale  autorizée ======================
845           var miniWidth = jQuery(The_MainImage).Get_Val_int(MinWidth, mini_width);
846           var miniHeight = jQuery(The_MainImage).Get_Val_int(MinHeight, mini_height);
847           if (winwidth < mini_width2) mini_width2 = winwidth;
848
849           var miniWidth2 = jQuery(The_MainImage).Get_Val_int(MinWidth, mini_width2);
850           var miniHeight2 = jQuery(The_MainImage).Get_Val_int(MinHeight, mini_height2);
851
852
853           var maxWidth = jQuery(The_MainImage).Get_Val_int(MaxWidth, winwidth, "0");
854           maxHeight = jQuery(The_MainImage).Get_Val_int(MaxHeight, winheight, "0");
855
856
857
858           mini_width = parseInt(miniWidth);
859           mini_height = parseInt(miniHeight);
860
861           img_reelle.width = parseInt(img_reelle.width);
862
863           if (img_reelle.width < mini_width) {
864             //jQuery(Cadre).width(mini_width); 1.6.2
865             return true;
866
867           }
868
869           img_reelle.height = parseInt(img_reelle.height);
870           if (img_reelle.height < parseInt(mini_height))
871             return true;
872           //==================================================================================
873           //---------------------------------------------
874           //  jQuery(Parent).width(winwidth);
875           //  jQuery(Parent).css({ height: "auto" });
876           //  jQuery(Parent).height(Zone_Affichage.height);
877           //---------------------------------------------
878
879           if (rapport < 0) {
880             img_init.height = parseInt(img_height);
881             img_init.width = parseInt(img_width);
882
883             rapport = img_width / img_height;
884
885             if (Type_Img != "map")
886               rapport = (img_init.width / img_init.height);
887             else
888               rapport = 0;
889
890           }
891
892
893           //=============== Zone d'affichage ============================
894
895           borderW = Zone_Affichage.borderwidth.left;
896           borderW += Zone_Affichage.borderwidth.right;
897
898
899           Zone_Affichage.width = winwidth - borderW;
900
901
902
903           var Licence = jQuery(".licencetag");
904           info_Licence = jQuery(".licencetag").infos();
905
906           var MainImage = jQuery("#theMainImage");
907
908           if (MainImage.length == 0) jQuery(Parent + " #theImg IMG").css("marginTop", "0px");
909
910           //========== Correction en fonction du thème =============================
911           var correction = 0;
912           if (theme.match(RegExp("sobre", "g"))) {
913
914             //   correction = -info_Licence.padding.top;
915             if (Type_Img == 'img') {
916               if (msie == true) correction = 0;
917               else correction = 0;
918               correction = 10;
919             }
920
921           } else if (theme.match(RegExp("Pure", "g"))) {
922             correction += 0; //??
923           } else if (theme.match(RegExp("luciano", "g"))) {
924             correction = 0; //??
925
926           } else if (theme.match(RegExp("simple", "g"))) {
927             correction += 0; //??
928           } else if (theme.match(RegExp("gally", "g"))) {
929             correction += 0; //??
930           } else if (theme.match(RegExp("os", "g"))) {
931             correction += 0; //??
932           }
933
934           //====================================================
935           if (options.imageAutosizeMargin > 0) Marge_Basse = options.imageAutosizeMargin;
936           else Marge_Basse = parseInt(marge_basse || 0); // hors bandeau
937           //==========================================================================
938           h = 0;
939           Bandeau = 0;
940
941           h = (Zone_Affichage.padding.bottom + Zone_Affichage.padding.top + Zone_Affichage.margin.top + Zone_Affichage.margin.bottom);
942           if (typeof Bandeau_t != "undefined") Bandeau = Bandeau_t.img_top | 0;
943           Zone_Affichage.height = winheight - Bandeau - Marge_Basse - correction - h;
944           //=========================================================================
945           if (Zone_Affichage.height < mini_height2)
946             Zone_Affichage.height = mini_height2;
947           if (Zone_Affichage.width < mini_width2)
948             Zone_Affichage.width = mini_width2;
949           //=========================================================================
950           if (typeof (Bandeau_bas) != "undefined") {
951             if (Bandeau_bas.height < Zone_Affichage.height) 
952                 Zone_Affichage.height -= (Bandeau_bas.height + Bandeau_bas.marge.top + Bandeau_bas.marge.bottom);
953           } else {
954           }
955
956           var Image_height = Zone_Affichage.height;
957
958           //=============================================================
959           var height_user = eval(user_status + "_height");
960           var reg1 = new RegExp("%", "g");
961           if (height_user.match(reg1))
962             Image_height = Image_height * parseInt(height_user) / 100;
963           else
964             Image_height = parseInt(height_user);
965
966           echelle_max = parseFloat(echelle_max, '3');
967           var echelle = parseFloat(Image_height / img_reelle.height, 3);
968
969           if (echelle > echelle_max) { echelle = echelle_max; }
970           Image_height = parseInt(img_reelle.height * echelle);
971           //============================================================
972
973           var Image_width;
974           if (rapport > 0)
975             Image_width = parseInt(Image_height * rapport);
976           else if (Type_Img == "map") {
977             Image_width = Zone_Affichage.width - marge_left - marge_right;
978           } else {
979             Image_width = Zone_Affichage.width;
980           }
981
982           //===============================================================
983           align_auto = "center";
984           if (jQuery("#theImg").css("textAlign"))
985             align_auto = jQuery("#theImg").css("textAlign");
986           var widthmin = winwidth;
987
988           if (check_auto_w == 'checked="checked"') {
989             // if (Type_Img != "pamoorama" && Type_Img != "panorama" ) {
990             //==== largeur à atteindre ===
991             var width_user = eval(user_status + "_width");
992             // Largeur maximale en fonction du statut
993             if (width_user.match(reg1))
994             // pourcentage
995               widthmin = widthmin * parseInt(width_user) / 100;
996             else
997               widthmin = parseInt(width_user);
998
999             var marges = 0;
1000
1001             if (typeof (info_img) != "undefined") {
1002               widthmin -= info_img.borderwidth.left || 0;
1003               widthmin -= info_img.borderwidth.right || 0;
1004             }
1005             widthmin -= marges;
1006             if (typeof Bandeau_t != "undefined") {
1007               widthmin -= (Bandeau_t.borderwidth.left + Bandeau_t.borderwidth.left);
1008               Image_width -= (Bandeau_t.borderwidth.left + Bandeau_t.borderwidth.left);
1009             } else {
1010
1011               jQuery().newResize();
1012             }
1013             if (Image_width > widthmin) {
1014               //   Image_width largeur à atteindre
1015               //  Calcul du rapport d'agrandissement
1016               var echelle_w = parseFloat((widthmin) / img_reelle.width, 3);
1017               if (echelle_w > echelle_max) { echelle_w = echelle_max; }
1018               Image_width = parseInt(img_reelle.width * echelle_w);
1019               if (rapport > 0)
1020                 Image_height = parseInt(Image_width / rapport);
1021             }
1022
1023
1024
1025           }
1026
1027
1028           // }
1029           //===================================================
1030
1031           img_finale.height = Image_height;
1032           img_finale.width = Image_width;
1033           if (theme.match(RegExp("stripped", "gi"))) {
1034             img_finale.width -= (llgboframe.top * 2);
1035             if (rapport > 0) img_finale.height = (img_finale.width / rapport);
1036             else img_finale.height -= (llgboframe.top * 2);
1037
1038           }
1039           zoom = echelle;
1040           if (typeof (llgboframe) != "undefined" && llgboframe.height > 0) {
1041             //=============LLGBO2 ===========================
1042             t1 = llgboframe;
1043             if (!The_MainImage.src) {
1044               The_MainImage = jQuery("#gbo").find("img").get(0)
1045               if (!The_MainImage.src) {
1046                 The_MainImage = jQuery(Parent).find("div").get(0)
1047               }
1048             }
1049             if (The_MainImage.src) {
1050               wingbo = img_finale.width;
1051               heightgbo = img_finale.height;
1052               if (Type_Img == "panorama") {
1053                 heightgbo = info_theImage.height;
1054                 img_finale.height = info_theImage.height;
1055               }
1056
1057               img_finale.width -= marges_llgbo;
1058               if (jQuery("#slideshow").infos().width > 0) {
1059                 img_finale.height -= (marges_llgbo * 1.5);
1060               } else {
1061                 img_finale.height -= marges_llgbo
1062               }
1063
1064
1065               if (wingbo > winwidth) {
1066                 jQuery("#gbo").width(winwidth);
1067                 jQuery("#gbo").height(winheight);
1068                 jQuery("#gbo").css("width", winwidth + "px");
1069                 jQuery("#gbo").css("height", winheight + "px");
1070               }
1071               else {
1072                 jQuery("#gbo").width(wingbo);
1073                 jQuery("#gbo").height(heightgbo);
1074                 jQuery("#gbo").css("width", wingbo + "px");
1075                 jQuery("#gbo").css("height", heightgbo + "px");
1076               }
1077
1078               a0 = jQuery("area[rel!=up][rel!=prev][rel!=next]");
1079               a1 = jQuery("area[rel=prev]");
1080               a2 = jQuery("area[rel=next]");
1081               a3 = jQuery("area[rel=up]");
1082               nb_zone = 3;
1083               if (a1.length == 0) {
1084                 nb_zone -= 1;
1085               }
1086               if (a2.length == 0) {
1087                 nb_zone -= 1;
1088               }
1089
1090
1091               var Largeur_zone = (img_finale.width / nb_zone);
1092               var Hauteur_zone = (img_finale.height);
1093               var init_zone = 0;
1094
1095               if (a1.length > 0) {
1096                 coord = { x0: init_zone, y0: 0, x1: Largeur_zone, y1: Hauteur_zone };
1097
1098                 jQuery("area[rel=prev]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
1099                 init_zone += Largeur_zone;
1100               }
1101
1102               coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
1103
1104               if (a0.length > 0) {
1105                 jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1 / 2) + "'" });
1106                 jQuery(a0).attr({ coords: "'" + coord.x0 + "," + (coord.y1 / 2) + "," + coord.x1 + "," + (coord.y1) + "'" });
1107               } else {
1108                 jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1) + "'" });
1109               }
1110               init_zone += Largeur_zone;
1111
1112               if (a2.length > 0) {
1113                 coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
1114                 jQuery("area[rel=next]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
1115               }
1116               //    jQuery("#theImage").height(heightgbo + marges_llgbo / 2);
1117             }
1118           }
1119
1120           //================ Zone affichage =========================
1121
1122
1123           //  jQuery(Cadre).css("top", "0px");
1124           jQuery("#standard").css("top", 0 + "px");
1125           jQuery("#comments").css("top", 0 + "px");
1126           //========== Image Remise à l'échelle =======================
1127
1128           img_finale.height = parseInt(img_finale.height);
1129           img_finale.width = parseInt(img_finale.width);
1130           //=========================================================================
1131           //=== cadre = theImage
1132           if (theme.match(RegExp("simple", "gi"))) {
1133             jQuery(Cadre).width(Zone_Affichage.width); //centrer simple black
1134             jQuery(Cadre).css({ width: Zone_Affichage.width + "px",
1135               marginLeft: "auto"
1136             });
1137
1138           } else if (theme.match(RegExp("sobre", "gi")) || theme.match(RegExp("hr_", "gi")) || theme.match(RegExp("Mont", "gi"))) {
1139             jQuery(Cadre).css({ width: "auto", marginLeft: "auto" });
1140           } else if (theme.match(RegExp("saruka", "gi"))) {
1141
1142             jQuery(Cadre).css({ width: Zone_Affichage.width + "px" });
1143
1144           } else {
1145             jQuery(Cadre).css("width", "auto");
1146
1147           }
1148           // ;
1149
1150           if (Type_Img == "panorama" || Type_Img == "pamoorama") {
1151             img_finale.height = info_theImage.height;
1152             Zone_Affichage.height = img_finale.height;
1153
1154           }
1155
1156           if (typeof (gmaps) != "undefined") {
1157             Gmap_ = gmaps.maps[0];
1158             if (Gmap_.sizeMode == 'A') {
1159               jQuery("#iGMapsIcon").css({ width: old_window.width * 0.8 + "px", height: old_window.height * 0.8 + "px" });
1160
1161             }
1162           }
1163           //============= flv,mov,mpg  ok
1164           /* wmv nok
1165           * avi nok
1166           //===========================================
1167           */
1168           if (Type_Img == "charlie") {
1169             t1 = jQuery("#charlie").infos();
1170
1171             /**/
1172
1173             pdf = 0;
1174             jQuery("#charlie div").each(function (i) {
1175
1176
1177               p1 = jQuery(this).infos();
1178               pdf += p1.padding.right + p1.padding.left;
1179             });
1180             img_finale.width -= pdf;
1181
1182             jQuery("#charlie").css({
1183               width: img_finale.width + pdf + "px",
1184               height: img_finale.height + "px",
1185               marginLeft: "auto"
1186             });
1187
1188
1189             if (MainImage.length > 0) {
1190               img_finale.height = parseInt(img_finale.width / rapport);
1191               img_finale.height -= 30;
1192               img_finale.width = rapport * img_finale.height;
1193
1194
1195               MainImage.width(img_finale.width);
1196               MainImage.height(img_finale.height);
1197               jQuery("#embedplayer").width(300);
1198               jQuery("#embedplayer").height(15);
1199             } else {
1200               jQuery("#player").css("width", img_finale.width + "px");
1201               jQuery("#player").css("height", img_finale.height + "px");
1202
1203               jQuery("#embedplayer").css("width", img_finale.width + "px");
1204               jQuery("#embedplayer").css("height", img_finale.height + "px");
1205
1206               jQuery("embed").css({ width: img_finale.width + "px",
1207                 height: img_finale.height + "px"
1208               });
1209               jQuery("object").css({ width: img_finale.width + "px",
1210                                    height: img_finale.height + "px"
1211                                  });
1212              jQuery("video").css({ width: img_finale.width + "px",
1213                                    height: img_finale.height + "px"
1214                                  });
1215
1216
1217
1218               jQuery("video").height(img_finale.height);
1219               jQuery("video").width(img_finale.width);
1220
1221               jQuery("object").width(img_finale.width);
1222               jQuery("object").height(img_finale.height);
1223               //jQuery(Cadre).height(img_finale.height + Bandeau_bas.height); //??             
1224
1225               jQuery(The_MainImage).height(img_finale.height);
1226               jQuery(Cadre).css("height", "auto");
1227             }
1228
1229
1230           } else if (Type_Img == "embed") {
1231
1232             if (MainImage.length > 0) {
1233               img_finale.height = parseInt(img_finale.width / rapport);
1234               img_finale.height -= 30;
1235               img_finale.width = rapport * img_finale.height;
1236
1237
1238               MainImage.width(img_finale.width);
1239               MainImage.height(img_finale.height);
1240               jQuery("#embedplayer").width(300);
1241               jQuery("#embedplayer").height(15);
1242             } else {
1243               jQuery(Cadre).css("height", "auto");
1244               jQuery("embed").css("height", img_finale.height);
1245               jQuery("object").css({ height: img_finale.height + "px" });
1246
1247               jQuery("object").width(img_finale.width);
1248               jQuery("object").height(img_finale.height);
1249             }
1250
1251           } else if (Type_Img == "panorama") {
1252             if (typeof asp_options != "undefined")
1253               n = asp_options;
1254             n1 = jQuery("#Panorama div").width();
1255             jQuery(".panorama-viewport").css("margin", "auto");
1256             n = info_imageToolBar;
1257
1258
1259           } else if (Type_Img == "pamoorama") {
1260
1261
1262
1263             info_theImage.height = Zone_Affichage.height;
1264             img_height = myPamoorama.imageHeight
1265             if (theme.match(RegExp("simple", "g"))) {
1266               //  marge_right = 2;
1267             }
1268             new_width = Zone_Affichage.width - marge_right - marge_left;
1269             new_width = Zone_Affichage.width - (info_theImage.borderwidth.right + info_theImage.borderwidth.left);
1270             if (new_width > myPamoorama.imageWidth)
1271               new_width = myPamoorama.imageWidth;
1272
1273
1274
1275             Zone_Affichage.height += info_pamoorama_footer.height;
1276             zoom = info_theImage.height / img_height;
1277             myPamoorama.options.width = new_width * zoom;
1278             //  if(msie || safari) jQuery("#pamoorama_inner ").css({ zoom: zoom });
1279             //====================================================
1280             jQuery("#pamoorama").css({
1281               marginLeft: "auto",
1282               marginRight: "auto",
1283               //height: Zone_Affichage.height + "px", sinon déclenchement panorama sur la hauteur;
1284               width: new_width + "px"
1285             });
1286             jQuery("#pamoorama").width(new_width);
1287
1288             //====================================================
1289             info_pamoorama = jQuery("#pamoorama").infos();
1290             img_finale.height = info_pamoorama.height - info_pamoorama_footer.height;
1291             img_finale.width = new_width;
1292
1293             jQuery("#pamoorama_outter").width(new_width);
1294
1295             jQuery("#pamoorama_thumb").width(200 / zoom);
1296             // commenter sinon outter augmente à chaque resize
1297             //  jQuery("#pamoorama_outter").height(info_pamoorama.height - info_pamoorama_footer.height);
1298             // pamoorama_frame
1299
1300
1301             jQuery("#pamoorama_outter").css({ width: new_width + "px" });
1302             jQuery("#pamoorama_footer").css({ width: new_width + "px" });
1303             //
1304             //====================================================
1305             info_pamoorama = jQuery("#pamoorama").infos();
1306             info_pamoorama_outter = jQuery("#pamoorama_outter").infos();
1307             info_pamoorama_inner = jQuery("#pamoorama_inner").infos();
1308             info_pamoorama_footer = jQuery("#pamoorama_footer").infos();
1309             info_pamoorama_frame = jQuery("#pamoorama_frame").infos();
1310
1311             info_frame = jQuery(myPamoorama.frame).infos();
1312
1313
1314
1315           } else if (The_MainImage != null && The_MainImage.src) {
1316             //--- background ?? ---
1317             jQuery(The_MainImage).height(img_finale.height);
1318             jQuery(The_MainImage).width(img_finale.width);
1319             jQuery(The_MainImage).css({ height: img_finale.height + "px ",
1320               width: img_finale.width + "px "
1321             });
1322
1323
1324           } else {
1325             //===map ? luciano ===
1326             jQuery(The_MainImage).height(img_finale.height);
1327             jQuery(The_MainImage).width(img_finale.width);
1328             jQuery(The_MainImage).css({ height: img_finale.height + "px ",
1329               width: img_finale.width + "px "
1330             });
1331             if (theme.match(RegExp("luciano", "g"))) {
1332               imgl = 180;
1333               l = Zone_Affichage.left;
1334
1335               jQuery(".imageNumber").css({ left: l + "px"
1336
1337               });
1338               jQuery(Parent + " #theImg IMG").css({ height: img_finale.height + "px ",
1339                 width: (img_finale.width - imgl) + "px ", marginTop: "0px"
1340               })
1341             }
1342
1343           }
1344
1345           jQuery("#navThumbPrev").css({ overflow: "hidden" });
1346           jQuery("#navThumbNext").css({ overflow: "hidden" });
1347           n = typeof inittoolbar;
1348           if (Type_Img == "map") {
1349             jQuery("#navThumbNext").css({ display: 'none' });
1350             jQuery("#navThumbPrev").css({ display: 'none' });
1351             jQuery("#theImage").css({ marginTop: info_ToolBar.height + "px", marginLeft: "0px",
1352               width: winwidth + "px",
1353               height: winheight + "px"
1354             });
1355             //mapPicture
1356           }
1357           try {
1358             if (theme.match(RegExp("gally", "gi"))) {
1359               if (typeof inittoolbar == "function") {
1360                 if (typeof (currentTab) == "undefined") inittoolbar();
1361                 else initializeImageMode("resize");
1362               } else {
1363                 tp = gallyPP.getImageProp();
1364                 if (typeof (GallyPP) == "function")
1365                   gallyPP = new GallyPP();
1366
1367                 iph = jQuery("#imageHeaderBar").infos();
1368                 jQuery("#imageToolBar").css({ top: iph.bottom + "px", position: "absolute" });
1369                 jQuery("#theImage").width(winwidth);
1370               }
1371               //===========================================================================
1372               if (jQuery("#navThumbPrev").length > 0) {
1373                 jQuery("#navThumbPrevContainer").css({ left: "0px"
1374                 });
1375               }
1376               if (jQuery("#navThumbNext").length > 0) {
1377                 jQuery("#navThumbNextContainer").css({ left: "0px"
1378                 });
1379               }
1380               //=============================================================================
1381               if (!theme.match(RegExp("lapis", "gi"))) {
1382                 if (typeof initializeImageMode == "function") {
1383                   initializeImageMode("resize");
1384                 }
1385
1386               }
1387
1388             } else if (theme.match(RegExp("simple", "g"))) {
1389
1390               jQuery("#imageToolBar").css({ position: "static" });
1391
1392               info_imageInfoBar = jQuery("#imageInfoBar").infos();
1393               if (info_imageInfoBar.bottom < info_img.bottom) {
1394                 //   jQuery("#imageInfoBar").height(info_img.bottom);
1395               }
1396
1397             } else {
1398
1399               //    jQuery("#imageToolBar").css("position", "static");
1400             }
1401           } catch (e) {
1402
1403           }
1404           zoom = img_finale.height / img_height;
1405           h0 = jQuery("#content").height();
1406           if (h0 == null) {
1407             h0 = winheight - Zone_Affichage.top;
1408           }
1409           h1 = (h0 - img_finale.height) / 2;
1410           //  jQuery(Parent).css({ marginTop: h1 + "px" });
1411
1412           zoom = parseInt(zoom * 100);
1413           jQuery('#zoom ').val(zoom);
1414           set_cl();
1415
1416         
1417           //  --- réglage de la hauteur de page en fonction du copyright-----------
1418           if (typeof (pos_copyright) == "undefined") pos_copyright = jQuery("#copyright").infos();
1419
1420           if (theme.match(RegExp("stripped", "gi"))) {
1421             var TitleBox = jQuery("#imageTitleContainer");
1422             if (TitleBox.length != 0) TitleBox.css("width", img_finale.width + "px");
1423           } else {
1424
1425           }
1426
1427
1428           /*
1429           if (!theme.match(RegExp("luciano", "gi"))) {
1430           jQuery("#linkNext").css({ height: "80px", width: "200px", overflow: "hidden" });
1431           jQuery("#linkPrev").css({ height: "80px", width: "200px", overflow: "hidden" });
1432           jQuery(".navThumb img").css({ height: "80px", width: "", overflow: "hidden" });
1433           }
1434           */
1435           info_frame = jQuery(Cadre).infos();
1436           if (theme.match(RegExp("stripped", "gi"))) {
1437             /*
1438             info_theImageBox = jQuery("#theImageAndTitle").infos();
1439             p1 = jQuery(".randomButtons").infos();
1440             p2 = jQuery("#imageHeaderBar").infos();
1441             p3 = info_content.top;
1442             p1 = options.imageAutosizeTitle;
1443
1444             jQuery("#theImage").width("width", info_theImageBox.width + "px");
1445             //jQuery("#theImageAndTitle").css("position", "relative");
1446             jQuery("#content").css({ position: "relative", top: "10px", marginTop: "0px",
1447             paddingTop: "0px", textAalign: "center", marginLeft: "auto"
1448             });
1449
1450             jQuery("#theImageAndTitle").css({ position: "relative", top: "0px", marginTop: "0px",
1451             paddingTop: "0px", marginLeft: "auto"
1452             }); */
1453             t1 = info_theImageBox.top;
1454             l1 = info_theImageBox.left;
1455             // info_theImageBox = jQuery(Parent).infos();
1456
1457           } else {
1458
1459             t1 = info_frame.top;
1460             l1 = info_frame.left;
1461             info_theImageBox = jQuery(Parent).infos(); //theImage
1462           }
1463           info_theImageBox.margin.margin = info_frame.margin.margin;
1464           info_theImageBox.top = t1;
1465           info_theImageBox.left = l1;
1466           //  info_theImageBox.position = "absolute";
1467
1468           Window_Affichage = info_theImageBox;
1469           if (DEBUG_autosize == "_true") {
1470             //   jQuery(Cadre).css("border", "solid green");
1471
1472             jQuery("#Debug5").css({ background: "red",
1473               position: "absolute",
1474               border: "green solid 2px",
1475               textAlign: align_auto,
1476               margin: "auto",
1477               top: Window_Affichage.top + "px",
1478               left: Window_Affichage.left + "px",
1479               width: Window_Affichage.width + "px",
1480               height: Window_Affichage.height + "px"
1481             }); //red
1482             jQuery("#Debug4").css({ top: info_frame.bottom - info_description.height + "px" }); //green
1483           }
1484
1485           //Wait_Affichage();
1486
1487           return true;
1488           //_____________________________________________________
1489         } // Resize();
1490
1491
1492         //======================================================================
1493
1494
1495       });            // fin extend
1496
1497
1498
1499     } // function
1500);
1501
1502
1503/*
1504* recherche la plus grande image (hauteur ou largeur)
1505*/
1506function Get_Img_Maxi(myobj) {
1507    var w00 = 0;
1508    var myImg = null;
1509 
1510    img = jQuery("#theMainImage");
1511    if (img != null) {
1512return;
1513
1514    } 
1515     img = jQuery(myobj);
1516
1517    img = jQuery('img[alt]');
1518
1519    jQuery(myobj).each(function (i) {
1520        w0 = img_reelle.width;
1521        h0 = img_reelle.height;
1522        if (h0 > w0) w0 = h0;
1523        if (w0 > w00) {
1524            if (!this.src.match(RegExp(".png", "g")))
1525                if (!this.src.match(RegExp(thumbnail, "g"))) {
1526                    myImg = this;
1527           jQuery( myImg).addClass("Image");
1528                    w00 = w0;
1529                }
1530
1531        }
1532    });
1533    return myImg;
1534}
1535
1536//============================================================
1537/*
1538*
1539*/
1540
1541function Info_entete(Parent) {
1542
1543    info_imageToolBar = jQuery("#imageToolBar").infos();
1544    if (typeof (marge_top) != "undefined") return result;
1545
1546    if (info_imageToolBar.position == "absolute") {
1547        jQuery("#imageToolBar").css("position", "relative");
1548        jQuery("#imageToolBar").css("top", 0 + "px");
1549    }
1550    optiontop = 0;
1551
1552
1553    info_imageInfoBar = jQuery("#imageInfoBar").infos();
1554
1555    jQuery("#" + "theImgContainer").css("marginTop", "0px");
1556    info_thePicturePage = jQuery("#thePicturePage").infos();
1557    info_theImage = jQuery(Parent).infos();
1558    if (theme.match(RegExp("stripped", "gi"))) {
1559        info_theImageAndTitle = jQuery("#theImageAndTitle").infos();
1560        info_theImageBox = jQuery("#theImageBox").infos();
1561        optiontop = (marges_llgbo / 2) + info_theImageAndTitle.margin.top;
1562    }
1563
1564    if (info_theImage.position == "relative") {
1565        //--- passage relative ==> static ===/
1566        jQuery(Parent).css("position", "static");
1567        info_theImage = jQuery(Parent).infos();
1568
1569    } else {
1570
1571    }
1572    if (info_theImage.position == "absolute") {
1573        //--- passage absolute ==> static ===/
1574        jQuery(Parent).css("position", "static");
1575        info_theImage = jQuery(Parent).infos();
1576
1577    }
1578
1579    marge_top = Math.ceil(Info_the_page.top +
1580                                     Info_the_page.borderwidth.top +
1581                                     info_theImage.borderwidth.top +
1582                                     info_thePicturePage.margin.top
1583                                     );
1584
1585    img_top = Math.ceil(info_theImage.top +
1586                        info_theImage.padding.top +
1587                        info_theImage.borderwidth.top +
1588                        info_thePicturePage.margin.top + optiontop);
1589    result = info_imageToolBar;
1590   // result.width = "20%";
1591   // result.left = "40%";
1592    result.marge_top = marge_top;
1593    result.img_top = img_top;
1594    //=== Afficher le titre de l'image sur le cadre ===
1595    llgboh2 = jQuery("#gboh2").infos();
1596    llgbo = jQuery("#gbo").infos();
1597
1598    if (llgboh2.top > 0)
1599      result.img_top = llgboh2.top - (llgboh2.height * 2);
1600    else if (marges_llgbo > 0)
1601      result.img_top -= (8);
1602
1603 
1604    return result;
1605
1606}
1607
1608/* Récupère les informations sur la description.
1609*
1610*/
1611type_src = "div";
1612//====================================================
1613function Info_Description_f(Parent) {
1614    jQuery(Parent).css({ display: "block" });
1615    //====== détection du type d'images ======
1616    if (jQuery("#charlie").length > 0) {
1617      Type_Img = "charlie";
1618    }else    if (jQuery("#Panorama").length) {
1619        Type_Img = "panorama";
1620    } else if (jQuery("#pamoorama").length) {
1621        Type_Img = "pamoorama";
1622     } else if (jQuery("#map").length) {
1623        Type_Img = "map";
1624     } else if (jQuery("#Panorama").length) {
1625        Type_Img = "panorama";
1626    } else  if ( (jQuery(Parent + " iframe").length + jQuery(Parent + " object").length + jQuery(Parent + " embed").length ) > 0)  {
1627 
1628    if (jQuery(Parent + " object").length > 0) {     
1629
1630        type_src = "object";
1631
1632    } else if (jQuery(Parent + " embed").length > 0) {
1633
1634        type_src = "embed";
1635
1636    } else {
1637
1638        type_src = "iframe";
1639    }
1640        nbf = jQuery(Parent + " " + type_src).length;
1641        frm1 = jQuery(Parent + " " + type_src).get(0) ;
1642        Type_Img = "charlie";
1643
1644        //'fb - xfbml - like - button
1645
1646        objs = jQuery(Parent + " div").get(0);
1647        if (jQuery(objs).length > 0) {
1648          id_0 = jQuery(objs).attr("id");     
1649        if (id_0 == "") {
1650          jQuery(objs).attr("id", "charlie");
1651        } else {
1652          if (nbf > 1) {
1653            jQuery(frm1).attr("id", "charlie");
1654          } else {
1655            Type_Img = "img";
1656          }           
1657        }
1658        } else {
1659         jQuery(frm1).attr("id", "charlie");
1660        }
1661       
1662
1663    } else if (jQuery(Parent).find("img").length > 0) {
1664        Type_Img = "img";
1665    } else if (jQuery(Parent + "Box").find("img").length > 0) {
1666        Type_Img = "img";
1667        Parent = Parent + "Box";
1668    } else if (jQuery("img").length > 0) {
1669        Type_Img = "img_autre";
1670        return;
1671    } else {
1672        return;
1673    }
1674      //=========================================================
1675      if (jQuery("#charlie").length > 0) {
1676        jQuery("#charlie").css({
1677          paddingTop: "0px",
1678          marginTop: "0px",
1679          paddingBottom: "0px",
1680          marginBottom: "0px"
1681        });
1682
1683      } 
1684    // jQuery(Parent + " p:not(:contains(' ')) ").remove();
1685    // jQuery(Parent + " p:(:contains('')) ").remove();
1686    llgboframe = jQuery("#gbo").infos();
1687    marges_llgbo = 0;
1688
1689    if (llgboframe.height > 0) {
1690        ll2 = jQuery("#gbo div:last").infos();
1691        ll1 = jQuery("#gbo div:first").infos();
1692        ll2 ="" ;
1693        jQuery("#gbo div").each(function (i) {
1694
1695         if (  this.id=="") return ;
1696ll2=this ;
1697        });
1698       ll2 = jQuery(ll2).infos();
1699        ll1 = ll1.width;
1700        ll2 = ll2.width - ll2.borderwidth.left - ll2.borderwidth.right;
1701        marges_llgbo = (ll1 - ll2);
1702
1703    }
1704
1705      Bandeau_t = Info_entete(Parent);
1706
1707    Bandeau = Bandeau_t.img_top;
1708    info_theImgContainer = jQuery("#" + "theImgContainer").infos();
1709    info_description = jQuery("#" + "description").infos();
1710    //=============================================================================
1711    //   jQuery(Parent + " p").css({ padding: "0px", margin: "0px "    });
1712    if (theme.match(RegExp("simple", "gi"))) {
1713        jQuery(Parent).css({ padding: "0px",
1714            marginLeft: "0px",
1715            marginRight: "auto",
1716            marginTop: "0px",
1717            marginBottom: "0px"
1718
1719        });
1720    }
1721
1722
1723    if (theme.match(RegExp("luciano", "g"))) {
1724        jQuery("#imageContainer").css({ height: "auto" });
1725        The_MainImage = jQuery(Parent + " #theImg img");
1726        info_img = jQuery(The_MainImage).infos();
1727
1728
1729    } else if (Type_Img == "map") {
1730
1731        info_map = jQuery("#mapPicture").infos();
1732        marge_left = info_map.width;
1733
1734        jQuery("#map").css({ left: marge_left + "px", padding: "0px",
1735            marginLeft: "0px",
1736            marginRight: "4px",
1737            marginTop: "0px",
1738            marginBottom: "0px",
1739            position: "relative"
1740        });
1741
1742        The_MainImage = jQuery("#map");
1743        info_img = jQuery(The_MainImage).infos();
1744
1745
1746      } else if (jQuery("#charlie").length > 0) {
1747        info_charlie = jQuery("#charlie").infos();
1748        obj_charlie = jQuery("object");
1749        try {
1750          tp = obj_charlie.attr();
1751        } catch (e) {
1752          tp = obj_charlie.prop();
1753        }
1754
1755        if (tp!=undefined) {
1756          if (obj_charlie.length > 0)
1757            tp = jQuery("object").attr("type") || jQuery("object").prop("type");
1758          else
1759            tp = jQuery("embed").attr("type") || jQuery("embed").prop("type");
1760        }
1761
1762     if (tp == 'application/x-shockwave-flash') {
1763          jQuery("#charlie").css({
1764            paddingTop: "0px",
1765            marginTop: "0px",
1766            paddingBottom: "30px",
1767            marginBottom: "0px"
1768          });
1769        } else {
1770       
1771        }
1772
1773        var MainImage = jQuery("#theMainImage");
1774
1775        if (MainImage.length == 0) {
1776          The_MainImage = jQuery("#charlie");
1777          info_img = jQuery(The_MainImage).infos();
1778        } else {
1779          The_MainImage = jQuery("#theMainImage");
1780          info_img = jQuery(The_MainImage).infos();
1781         
1782        }
1783 
1784 
1785    } else if (jQuery(Parent + " embed").length > 0) {
1786    if (jQuery("#theMainImage").lenght == 0) {
1787      The_MainImage = jQuery(Parent + " embed");
1788      info_img = jQuery(The_MainImage).infos();
1789      jQuery(Parent + " embed").width({ width: info_img.width + "px", height: info_img.height + "px" });
1790    } else {
1791      The_MainImage = jQuery("#theMainImage");
1792      info_img = jQuery(The_MainImage).infos();
1793      Type_Img == "charlie"
1794      if (info_img.width == 0) {
1795        The_MainImage = jQuery("#theMainImage");
1796        info_img = jQuery(The_MainImage).infos();
1797
1798      }
1799    }
1800
1801    } else if (Type_Img == "pamoorama") {
1802        if (!nopano) {
1803            Wait_pamoorama();
1804            return info_description;
1805        }
1806        The_MainImage = jQuery("#pamoorama");
1807        info_img = jQuery(The_MainImage).infos();
1808        info_footer = jQuery("#pamoorama_footer").infos();
1809        info_img.height = parseInt(img_reelle.height) + parseInt(info_footer.height);
1810
1811      } else {
1812        var MainImage = jQuery("#theMainImage");
1813
1814        if (MainImage.length == 0) {
1815          The_MainImage = jQuery(Parent + " img[alt]");
1816        } else {
1817          The_MainImage = MainImage;   
1818        }
1819
1820     
1821        if (!The_MainImage)
1822            The_MainImage = jQuery(Parent);   // sans img ??
1823        if (The_MainImage.length > 1) {
1824        The_MainImage = The_MainImage[0];
1825          }
1826
1827        info_img = jQuery(The_MainImage).infos();
1828    }
1829    //=====================================================================================
1830
1831    switch (info_img.position) {
1832        case "relative":
1833            break;
1834        case "static":
1835            break;
1836        case "absolute":
1837            break;
1838        case "":
1839            break;
1840        default:
1841            break;
1842    }
1843
1844    info_description.marge = {
1845        bottom: info_img.padding.bottom + info_img.margin.bottom + info_img.borderwidth.bottom,
1846        top: info_img.padding.top + info_img.borderwidth.top + info_img.margin.top
1847    }
1848
1849    if (llgboframe.height > 0) info_img = llgboframe; // format de l'image+largeur du cadre
1850
1851    if (theme.match(RegExp("luciano", "g"))) {
1852
1853        info_theImgContainer = jQuery("#imageContainer").infos();
1854        info_description.bottom = jQuery("#imageInfo").infos().top;
1855        info_description.top = info_theImgContainer.bottom;
1856        Info_slidshowToolBar = jQuery("#slidshowToolBar").infos();
1857
1858        if (Info_slidshowToolBar.height > 0) {
1859            correction = (Info_slidshowToolBar.height);
1860            info_description.top = info_img.bottom;
1861            info_description.bottom = jQuery("#copyright").infos().top;
1862        }
1863
1864        //=========================================================
1865    } else if (theme.match(RegExp("stripped", "gi"))) {
1866        //options.imageAutosize
1867          //options.imageMargin
1868          jQuery("#content").css({paddingTop:"5px"});
1869    info_content = jQuery("#content").infos();
1870        if (options.imageAutosizeTitle == false) {
1871            info_description.top =   info_theImageBox.bottom ;
1872
1873            info_description.bottom =info_HeaderBar.margin.top+ info_description.top +
1874                                    info_description.borderwidth.top +
1875                                    info_description.borderwidth.bottom +
1876                                      options.imageAutosizeMargin*2 +
1877                                    (marges_llgbo / 2)+4;
1878
1879        } else {
1880
1881
1882            info_description.top = info_theImageBox.bottom -
1883                        info_content.top +
1884                        options.imageAutosizeMargin * 2  +
1885                        (marges_llgbo / 2)
1886                                ;
1887            info_description.bottom = jQuery("#tabZone").infos().top +
1888                        info_theImageAndTitle.margin.top;
1889           if (msie == true) info_description.bottom -= 4;
1890        };
1891        check_desc_v = true;
1892
1893      } else {
1894        if (theme.match(RegExp("sobre", "gi"))) {
1895          info_description.marge.top = -2;
1896        }
1897        info_description.bottom = info_theImage.bottom; //482
1898        info_description.top = info_img.height + info_theImage.top ; //410+62
1899        // info_description.bottom -= info_img.top;
1900    }
1901    //
1902
1903    info_description.height =   info_description.bottom - info_description.top;
1904
1905    if (check_desc_v == false) {
1906        info_description.height = 0;
1907    }
1908
1909    Debug_pos();
1910
1911    //cl_visible=false ;
1912    return info_description;
1913}
1914
1915//====================================================
1916function Debug_info(index, infos, nom) {
1917
1918    if (infos.height > 0) {
1919
1920        message = browser.browser + " -- > Info : " + nom + " " + infos.id + "\n" +
1921                 "Info nodeName: " + infos.nodeName + "\n" +
1922                 "Info width: " + infos.width + "\n" +
1923                 "Info height: " + infos.height + "\n" +
1924                 "Info top: " + infos.top + "\n" +
1925                 "Info left: " + infos.left + "\n" +
1926                 "Info position: " + infos.position + "\n";
1927
1928        myDebug = { id: "Debug" + index, texte: message,
1929            css: {
1930                color: "black",
1931                opacity: "0.5",
1932                position: "absolute",
1933                height: infos.height || 100 + "px",
1934                width: infos.width || 300 + "px",
1935                left: infos.left || 0 + "px",
1936                border: "solid 1px green",
1937                top: infos.top + "px"
1938
1939            }
1940        }
1941        return myDebug;
1942    } else {
1943        return null;
1944    }
1945
1946
1947}
1948//====================================================
1949function Debug_pos() {
1950  return;
1951    if (DEBUG_autosize == "true") {
1952
1953        jQuery("[id ^='Debug']").show();
1954        /*
1955        Debug2  background-color:yellow
1956        Debug3 background-color:blue
1957        Debug4 background-color:green
1958        Debug5 background-color:red
1959
1960        */
1961
1962        affiche_debug({
1963            Debug1: Debug_info(1, Bandeau_t, "Bandeau_t"),
1964            Debug4: Debug_info(4, info_description, "info_description"),
1965            Debug5: Debug_info(5, info_img, "info_img")
1966        });
1967    }
1968}
1969
1970function affiche_debug(aff_infos) {
1971    jQuery(jQuery("[id ^='Debug']")).each(function (i) {
1972        if (aff_infos[this.id]) {
1973            if (aff_infos[this.id].css) {
1974                jQuery("#" + this.id).css(aff_infos[this.id].css);
1975                jQuery("#" + this.id).text(aff_infos[this.id].texte);
1976            }
1977        }
1978    });
1979    return;
1980
1981}
1982
1983
1984
1985
1986jQuery(function () {
1987  //'gallyInterfaceReady'
1988
1989  jQuery('#pamoorama').live('ON', function (e) {
1990    jQuery(jQuery('.debug').get(1)).trigger('ON');
1991    if (typeof Bandeau_bas == "undefined" || Bandeau_bas.width == 0) {
1992      Bandeau_bas = Info_Description_f(Parent);
1993      Bandeau = Bandeau_bas.top;
1994      old_window = { width: 0, height: 0 };
1995      jQuery(window).resize();
1996
1997    }
1998
1999  });
2000
2001
2002
2003  jQuery('#ret_autosize').live('ON', function (e) {
2004    if (nu_img == "") nu_img = 8 ;
2005    jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
2006
2007  });
2008
2009  jQuery(Parent).live('ON', function (e) {
2010    if (nu_img == "") nu_img = 7;
2011    jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
2012    jQuery().newResize();
2013  });
2014  // Custom Event, ON to turn on a debug.
2015  jQuery('.debug').live('ON', function (e) {
2016 
2017    nu_img = jQuery(this).text();
2018    jQuery('.debug').trigger('OFF');
2019    jQuery(this).addClass('debugOn');
2020   
2021  });
2022
2023  // On Click = debugs On
2024  jQuery('.debug').live('click', function (e) {
2025    i = jQuery(this).text();
2026    jQuery(this).trigger('ON');
2027  });
2028
2029  // Custom Event, Turn off a debug
2030  jQuery('.debug').live('OFF', function (e) {
2031    jQuery(this).removeClass('debugOn');
2032  });
2033
2034  // on Double Click, remove the debug from the DOM
2035  jQuery('.debug').live('dblclick', function () {
2036    jQuery(this).fadeOut(function () { jQuery(this).remove() });
2037  });
2038
2039  // Add another debug to the DOM
2040  jQuery('#adddebugs').click(function () {
2041    i = jQuery('.debug').length;
2042    jQuery('<div>' + i + '</div>')
2043            .addClass('debug')
2044            .appendTo('#debugsContainer');
2045  });
2046
2047  // Add 10 testing debugs to start with
2048  jQuery(window).load(function () {
2049    DEBUG_autosize = (typeof DEBUG_autosize != "undefined") ? DEBUG_autosize : "false";
2050    if (DEBUG_autosize == "true") {
2051      for (var i = 0; i < 10; i++) {
2052        jQuery('#adddebugs').click();
2053      }
2054      jQuery(jQuery('.debug').get(i - 1)).click();
2055    }
2056
2057  }); //on load
2058});
Note: See TracBrowser for help on using the repository browser.