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

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

[Autosize][beta] fix default scale to 1
.


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