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

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

[extensions] autosize fix margin theImgage auto

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