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

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

[extensions] autosize compatibility with theme simple

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           zoom = echelle;
804           if (llgboframe.height > 0) {
805             //=============LLGBO2 ===========================
806             t1 = llgboframe;
807             if (!TheImg.src) {
808               TheImg = jQuery(TheImg).find("img").get(0)
809               if (!TheImg.src) {
810                 TheImg = jQuery(Parent).find("div").get(0)
811               }
812             }
813             if (TheImg.src) {
814
815
816               wingbo = img_finale.width;
817               heightgbo = img_finale.height;
818               if (Type_Img == "panorama") {
819                 heightgbo = info_theImage.height;
820                 img_finale.height = info_theImage.height;
821               }
822
823               img_finale.width -= marges_llgbo;
824               if (jQuery("#slideshow").infos().width > 0) {
825                 img_finale.height -= (marges_llgbo * 1.5);
826               } else {
827                 img_finale.height -= marges_llgbo
828               }
829
830
831               if (wingbo > winwidth) {
832                 jQuery("#gbo").width(winwidth);
833                 jQuery("#gbo").height(winheight);
834                 jQuery("#gbo").css("width", winwidth + "px");
835                 jQuery("#gbo").css("height", winheight + "px");
836               }
837               else {
838                 jQuery("#gbo").width(wingbo);
839                 jQuery("#gbo").height(heightgbo);
840                 jQuery("#gbo").css("width", wingbo + "px");
841                 jQuery("#gbo").css("height", heightgbo + "px");
842               }
843
844               a0 = jQuery("area[rel!=up][rel!=prev][rel!=next]");
845               a1 = jQuery("area[rel=prev]");
846               a2 = jQuery("area[rel=next]");
847               a3 = jQuery("area[rel=up]");
848               nb_zone = 3;
849               if (a1.length == 0) {
850                 nb_zone -= 1;
851               }
852               if (a2.length == 0) {
853                 nb_zone -= 1;
854               }
855
856
857               var Largeur_zone = (img_finale.width / nb_zone);
858               var Hauteur_zone = (img_finale.height);
859               var init_zone = 0;
860
861               if (a1.length > 0) {
862                 coord = { x0: init_zone, y0: 0, x1: Largeur_zone, y1: Hauteur_zone };
863
864                 jQuery("area[rel=prev]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
865                 init_zone += Largeur_zone;
866               }
867
868               coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
869
870               if (a0.length > 0) {
871                 jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1 / 2) + "'" });
872                 jQuery(a0).attr({ coords: "'" + coord.x0 + "," + (coord.y1 / 2) + "," + coord.x1 + "," + (coord.y1) + "'" });
873               } else {
874                 jQuery("area[rel=up]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + (coord.y1) + "'" });
875               }
876               init_zone += Largeur_zone;
877
878               if (a2.length > 0) {
879                 coord = { x0: init_zone, y0: 0, x1: init_zone + Largeur_zone, y1: img_finale.height };
880                 jQuery("area[rel=next]").attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
881               }
882             }
883           }
884
885           //================ Zone affichage =========================
886
887
888           //  jQuery(Cadre).css("top", "0px");
889           jQuery("#standard").css("top", 0 + "px");
890           jQuery("#comments").css("top", 0 + "px");
891           //========== Image Remise à l'échelle =======================
892
893           img_finale.height = parseInt(img_finale.height);
894           img_finale.width = parseInt(img_finale.width);
895           //=========================================================================
896           if (jQuery("#slideshow").infos().width > 0) {
897
898             jQuery(Cadre).css({ marginLeft: "auto"
899             });
900           }
901           else
902             jQuery(Cadre).css({ marginLeft: marge_left + "px"
903             });
904           jQuery(Cadre).width(Zone_Affichage.width);
905           //   jQuery(Cadre).height(Zone_Affichage.height);
906
907           if (typeof (gmaps) != "undefined") {
908             Gmap_ = gmaps.maps[0];
909             if (Gmap_.sizeMode == 'A') {
910               jQuery("#iGMapsIcon").css({ width: old_window.width * 0.8 + "px", height: old_window.height * 0.8 + "px" });
911
912             }
913           }
914           //============= flv,mov,mpg  ok
915           /* wmv nok
916           * avi nok
917           //===========================================
918           */
919           if (Type_Img == "charlie") {
920             t1 = jQuery("#charlie").infos();
921
922             /**/
923
924             pdf = 0;
925             jQuery("#charlie div").each(function (i) {
926
927
928               p1 = jQuery(this).infos();
929               pdf += p1.padding.right + p1.padding.left;
930             });
931             img_finale.width -= pdf;
932
933             jQuery("#charlie").css({
934               width: img_finale.width + pdf,
935               height: img_finale.height,
936               margin: "auto"
937             });
938
939
940
941             jQuery("#player").css("width", img_finale.width + "px");
942             jQuery("#player").css("height", img_finale.height);
943
944             jQuery("#embedplayer").css("width", img_finale.width);
945             jQuery("#embedplayer").css("height", img_finale.height);
946
947
948             jQuery("object").width(img_finale.width);
949             jQuery("object").height(img_finale.height);
950
951
952           } else if (Type_Img == "panorama") {
953
954             // -----     jQuery(TheImg).panorama2(img_finale.height, img_finale.width);
955             // jQuery(TheImg).height(img_finale.height);
956             // jQuery(TheImg).width(img_finale.width);
957             jQuery("#Panorama div").height(img_finale.height);
958             //  class=simple_panorama
959
960             jQuery(".panorama-viewport").css("left", "2px");
961             jQuery(".panorama-viewport").css("width", "auto");
962
963
964           } else if (Type_Img == "pamoorama") {
965             info_theImage.height = Zone_Affichage.height;
966             img_height = myPamoorama.imageHeight
967             if (theme.match(RegExp("simple", "g"))) {
968               //  marge_right = 2;
969             }
970             new_width = Zone_Affichage.width - marge_right - marge_left;
971             new_width = Zone_Affichage.width - (info_theImage.borderwidth.right + info_theImage.borderwidth.left);
972
973
974
975             Zone_Affichage.height += info_pamoorama_footer.height;
976             zoom = info_theImage.height / img_height;
977             myPamoorama.options.width = new_width * zoom;
978             //  if(msie || safari) jQuery("#pamoorama_inner ").css({ zoom: zoom });
979             //====================================================
980             jQuery("#pamoorama").css({
981               marginLeft: "auto",
982               marginRight: "auto",
983               //height: Zone_Affichage.height + "px", sinon déclenchement panorama sur la hauteur;
984               width: new_width + "px"
985             });
986             jQuery("#pamoorama").width(new_width);
987
988             //====================================================
989             info_pamoorama = jQuery("#pamoorama").infos();
990             img_finale.height = info_pamoorama.height - info_pamoorama_footer.height;
991             img_finale.width = new_width;
992
993             jQuery("#pamoorama_outter").width(new_width);
994
995
996             // commenter sinon outter augmente à chaque resize
997             //  jQuery("#pamoorama_outter").height(info_pamoorama.height - info_pamoorama_footer.height);
998
999
1000
1001             jQuery("#pamoorama_outter").css({ width: new_width + "px" });
1002             jQuery("#pamoorama_footer").css({ width: new_width + "px" });
1003             //     
1004             //====================================================
1005             info_pamoorama = jQuery("#pamoorama").infos();
1006             info_pamoorama_outter = jQuery("#pamoorama_outter").infos();
1007             info_pamoorama_inner = jQuery("#pamoorama_inner").infos();
1008             info_pamoorama_footer = jQuery("#pamoorama_footer").infos();
1009             info_pamoorama_frame = jQuery("#pamoorama_frame").infos();
1010
1011             info_frame = jQuery(myPamoorama.frame).infos();
1012
1013             zoom = img_finale.height / img_height;
1014
1015
1016           } else if (TheImg.src) {
1017             //--- background ?? ---
1018             jQuery(TheImg).height(img_finale.height);
1019             jQuery(TheImg).width(img_finale.width);
1020             jQuery(TheImg).css({ height: img_finale.height + "px ",
1021               width: img_finale.width + "px "
1022             });
1023
1024
1025           } else {
1026             //===map ? luciano ===
1027             jQuery(TheImg).height(img_finale.height);
1028             jQuery(TheImg).width(img_finale.width);
1029             jQuery(TheImg).css({ height: img_finale.height + "px ",
1030               width: img_finale.width + "px "
1031             });
1032             if (theme.match(RegExp("luciano", "g"))) {
1033               jQuery(Parent + " #theImg IMG").css({ height: img_finale.height + "px ",
1034                 width: img_finale.width + "px "
1035               })
1036             }
1037
1038           }
1039
1040           jQuery("#navThumbPrev").css({ overflow: "hidden" });
1041           jQuery("#navThumbNext").css({ overflow: "hidden" });
1042           n = typeof inittoolbar;
1043           if (Type_Img == "map") {
1044             jQuery("#navThumbNext").css({ display: 'none' });
1045             jQuery("#navThumbPrev").css({ display: 'none' });
1046           }
1047           try {
1048             if (theme.match(RegExp("gally", "gi"))) {
1049               if (typeof inittoolbar == "function") {
1050                 if (typeof (currentTab) == "undefined") inittoolbar();
1051                 else initializeImageMode("resize");
1052               }
1053               //===========================================================================
1054
1055               if (jQuery("#navThumbPrev").length > 0) {
1056                 jQuery("#navThumbPrev").css({ height: info_img.height + "px",
1057                   overflow: "hidden"
1058                 });
1059
1060               }
1061               if (jQuery("#navThumbNext").length > 0) {
1062                 jQuery("#navThumbNext").css({ height: info_img.height + "px",
1063                   overflow: "hidden"
1064                 });
1065
1066               }
1067
1068
1069               if (!theme.match(RegExp("lapis", "gi"))) {
1070                 if (typeof initializeImageMode == "function") {
1071                   initializeImageMode("resize");
1072                 }
1073
1074               }
1075
1076             } else if (theme.match(RegExp("simple", "g"))) {
1077
1078               jQuery("#imageToolBar").css({ position: "static" });
1079
1080               info_imageInfoBar = jQuery("#imageInfoBar").infos();
1081               if (info_imageInfoBar.bottom < info_img.bottom) {
1082                 //   jQuery("#imageInfoBar").height(info_img.bottom);
1083               }
1084
1085             } else {
1086
1087               //    jQuery("#imageToolBar").css("position", "static");
1088             }
1089           } catch (e) {
1090
1091           }
1092           //  --- rglage de la hauteur de page en fonction du copyright-----------
1093           if (typeof (pos) == "undefined") pos = jQuery("#copyright").infos();
1094           if (pos != jQuery("#copyright").infos())
1095             pos = jQuery("#copyright").infos();
1096           if (theme.match(RegExp("stripped", "gi"))) {
1097             var TitleBox = jQuery("#imageTitleContainer");
1098             if (TitleBox.length != 0) TitleBox.css("width", img_finale.width + "px");
1099           } else {
1100             if (pos.top > 100)
1101               jQuery("#the_page").height(pos.top);
1102
1103           }
1104
1105           if (!theme.match(RegExp("luciano", "gi"))) {
1106             jQuery("#linkNext").css({ height: "80px", width: "200px", overflow: "hidden" });
1107             jQuery("#linkPrev").css({ height: "80px", width: "200px", overflow: "hidden" });
1108             jQuery(".navThumb img").css({ height: "80px", width: "", overflow: "hidden" });
1109           }
1110           info_frame = jQuery(Cadre).infos();
1111           if (theme.match(RegExp("stripped", "gi"))) {
1112             pos = "absolute";
1113             info_theImageBox = jQuery("#theImageAndTitle").infos();
1114             t1 = info_theImageBox.top;
1115             l1 = info_theImageBox.left;
1116             // info_theImageBox = jQuery(Parent).infos();
1117
1118           } else {
1119             pos = "absolute";
1120             t1 = info_frame.top;
1121             l1 = info_frame.left;
1122             info_theImageBox = jQuery(Parent).infos();
1123           }
1124
1125           info_theImageBox.margin.margin = info_frame.margin.margin;
1126           info_theImageBox.top = t1;
1127           info_theImageBox.left = l1;
1128           info_theImageBox.pos = "absolute";
1129           Window_Affichage = info_theImageBox;
1130           if (DEBUG == "true") {
1131             //   jQuery(Cadre).css("border", "solid green");
1132
1133             jQuery("#Debug5").css({ background: "transparent",
1134               position: pos,
1135               border: "green solid 2px",
1136               textAlign: align_auto,
1137               margin: Window_Affichage.margin.margin,
1138               top: Window_Affichage.top + "px",
1139               left: Window_Affichage.left + "px",
1140               width: Window_Affichage.width + "px",
1141               height: Window_Affichage.height + "px"
1142             }); //red
1143             jQuery("#Debug4").css({ top: info_frame.bottom - info_description.height + "px" }); //green
1144           }
1145
1146           Wait_Affichage();
1147
1148           return true;
1149
1150
1151
1152
1153
1154           //_____________________________________________________
1155         } // Resize();
1156
1157
1158         //======================================================================
1159
1160
1161       });            // fin extend
1162
1163
1164
1165     } // function
1166);
1167
1168
1169/*
1170* recherche la plus grande image (hauteur ou largeur)
1171*/
1172function Get_Img_Maxi(myobj) {
1173    var w00 = 0;
1174    var myImg = null;
1175    jQuery(myobj).each(function (i) {
1176        w0 = img_reelle.width;
1177        h0 = img_reelle.height;
1178        if (h0 > w0) w0 = h0;
1179        if (w0 > w00) {
1180            if (!this.src.match(RegExp(".png", "g")))
1181                if (!this.src.match(RegExp(thumbnail, "g"))) {
1182                    myImg = this;
1183                    w00 = w0;
1184                }
1185
1186        }
1187    });
1188    return myImg;
1189}
1190
1191//============================================================
1192/*
1193*
1194*/
1195
1196function Info_entete(Parent) {
1197    if (typeof (marge_top) != "undefined") return result;
1198    info_imageToolBar = jQuery("#imageToolBar").infos();
1199    if (info_imageToolBar.position == "absolute") {
1200        jQuery("#imageToolBar").css("position", "relative");
1201        jQuery("#imageToolBar").css("top", 0 + "px");
1202    }
1203    optiontop = 0;
1204
1205    info_imageInfoBar = jQuery("#imageInfoBar").infos();
1206
1207    jQuery("#" + "theImgContainer").css("marginTop", "0px");
1208    info_theImage = jQuery(Parent).infos();
1209    info_thePicturePage = jQuery("#thePicturePage").infos();
1210
1211
1212    if (theme.match(RegExp("stripped", "gi"))) {
1213
1214        info_theImageAndTitle = jQuery("#theImageAndTitle").infos();
1215        info_theImageBox = jQuery("#theImageBox").infos();
1216
1217        optiontop = (marges_llgbo / 2) + info_theImageAndTitle.margin.top;
1218
1219    }
1220
1221    if (info_theImage.position == "relative") {
1222        //--- passage relative ==> static ===/
1223        jQuery(Parent).css("position", "static");
1224        info_theImage = jQuery(Parent).infos();
1225
1226    } else {
1227
1228    }
1229    if (info_theImage.position == "absolute") {
1230        //--- passage absolute ==> static ===/
1231        jQuery(Parent).css("position", "static");
1232        info_theImage = jQuery(Parent).infos();
1233
1234    }
1235
1236    marge_top = Math.ceil(Info_the_page.top +
1237                                     Info_the_page.borderwidth.top +
1238                                     info_theImage.borderwidth.top +
1239                                     info_thePicturePage.margin.top
1240                                     );
1241
1242    img_top = Math.ceil(info_theImage.top +
1243                        info_theImage.borderwidth.top +
1244                        info_thePicturePage.margin.top + optiontop);
1245    result = info_imageToolBar;
1246    result.width = "20%";
1247    result.left = "40%";
1248    result.marge_top = marge_top;
1249    result.img_top = img_top;
1250    //=== Afficher le titre de l'image sur le cadre ===
1251    llgboh2 = jQuery("#gboh2").infos();
1252    result.img_top += llgboh2.height;
1253    return result;
1254
1255}
1256
1257/* Récupère les informations sur la description.
1258*
1259*/
1260
1261//====================================================
1262function Info_Description_f(Parent) {
1263
1264
1265    jQuery(Parent).css({ display: "block" });
1266    //====== détection du type d'images ======
1267    if (jQuery("#charlie").length > 0) {
1268        Type_Img = "charlie";
1269    } else if (jQuery("#pamoorama").length) {
1270        Type_Img = "pamoorama";
1271    } else if (jQuery(Parent + " embed").length > 0) {
1272        Type_Img = "embed";
1273    } else if (jQuery("#map").length) {
1274        Type_Img = "map";
1275
1276    } else if (jQuery("#Panorama").length) {
1277        Type_Img = "panorama";
1278    } else if (jQuery(Parent).find("img").length > 0) {
1279        Type_Img = "img";
1280    } else if (jQuery(Parent + "Box").find("img").length > 0) {
1281        Type_Img = "img";
1282        Parent = Parent + "Box";
1283    } else if (jQuery("img").length > 0) {
1284        Type_Img = "img_autre";
1285        return;
1286    } else {
1287        return;
1288    }
1289    // jQuery(Parent + " p:not(:contains(' ')) ").remove();
1290    // jQuery(Parent + " p:(:contains('')) ").remove();
1291    llgboframe = jQuery("#gbo").infos();
1292    marges_llgbo = 0;
1293
1294    if (llgboframe.height > 0) {
1295 ll2 = jQuery("#gbo div:last").infos(); 
1296        ll1 = jQuery("#gbo div:first").infos();
1297        ll2 ="" ;
1298        jQuery("#gbo div").each(function (i) {
1299       
1300         if (  this.id=="") return ;
1301ll2=this ;
1302        });
1303       ll2 = jQuery(ll2).infos(); 
1304        ll1 = ll1.width;
1305        ll2 = ll2.width - ll2.borderwidth.left - ll2.borderwidth.right;
1306        marges_llgbo = (ll1 - ll2);
1307
1308    }
1309
1310    Bandeau_t = Info_entete(Parent)
1311    Bandeau = Bandeau_t.img_top;
1312
1313    info_theImgContainer = jQuery("#" + "theImgContainer").infos();
1314    info_description = jQuery("#" + "description").infos();
1315    //=============================================================================         
1316    //   jQuery(Parent + " p").css({ padding: "0px", margin: "0px "    });
1317    if (theme.match(RegExp("simple", "gi"))) {
1318        jQuery(Parent).css({ padding: "0px",
1319            marginLeft: "0px",
1320            marginRight: "auto",
1321            marginTop: "0px",
1322            marginBottom: "0px"
1323
1324        });
1325    }
1326
1327
1328    if (theme.match(RegExp("luciano", "g"))) {
1329        jQuery("#imageContainer").css({ height: "auto" });
1330        TheImg = jQuery(Parent + " #theImg img");
1331        info_img = jQuery(TheImg).infos();
1332
1333
1334    } else if (Type_Img == "map") {
1335
1336        info_map = jQuery("#mapPicture").infos();
1337        marge_left = info_map.width;
1338
1339        jQuery("#map").css({ left: marge_left + "px", padding: "0px",
1340            marginLeft: "0px",
1341            marginRight: "4px",
1342            marginTop: "0px",
1343            marginBottom: "0px", position: "relative"
1344        });
1345
1346        TheImg = jQuery("#map");
1347        info_img = jQuery(TheImg).infos();
1348
1349
1350    } else if (jQuery("#charlie").length > 0) {
1351
1352        jQuery("#charlie").css({ padding: "0px"
1353
1354        });
1355        TheImg = jQuery("#charlie")
1356        info_img = jQuery(TheImg).infos();
1357
1358
1359
1360    } else if (jQuery(Parent + " embed").length > 0) {
1361
1362        TheImg = jQuery(Parent + " embed");
1363        info_img = jQuery(TheImg).infos();
1364
1365
1366
1367    } else if (Type_Img == "pamoorama") {
1368        if (!nopano) {
1369            Wait_pamoorama();
1370            return
1371        }
1372        TheImg = jQuery("#pamoorama");
1373        info_img = jQuery(TheImg).infos();
1374        info_footer = jQuery("#pamoorama_footer").infos();
1375        info_img.height = parseInt(img_reelle.height) + parseInt(info_footer.height);
1376
1377    } else {
1378        TheImg = jQuery(Parent + " img");
1379
1380        TheImg = Get_Img_Maxi(TheImg);
1381        if (!TheImg) TheImg = jQuery(Parent);   // sans img ??
1382        info_img = jQuery(TheImg).infos();
1383    }
1384    //=====================================================================================
1385
1386    switch (info_img.position) {
1387        case "relative":
1388            break;
1389        case "static":
1390            break;
1391        case "absolute":
1392            break;
1393        case "":
1394            break;
1395        default:
1396            break;
1397    }
1398
1399    info_description.marge = {
1400        bottom: info_img.padding.bottom + info_img.margin.bottom + info_img.borderwidth.bottom,
1401        top: info_img.padding.top + info_img.borderwidth.top + info_img.margin.top
1402    }
1403
1404
1405    if (llgboframe.height > 0) info_img = llgboframe; // format de l'image+largeur du cadre
1406
1407    if (theme.match(RegExp("luciano", "g"))) {
1408
1409        info_theImgContainer = jQuery("#imageContainer").infos();
1410        info_description.bottom = jQuery("#imageInfo").infos().top;
1411        info_description.top = info_theImgContainer.bottom;
1412        Info_slidshowToolBar = jQuery("#slidshowToolBar").infos();
1413
1414        if (Info_slidshowToolBar.height > 0) {
1415            correction = (Info_slidshowToolBar.height);
1416            info_description.top = info_img.bottom;
1417            info_description.bottom = jQuery("#copyright").infos().top;
1418        }
1419
1420        //=========================================================
1421    } else if (theme.match(RegExp("stripped", "gi"))) {
1422        //options.imageAutosize
1423        //options.imageMargin
1424        if (options.imageAutosizeTitle == false) {
1425            info_description.top =   info_theImageBox.bottom;
1426
1427            info_description.bottom =info_HeaderBar.margin.top+ info_description.top +
1428                                    info_description.borderwidth.top +
1429                                    info_description.borderwidth.bottom +
1430                                      options.imageAutosizeMargin*2 + 
1431                                    (marges_llgbo / 2)+4;
1432
1433        } else {
1434       
1435       
1436            info_description.top = info_theImageBox.bottom +
1437                        jQuery("#content").infos().top +
1438                        options.imageAutosizeMargin * 2  +
1439                        (marges_llgbo / 2)
1440                                ;
1441            info_description.bottom = jQuery("#tabZone").infos().top +
1442                        info_theImageAndTitle.margin.top;
1443           if (msie == true) info_description.bottom -= 4;
1444        };
1445        check_desc_v = true; 
1446
1447    } else {
1448        info_description.bottom = info_theImage.bottom;
1449        info_description.top = info_img.height + info_theImage.top;
1450        // info_description.bottom -= info_img.top;
1451    }
1452    // 
1453
1454    info_description.height = info_description.bottom - info_description.top;
1455
1456    if (check_desc_v == false) {
1457        info_description.height = 0;
1458    }
1459
1460    Debug_pos();
1461
1462    //cl_visible=false ;
1463    return info_description;
1464}
1465
1466//====================================================
1467function Debug_info(index, infos, nom) {
1468
1469    if (infos.height > 0) {
1470
1471        message = browser.browser + " -- > Info : " + nom + " " + infos.id + "\n" +
1472                 "Info nodeName: " + infos.nodeName + "\n" +
1473                 "Info width: " + infos.width + "\n" +
1474                 "Info height: " + infos.height + "\n" +
1475                 "Info top: " + infos.top + "\n" +
1476                 "Info left: " + infos.left + "\n" +
1477                 "Info position: " + infos.position + "\n";
1478
1479        myDebug = { id: "Debug" + index, texte: message,
1480            css: {
1481                color: "black",
1482                opacity: "0.5",
1483                position: "absolute",
1484                height: infos.height || 100 + "px",
1485                width: infos.width || 300 + "px",
1486                left: infos.left || 0 + "px",
1487                border: "solid 1px green",
1488                top: infos.top + "px"
1489
1490            }
1491        }
1492        return myDebug;
1493    } else {
1494        return null;
1495    }
1496
1497
1498}
1499//====================================================
1500function Debug_pos() {
1501    if (DEBUG == "true") {
1502
1503        jQuery("[id ^='Debug']").show();
1504        /*
1505        Debug2  background-color:yellow
1506        Debug3 background-color:blue
1507        Debug4 background-color:green
1508        Debug5 background-color:red
1509
1510        */
1511
1512        affiche_debug({
1513            Debug1: Debug_info(1, Bandeau_t, "Bandeau_t"),
1514            Debug4: Debug_info(4, info_description, "info_description"),
1515            Debug5: Debug_info(5, info_img, "info_img")
1516        });
1517    }
1518}
1519
1520function affiche_debug(aff_infos) {
1521    jQuery(jQuery("[id ^='Debug']")).each(function (i) {
1522        if (aff_infos[this.id]) {
1523            if (aff_infos[this.id].css) {
1524                jQuery("#" + this.id).css(aff_infos[this.id].css);
1525                jQuery("#" + this.id).text(aff_infos[this.id].texte);
1526            }
1527        }
1528    });
1529    return;
1530
1531}
1532
1533
1534jQuery(function () {
1535    jQuery('#pamoorama').live('ON', function (e) {
1536        jQuery(jQuery('.debug').get(1)).trigger('ON');
1537        Bandeau_bas = Info_Description_f(Parent);
1538        Bandeau = Bandeau_bas.top;
1539        old_window = { width: 0, height: 0 };
1540        Wait_Affichage();
1541    });
1542
1543    jQuery(Parent).live('ON', function (e) {
1544        jQuery(jQuery('.debug').get(1)).trigger('ON');
1545        Wait_Affichage();
1546    });
1547
1548    // Custom Event, ON to turn on a debug.
1549    jQuery('.debug').live('ON', function (e) {
1550
1551        jQuery('.debug').trigger('OFF');
1552        jQuery(this).addClass('debugOn');
1553    });
1554
1555    // On Click = debugs On
1556    jQuery('.debug').live('click', function (e) {
1557
1558        jQuery(this).trigger('ON');
1559    });
1560
1561    // Custom Event, Turn off a debug
1562    jQuery('.debug').live('OFF', function (e) {
1563
1564        jQuery(this).removeClass('debugOn');
1565    });
1566
1567    // on Double Click, remove the debug from the DOM
1568    jQuery('.debug').live('dblclick', function () {
1569
1570        jQuery(this).fadeOut(function () { $(this).remove() });
1571    });
1572
1573    // Add another debug to the DOM
1574    jQuery('#adddebugs').click(function () {
1575        jQuery('<div></div>')
1576            .addClass('debug')
1577            .appendTo('#debugsContainer');
1578    });
1579
1580    // Add 10 testing debugs to start with
1581    jQuery(window).load(function () {
1582        DEBUG = (typeof DEBUG != "undefined") ? DEBUG : "false";
1583        if (DEBUG == "true") {
1584            for (var i = 0; i < 10; i++) {
1585                jQuery('#adddebugs').click();
1586            }
1587            jQuery(jQuery('.debug').get(8)).click();
1588
1589        }
1590    }); //on load
1591}); 
Note: See TracBrowser for help on using the repository browser.