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

Last change on this file since 12059 was 12059, checked in by cljosse, 13 years ago

[extensions] Autosize

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