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

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

[extensions] Autosize fix bug with cmd restore

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