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

Last change on this file since 18949 was 18949, checked in by cljosse, 11 years ago

[extensions] Autosize fix compatibility with 2.4 (charlie's)

File size: 73.7 KB
Line 
1// problème avec GMaps+diaporama:
2// corriger   gmaps_pip.class.inc.php ajouter ligne 90 if ( !isset($_GET['slideshow']))
3//============================================================== 
4  jQuery.Affiche_script = { version: '2.0.0' };
5  /********************************************
6  *  document ready
7  ********************************************/
8
9
10  jQuery(document).ready(function (jQuery) {
11    var Type_Img;
12    var theImg;
13    var Zone_image;
14
15    /******************************************
16    * test_theme("mont,pur") ...
17    ******************************************/
18
19    test_theme = function (param) {
20      if (!param) return
21      if (!options.theme) return;
22
23      regx = new RegExp(param, "gi");
24      return (options.theme.match(regx))
25
26    }
27    /******************************************
28    * Save_cookies
29    ******************************************/
30    Save_cookies = function (parametres) {
31      parametres.windowHeight = jQuery(window).height();
32      parametres.windowWidth = jQuery(window).width();
33      try {
34        if (parametres.pictureSelType) jQuery.cookie('picture_sel_type', parametres.pictureSelType, { path: COOKIE_PATH });
35        if (parametres.pictureDeriv) jQuery.cookie('picture_deriv', parametres.pictureDeriv, { path: COOKIE_PATH });
36        if (parametres.pictureMap) jQuery.cookie('picture_map', parametres.pictureMap, { path: COOKIE_PATH });
37        if (parametres.imgSrc) jQuery.cookie('img_src', parametres.imgSrc, { path: COOKIE_PATH });
38        if (parametres.theMainImageHeight) jQuery.cookie('theMainImageHeight', parametres.theMainImageHeight, { path: COOKIE_PATH });
39        if (parametres.theMainImageWidth) jQuery.cookie('theMainImageWidth', parametres.theMainImageWidth, { path: COOKIE_PATH });
40        if (parametres.theImageHeight) jQuery.cookie('theImageHeight', parametres.theImageHeight, { path: COOKIE_PATH });
41        if (parametres.theImageWidth) jQuery.cookie('theImageWidth', parametres.theImageWidth, { path: COOKIE_PATH });
42        if (parametres.windowHeight) jQuery.cookie('windowHeight', parametres.windowHeight, { path: COOKIE_PATH });
43        if (parametres.windowWidth) jQuery.cookie('windowWidth', parametres.windowWidth, { path: COOKIE_PATH });
44        if (parametres.theImageTop) jQuery.cookie('theImageTop', parametres.theImageTop, { path: COOKIE_PATH });
45        if (parametres.theImageLeft) jQuery.cookie('theImageLeft', parametres.theImageLeft, { path: COOKIE_PATH });
46        if (parametres.theImageRight) jQuery.cookie('theImageRight', parametres.theImageRight, { path: COOKIE_PATH });
47        if (parametres.theImageBottom) jQuery.cookie('theImageBottom', parametres.theImageBottom, { path: COOKIE_PATH });
48        if (parametres.theImageMargeZone) {
49          jQuery.cookie('theImageMargeWidth', parametres.theImageMargeZone.width, { path: COOKIE_PATH });
50          jQuery.cookie('theImageMargeHeight', parametres.theImageMargeZone.height, { path: COOKIE_PATH });
51        }
52      } catch (e) {
53
54      }
55
56
57    }
58    //____________________ Save_cookies _____________________________
59    /************************************************
60    *  Get COOKIE
61    *************************************************/
62    Get_cookies = function () {
63      parametres = {
64        pictureDeriv: jQuery.cookie('picture_deriv'),
65        pictureMap: jQuery.cookie('picture_map'),
66        imgSrc: jQuery.cookie('img_src'),
67        pictureSelType: jQuery.cookie('picture_sel_type'),
68        theMainImageHeight: jQuery.cookie('theMainImageHeight'),
69        theMainImageWidth: jQuery.cookie('theMainImageWidth'),
70
71
72        windowHeight: jQuery.cookie('windowHeight'),
73        windowWidth: jQuery.cookie('windowWidth'),
74
75        theImageHeight: jQuery.cookie('theImageHeight'),
76        theImageWidth: jQuery.cookie('theImageWidth'),
77        theImageTop: jQuery.cookie('theImageTop'),
78        theImageLeft: jQuery.cookie('theImageLeft'),
79        theImageBottom: jQuery.cookie('theImageBottom'),
80        theImageRight: jQuery.cookie('theImageRight'),
81        theImageMargeZone: { width: jQuery.cookie('theImageMargeWidth'),
82          height: jQuery.cookie('theImageMargeHeight')
83        }
84
85
86      }
87      return parametres;
88    }
89    //____________________ Get_cookies _____________________________
90
91
92
93    /*************************************************
94    * Recupère le Type d'mage
95    *************************************************/
96    Get_type_img = function (e) {
97      //====== détection du type d'images ======
98
99      if (jQuery("#charlie").length > 0) {
100        Type_Img = "charlie";
101      } else if (jQuery("#Panorama").length > 0) {
102        Type_Img = "panorama";
103
104      } else if (jQuery("#pamoorama").length > 0) {
105        Type_Img = "pamoorama";
106        options.valide = true;
107
108        infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true });
109
110      } else if (jQuery("#map").length > 0 || jQuery("#mapPicture").length > 0) {
111        Type_Img = "map";
112      } else if (jQuery("#Panorama").length) {
113        Type_Img = "panorama";
114      } else if ((jQuery("#theImage" + " iframe").length + jQuery("#theImage" + " object").length + jQuery("#theImage" + " embed").length) > 0) {
115
116        if (jQuery("#theImage" + " object").length > 0) {
117
118          type_src = "object";
119
120        } else if (jQuery("#theImage" + " embed").length > 0) {
121
122          type_src = "embed";
123
124        } else {
125
126          type_src = "iframe";
127        }
128        nbf = jQuery("#theImage" + " " + type_src).length;
129        frm1 = jQuery("#theImage" + " " + type_src).get(0);
130        Type_Img = "iframe";
131        //'fb - xfbml - like - button
132        objs = jQuery("#theImage" + " div").get(0);
133        if (jQuery(objs).length > 0) {
134          id_0 = jQuery(objs).attr("id");
135          if (id_0 == "") {
136            jQuery(objs).attr("id", "charlie");
137          } else {
138            if (nbf > 1) {
139              jQuery(frm1).attr("id", "charlie");
140            } else {
141              //  Type_Img = "img";
142            }
143          }
144        } else {
145          jQuery(frm1).attr("id", "iframe");
146          jQuery(frm1).wrap('<div id="' + "theMainImage" + '" style="border:1px solid Transparent" />');
147        }
148
149
150      } else if (jQuery("#theImage").find("img").length > 0) {
151        Type_Img = "img";
152      } else if (jQuery("#theImage" + "Box").find("img").length > 0) {
153        Type_Img = "img";
154        Parent = Parent + "Box";
155      } else if (jQuery("img").length > 0) {
156        Type_Img = "img_autre";
157        return;
158      } else {
159        return;
160      }
161    }
162    //____________________ Get_type_img _____________________________
163
164    //====================================
165    //  set_cl
166    //====================================
167    set_cl = function (Valid) {
168      if (typeof Valid == "undefined") Valid = options.pictureSelType.match(RegExp("Autosize", "gi")) || false;
169      if (typeof options.cl_visible == "undefined") return;
170      if (typeof src1 == "undefined") return;
171      if (options.cl_visible) src = src1;
172      else src = src2;
173
174      if (typeof options.pictureSelType != "undefined" && (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi")) {
175        if (options.pictureSelType == "SelMaxi") src = src6;
176      } else {
177        Valid = false;
178        src = src2;
179        jQuery("#bp_cla span").text("");
180      }
181      if (options.cl_visible) {
182        src_info = src3;
183        src_infos_1 = src3;
184      } else {
185        src_info = src4;
186        src_infos_1 = src5;
187      }
188      src_info = options.pictureDeriv;
189      if (!Valid) {
190        Zone_image.image.height = Zone_image.image_init.height;
191        Zone_image.image.width = Zone_image.image_init.width;
192
193      }
194      if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined") {
195        Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
196        zoom_cl = parseInt(100 * Zone_image.zoom) + "%"; ;
197        if (!Valid) {
198          if (options.pictureSelType == "SelMaxi")
199            zoom_cl = options.pictureSelType + " [" + options.pictureDeriv + "]";
200          else {
201            zoom_cl = "";
202            src_info = options.pictureDeriv;
203          }
204        }
205        jQuery('#bp_cla').attr('alt', src_info);
206        jQuery('#bp_cla').attr('title', src_info);
207        jQuery('#bp_cla').attr('Stitle', src_info);
208        jQuery('#bp_cla').attr('Stip', zoom_cl);
209        r = { width: jQuery("#theMainImage").width(), height: jQuery("#theMainImage").height(),
210          rap: jQuery("#theMainImage").width() / jQuery("#theMainImage").height(),
211          rap_init: Zone_image.image_init.rapport
212        }
213        jQuery('#bp_cla span').text(zoom_cl);
214        color_back = jQuery('#imageToolBar').css("backgroundColor");
215        try {
216          if (color_back.match(new RegExp("rgb", "gi"))) {
217            color_back = color_back.split("(")[1].split(")")[0].split(",");
218            color_back = "rgb(" + Math.abs(255 - color_back[0]) + ","
219                + Math.abs(255 - color_back[1]) + ","
220                + Math.abs(255 - color_back[2]) + ")";
221          }
222          else if (color_back.match(new RegExp("#", "gi")))
223            color_back = Math.abs("#65536" - color_back);
224          else
225            color_back = jQuery('body').css("color");
226          jQuery('#bp_cla span').css({ color: color_back, aling: "center" });
227        } catch (e) {
228
229        }
230        if (options.pictureDeriv) {
231          jQuery('.auto_details').text(" (" + Zone_image.image.width + " x " + Zone_image.image.height + ") " + options.pictureDeriv);
232        }
233        //===============================================
234      } else {
235        src = src6;
236        jQuery('.auto_details').text("");
237
238      }
239      bp_scr = jQuery('#bp_img_cla');
240      if (bp_scr.length > 0) {
241        src_enc = bp_scr.attr("src");
242        if (!src_enc.match(src)) {
243          bp_scr.get(0).src = src;
244          jQuery('#bp_img_cla').attr('alt', src_info);
245          jQuery('#bp_img_cla').attr('title', src_info);
246        }
247      }
248
249    }
250    //____________________ set_cl _____________________________
251
252    /********************************
253    * Set__llbgo
254    *********************************/
255    Set_llbgo = function (Force) {
256
257      if (options.marges_llgbo == 0) return;
258      if (Type_Img == "pamoorama") {
259
260      }
261      if (Force)
262        if (typeof LlgboFr_Resize == "function") {
263          LlgboFr_Resize();
264        }
265      if (Type_Img == "pamoorama" || Type_Img == "charlie") {
266        return;
267      }
268      if (!theImg) return;
269
270      if (theImg.useMap)
271        nom_map = theImg.useMap.replace("#", "");
272      else
273        nom_map = "Autosize";
274
275      maps = jQuery("map[name='" + nom_map + "']");
276      if (maps.length == 0) return;
277      // nom_map = maps[0].name;
278      maps = jQuery("map[name='" + nom_map + "']  area");
279      nb_zone = maps.length;
280      Largeur_zone = (Zone_image.image.width / nb_zone);
281      Hauteur_zone = (Zone_image.image.height);
282      init_zone = 0;
283      j = 0;
284      maps.each(function (e) {
285        init_zone = Largeur_zone * j;
286        rel = jQuery(this).attr("rel");
287        title = jQuery(this).attr("title");
288        alt = jQuery(this).attr("alt");
289        H = Hauteur_zone;
290        if (rel == "up") {
291          H = Hauteur_zone / 4;
292        }
293        coord = { x0: init_zone, y0: 0, x1: Math.ceil(init_zone + Largeur_zone), y1: Hauteur_zone };
294        jQuery(this).attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
295        j++;
296      });
297
298      return;
299    }
300    //__________  Set_llbgo _______________
301    var wpng = 0;
302    /********************************************
303    *  window LOAD
304    ********************************************/
305    jQuery(window).load(function () {
306      href = location.href;
307      var aff_ok = false;
308      //=======================================================================
309      infos_theImage = jQuery(theImage_id).infos({ absolute: true });
310      infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
311      infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
312      theMainImage_obj = "theMainImage_obj";
313      infos_theMainImage_obj = jQuery("#" + theMainImage_obj).infos({ absolute: true });
314
315      infos_theMainImage_obj.rapport = infos_theMainImage_obj.width / infos_theMainImage_obj.height;
316      if (infos_theMainImage.width == 0) {
317        if (Type_Img == "pamoorama") {
318          infos_theMainImage = jQuery("#pamoorama").infos(true);
319          theMainImage_id = "#pamoorama";
320          options.valide = true;
321        } else if (Type_Img == "charlie") {
322          infos_theMainImage = jQuery("#charlie").infos(true);
323          theMainImage_id = "charlie";
324          options.valide = true;
325
326
327        } else if (Type_Img == "iframe") {
328
329          infos_theMainImage = jQuery("#iframe").infos(true);
330
331          options.valide = true;
332
333          infos_theMainImage.width = infos_theImage.general.width;
334          infos_theMainImage.height = infos_window.height - infos_theImage.top - options.marge_basse;
335          jQuery("#iframe").width(infos_theMainImage.width);
336          jQuery("#iframe").height(infos_theMainImage.height);
337
338
339
340        } else {
341          jQuery("img").each(function (i) {
342            imgSrc = options.imgSrc;
343          });
344          infos_theMainImage = jQuery("#theImage img").infos();
345        }
346        if (infos_theMainImage.id == "")
347          jQuery("#theImage img").attr("id", "theMainImage");
348        infos_theMainImage = jQuery(theMainImage_id).infos();
349      }
350
351      infos_theImage = jQuery(theImage_id).infos(true);                 // conteneur
352
353
354      if (test_theme("simple")) {
355        jQuery(theMainImage_id).css({ maxWidth: "none" });
356        theImageAndInfos_id = "#content";
357        infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
358        infos_theImage.height = infos_window.height - infos_theImage.top;
359        //  jQuery(theImage_id).height(infos_theImage.height);
360
361      } else {
362        infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
363        if (infos_theImageAndInfos.visible == false)
364          theImageAndInfos_id = "#imageContainer";
365      }
366
367
368      imageInfos_id = "#imageInfos";
369
370      content_id = "#content";
371      infos_content = jQuery(content_id).infos(true);                 // conteneur
372      infos_theImage = jQuery(theImage_id).infos(true);                 // conteneur
373      infos_imageInfos = jQuery(imageInfos_id).infos(true);             // information
374      infos_theMainImage = jQuery(theMainImage_id).infos(true);         // Image
375      infos_copyright = jQuery("#copyright").infos(true);
376
377
378      if (infos_theImage.top > infos_window.height) {
379        zheight = infos_window.height - infos_content.top;
380      } else {
381        zheight = infos_window.height - (infos_theImage.top);
382      }
383
384
385      if (options.check_desc_v) { }
386
387      infos_comments = jQuery("#comments").infos(true);
388      infos_Licence = jQuery(".licencetag").infos(true);
389      infos_imageComment = jQuery(imageComment_id).infos(true);
390
391
392
393      if (test_theme("simple")) {
394
395
396      } else {
397        if (test_theme("stripped")) {
398
399        } else
400
401          if (test_theme("blanc , pure, hr_ ")) {
402            options.marge_gauche += 10;
403            options.marge_droite += 10;
404          }
405      }
406
407
408      Zone_image = { image_init: {
409        width: infos_theMainImage.width,
410        height: infos_theMainImage.height,
411        rapport: infos_theMainImage.width / infos_theMainImage.height
412      },
413        image: {
414          width: infos_theImage.general.width,
415          height: infos_window.height - infos_theImage.top - options.marge_basse,
416          rapport: infos_theMainImage.width / infos_theMainImage.height
417        },
418        container: {
419          width: infos_theImage.general.width,
420          height: zheight,
421          margesWidth: infos_window.width - infos_theImage.width
422        }, marges: {
423          height: 0,
424          width: 0
425        }
426      }
427
428
429      Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
430
431
432
433
434      /***********************************************************
435      *  RESIZE (une fois document chargé)
436      ***********************************************************/
437      var new_dim;
438      jQuery(window).resize(function (event, ui) {
439        Autosize_resize(true, options);
440
441        return;
442
443
444
445      });
446      //_____________ widow.resize _______________
447
448      type_src = "div";
449      old_window = { width: 0, height: 0 };
450      List_autosize = new Array();
451      nu_img = 0;
452      tempo = 0;
453
454
455      infos_llgbo = jQuery(llgbo_id).infos(true);
456      infos_llgboh2 = jQuery("#llgboh2").infos(true);
457      marges_llgbo = 0;
458      //==========================================================================================
459      if (options.valide) {
460
461        init_gen();
462
463
464      }
465
466    });
467    //__________________window.onload_________________
468
469    /********************************************
470    *  window unLOAD
471    ********************************************/
472    jQuery(window).unload(function () {
473      //  return;
474    });
475    //_________ unload ___________
476
477    //===================
478    // VARIABLES 
479
480
481    //===================
482    // options
483    //===================
484
485    //=========================================================
486    /*messages = "This frame uses the W3C box model: <span>" + jQuery.support.boxModel + "</span>";
487    messages += "This frame uses the html5Clone: <span>" + jQuery.support.html5Clone + "</span>";*/
488    // jQuery("p").html(messages);
489    if (typeof (options) == "undefined") {
490      options = { imageAutosize: false }
491    }
492    options = jQuery.extend(Autosize_options, options);
493    var COOKIE_PATH = options.COOKIE_PATH;
494    var cookies = Get_cookies();
495
496    var defaults = {
497      imageAutosizeMargin: 0,
498      imageAutosize: false,
499      marge_basse: options.imageAutosizeMargin || 0,
500      DEBUG_autosize: false
501    };
502
503    options = jQuery.extend(defaults, options);
504
505
506    for (i = 0; i < options.liste_type.length; i++) {
507      options.liste_type[i] = options.liste_type[i].split(",");
508    }
509
510    options.theMainImageWidth = options.theMainImageWidth;
511    options.theMainImageHeight = options.theMainImageHeight;
512
513    jQuery("#form_autosize_picture").addClass("Autosize");
514    //===== marges suplémentaires en fonction theme ===
515    options.valide = jQuery(".Autosize").css("display") != "none";
516
517    options.marge_haute = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("top"));
518    options.marge_basse = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("bottom"));
519    options.marge_gauche = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("left"));
520    options.marge_droite = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("right"));
521    fade_in = options.fade_in || 0;
522    imageComment_id = ".imageComment";
523    if (test_theme("simple")) {
524      jQuery("#theImage p").addClass("imageComment");
525    }
526    if (test_theme("mont")) {
527      jQuery("#content").css({ marginLeft: 'auto' }); //monblanc
528    }
529
530    DEBUG_autosize = options.DEBUG_autosize;
531    Get_type_img();
532
533    var infos_theMainImage_obj;
534    var theMainImage_id = "#theMainImage";
535    var theImage_id = "#theImage";
536    var theImageAndInfos_id = "#theImageAndInfos";
537    var infos_window = jQuery(window).infos();
538    var infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
539    var infos_content;
540    var infos_body;
541    var infos_the_page = jQuery("#the_page").infos(true);
542    var nopano;
543    var llgbo_id = "#llgbo0";
544    var marges_llgbo = 0;
545
546    var useMap = options.pictureMap; // #mapxxx
547    var user_status = options.user_status;
548
549    var pictureDeriv = options.pictureDeriv; // xxx
550    var pictureSelType_user = eval("options." + user_status + "_type"); //limite taille
551    if (Type_Img == "pamoorama")
552      options.pictureSelType = "Autosize";
553
554    if (pictureSelType_user != options.pictureSelType) {
555      if (pictureDeriv == null)
556        pictureDeriv = pictureDeriv_user;
557      else
558        pictureDeriv_user = pictureDeriv;
559    }
560
561    if (!options.valide) {
562
563      pictureDeriv = "medium";
564      pictureDeriv_user = pictureDeriv;
565      options.pictureDeriv = pictureDeriv;
566    }
567
568
569    //=============================================================
570    // REPONSE ACTION
571    //=============================================================
572    theMainImage_st = false;
573    jQuery("#reset").click(function () {
574      location.reload();
575    });
576
577
578    //===========================================================
579    //  REPONSE TRIGGER
580    //===========================================================
581    jQuery('#ret_autosize').live('ON', function (e) {
582      if (nu_img == "") nu_img = 8;
583      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
584
585    });
586
587    //==========================================================
588    jQuery("map area").mouseover(function (e) {
589      try {
590        nok = theImg.useMap;
591        hok = this;
592      }
593      catch (r) {
594
595      }
596    });
597
598    //==================================
599    // jQuery("#llgbo").trigger("ON");
600    //==================================
601    jQuery(llgbo_id).live('ON', function (e) {
602      n_id = this;
603      infos_llgbo = jQuery(llgbo_id).infos();
604      if (infos_llgbo.visible == false) return;
605
606      marges_llgbo = 0;
607      if (infos_llgbo.height > 0) {
608        infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
609        infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
610        //=============================================
611        ll2 = infos_llgboframe1.width; // llgboframe1 interieur
612        ll1 = infos_llgboframe31.exterieur.width; // llgboframe31 avec border width
613        options.marges_llgbo = (ll1 - ll2);
614        infos_llgboh2 = jQuery("#llgboh2").infos();
615      }
616    });
617    //==============================
618    // jQuery("#mapPicture").trigger("ON");
619    //==============================
620    jQuery("#mapPicture").live('ON', function (e) {
621      p2 = jQuery("#infoSwitcher").infos();
622    });
623    //==============================
624    // jQuery("#map").trigger("ON");
625    //==============================
626    jQuery("#map").live('ON', function (e) {
627      p2 = jQuery("#map").infos();
628    });
629    //===================================
630    // jQuery("#theImage").trigger("ON");
631    //===================================
632    jQuery("#imageInfos").live('on', function (e) {
633      target = e.target.id;
634    });
635
636    //===================================
637    // jQuery("#theImage").trigger("ON");
638    //===================================
639    jQuery("#theImage").live('ON', function (e) {
640      target = e.target.id;
641
642      id = this.id;
643      Select_Image(); //+calcul
644    });
645
646
647
648
649    //=================================================================
650    jQuery(document).live('gallyInterfaceReady', function (e) {
651      i = jQuery(this).text();
652      jQuery(this).trigger('ON');
653    }
654
655          );
656
657
658    /*********************************
659    *
660    ********************************/
661    var old_width;
662
663    jQuery("#theImage").resize(function (e) {
664
665    });
666
667
668
669    jQuery("#menuSwitcher,#infoSwitcher").click(function (e) {
670      options.set_sw = this.id;
671      setTimeout(function () { div_resize() }, 10);
672      nu_img = 0;
673    });
674
675    div_resize = function (i) {
676
677      jQuery("#theImage").trigger("resize");
678      /*
679      if (jQuery("#theImage").width() != old_width) {
680      setTimeout(function () { div_resize() }, 10);
681      }
682      */
683    }
684    //===========================================
685    // jQuery("#theImageAndInfos").trigger("ON");
686    //===========================================
687    jQuery("#theImageAndInfos").live('ON', function (e) {
688      infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
689      //   setTimeout(function () { Autosize_resize(true) }, 100);
690      nu_img = 0;
691    }); // fin click #theImageAndInfos ON
692
693
694    jQuery("#theImageAndInfos").resize(function (e) {
695
696    });
697
698
699    jQuery("#linkAutosize").click(function (e) {
700      nu_img = 0;
701    });
702    //==================================
703    //
704    //===================================
705    jQuery('#derivativeCheckedAutosize').click(function () {
706      try {
707        pathnames = jQuery(this).attr("href").split(":");
708
709        //  eval(pathnames[1]);
710      } catch (e) {
711        n = false;
712      }
713    }); // fin click derivativeCheckedAutosize
714    //====================================================
715    if (typeof decode_href != 'function') {
716      function decode_href(myObj) {
717        href_path = jQuery(myObj).attr("href");
718        pt = href_path.split("(");
719        pt = pt[1].split(")");
720        pt = pt[0].replace(RegExp("'", "g"), "");
721        pt = pt.replace(RegExp(" ", "g"), "");
722        pt = pt.split(",");
723        source = pt[0];
724        pictureDeriv = pt[1];
725        pictureMap = pt[2];
726        if (pt.length > 3)
727          pictureSelType = pt[3];
728        else
729          pictureSelType = pt[1];
730
731        return { source: source,
732          pictureDeriv: pictureDeriv,
733          pictureMap: pictureMap,
734          pictureSelType: pictureSelType
735        }
736      }
737    }
738
739    jQuery("#derivativeSwitchBox a").click(function (e) {
740      retour = decode_href(this);
741      theImg = document.getElementById(theMainImage_id.replace("#", ""));
742      if (theImg) {
743        // options.pictureDeriv = retour.pictureDeriv;
744        options.pictureSelType = retour.pictureSelType;
745        options.pictureDeriv = retour.pictureDeriv;
746        options.pictureMap = retour.pictureDeriv;
747
748        if (this.name) {
749          options.pictureSelType = this.name;
750          n = Get_dimensions(true, options);
751        } else {
752        }
753
754        jQuery("#derivativeSwitchBox span").removeClass("auto_details linkAutosize");
755        jQuery("#derivativeSwitchBox a").removeClass("auto_details linkAutosize");
756        if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
757          spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
758          spans.addClass("linkAutosize");
759          spans.find("span").addClass("auto_details");
760          jQuery(".auto_details").text("");
761        }
762        Autosize_resize(true, options);
763      }
764    });
765    //__________ fin click #derivativeSwitchBox a ____________
766
767    jQuery("input").click(function () {
768      if (this.name.match(RegExp("_enabled", "gi"))) {
769        sel = "[name*=" + this.name + "]";
770        obj = jQuery("tr" + sel);
771
772        if (this.checked)
773          obj.css({ backgroundColor: "green", color: "white" });
774        else
775          obj.css({ backgroundColor: "red", color: "white" });
776        return;
777      }
778      return;
779    });
780
781
782    //====================================
783    Autosize_init = function (name, value) {
784      img_defaut = { height: options.scaled_height, width: options.scaled_width };
785      img_reelle = { height: options.theImageHeight, width: options.theImageWidth };
786      img_init = { height: options.theImageHeight, width: options.theImageWidth };  // taille initiale
787
788      img_finale = img_init;
789
790      useMap = infos_theMainImage.useMap; // #mapmedium
791
792      useMap = options.pictureMap; // #mapxxx
793      pictureDeriv = options.pictureDeriv; //picturederiv xxx
794
795
796      old_img = options.imgSrc;
797      old_window_height = options.windowHeight || jQuery(window).height();
798      old_window_width = options.windowWidth || jQuery(window).width();
799      old_img_h = options.imgHeight;
800      old_img_w = options.imgWidth;
801      if (infos_theMainImage.visible == true) {
802        theImg = document.getElementById(theMainImage_id.replace("#", ""));
803        theImg.useMap = useMap;
804      }
805      fade_in = parseInt(options.fade_in || 0);
806
807    }
808    //____________________ Autosize_init _____________________
809
810    /***************************
811    * Autosize_resize
812    ***************************/
813    Autosize_resize = function (force, parametres) {
814      n = Get_dimensions(true, options);
815      if (n == false) return;
816      Save_cookies(options);
817      if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
818        /**/
819        jQuery(theImg).width(Zone_image.image_init.width);
820        jQuery(theImg).height(Zone_image.image_init.height);
821
822        set_cl("no");
823        Set_llbgo(true);
824        return;
825
826      }
827      infos_theImage = jQuery(theImage_id).infos(true);
828      if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
829      if (img_finale.width && (img_finale.width != Zone_image.image.width || img_finale.height != Zone_image.image.height)) {
830        img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
831      }
832      r1 = Zone_image.image.width / Zone_image.image.height;
833      //======================================================
834
835      affiche_debug({
836
837        Debug1: Debug_info(1, "Cont:" + infos_theImage.width
838    + " X " + infos_theImage.height
839    + " IMG: " + img_finale.width
840    + " X " + img_finale.height
841    + " mgw : " + Zone_image.marges.width
842    , "->")
843      });
844
845      if (Type_Img == "pamoorama") {// img_finale.width
846        jQuery("#pamoorama").width(img_finale.width);
847        jQuery("#pamoorama").height(img_finale.height);
848
849
850        infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true });
851
852        Set_Pamoorama({ width: img_finale.width, height: img_finale.height });
853        if (nopano)
854          if (window.myPamoorama.options.autoscrollOnLoad) {
855            window.myPamoorama.startAnimRight();
856          }
857
858        //jQuery(theMainImage_id).height(Zone_image.image.height);
859      } else {
860        if (options.imageAutosize == false)
861          if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
862            jQuery(theMainImage_id).height(Zone_image.image.height);
863            jQuery(theMainImage_id).width(Zone_image.image.width);
864
865          } else {
866            jQuery(theMainImage_id).width(Zone_image.image_init.width);
867            jQuery(theMainImage_id).height(Zone_image.image_init.height);
868          }
869
870
871        if (Type_Img == "charlie" || Type_Img == "iframe") {
872
873
874          if (Type_Img == "charlie") {
875            dp1 = jQuery("#charlie").offset();
876            dp = jQuery("#" + theMainImage_obj).offset();
877            if (dp) {
878              if (wpng == 0)
879                wpng = (dp.left - dp1.left) * 2;
880            }
881            mrgl = (jQuery("#" + "theImage").width() - Zone_image.image.width) / 2;
882            png_h = jQuery("#" + Type_Img + " div").height();
883            jQuery("#" + Type_Img).css({ marginLeft: mrgl + "px" });
884            jQuery("#" + Type_Img).width(Zone_image.image.width);
885            jQuery("#" + Type_Img).height(Zone_image.image.height);
886
887            w01 = jQuery("#" + theMainImage_obj).width();
888            jQuery("#" + theMainImage_obj).attr("width", Zone_image.image.width - wpng);
889            jQuery("#" + theMainImage_obj).attr("height", Zone_image.image.height);
890            jQuery("#theMainImage_emb").attr("width", Zone_image.image.width - wpng);
891            jQuery("#theMainImage_emb").attr("height", Zone_image.image.height);
892            jQuery("#theMainImage").height(png_h);
893            jQuery("#" + Type_Img).height(png_h);
894         
895
896          } else {
897            jQuery("#" + theMainImage_obj).attr("width", Zone_image.image.width);
898            jQuery("#" + theMainImage_obj).attr("height", Zone_image.image.height);
899            jQuery("#" + Type_Img).attr("width", Zone_image.image.width);
900            jQuery("#" + Type_Img).attr("height", Zone_image.image.height);
901          }
902
903
904
905          jQuery("#" + Type_Img).show(options.fade_in);
906        }
907
908
909      }
910
911      set_cl();
912      Set_llbgo(true);
913      return true;
914    };
915    //_________________Autosize ____________________________________   
916
917    /*****************
918    * changeImgSrc
919    ******************/
920    changeImgSrc = function (url, typeSave, typeMap, type) {
921      if (url) {
922        if (url.match(RegExp("i.php", "gi"))) {
923          urls = url.split("?");
924        }
925      }
926      url2 = jQuery("#theMainImage").attr("src");
927      if (typeof type != "undefined")
928        options.pictureSelType = type;
929      else {
930        options.pictureSelType = typeSave;
931        type = typeSave;
932
933      }
934      options.pictureDeriv = typeSave;
935      typeMap = typeSave;
936
937      jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
938      if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) {
939        jQuery('#derivativeChecked' + type).css('visibility', 'visible');
940        document.cookie = 'picture_sel_type=' + type + ';path=' + COOKIE_PATH;
941      } else {
942
943        jQuery('#derivativeChecked' + typeSave).css('visibility', 'visible');
944        document.cookie = 'picture_sel_type=' + typeSave + ';path=' + COOKIE_PATH;
945      }
946      options.pictureMap = typeMap;
947      options.pictureDeriv = typeSave;
948      document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH;
949
950
951
952      jQuery("#theMainImage").removeAttr("width height").attr("src", url)
953      .load(function (i) {
954        if (!init_img(this)) {
955          return;
956        }
957        //=======================================================================   
958
959      })
960      .live("ON", function (e) {
961        theMainImage_st = this.complete;
962        imgsrc = this.src;
963        // alert(this.src + ' Image does not exist !!');
964      }).error(function (i) {
965        imgsrc = this.src;
966      });
967      /***********************
968      *
969      **********************/
970      jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")
971         .error(function (e) {
972           if (!this.complete) {
973             // le fichier n'est pas present
974             src = jQuery(this).attr("src").replace("./_data/i/", "", 1);
975             src = this.src.split("/_data/i")[1];
976             url = 'i.php?' + src + "&ajaxload=true";
977             jQuery(theMainImage_id).attr("src", url);
978             /*
979             jQuery.ajax({
980             type: 'GET',
981             url: 'i.php?' + src + "&ajaxload=true",
982             dataType: 'json',
983             success: (function (data) {
984             j = data.url;
985             //  jQuery(theMainImage_id).attr("src", data.url);
986
987             })
988
989             });
990             */
991
992
993
994           }
995
996         })
997         .bind("Finish", function (e, data) {
998           if (typeof imageInfos_id == "undefined") return;
999
1000         })
1001          .bind("ON", function (e, data) {
1002            if (data.status != "ok") {
1003              popup = jQuery(".errors");
1004              if (popup.length == 0) {
1005                jQuery("#theImage").append("<div class='errors'><span></span></div>");
1006              }
1007              jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText);
1008              jQuery(".errors").show().delay(10000).hide(2000);
1009              return;
1010            }
1011            if (data.src) {
1012              if (typeof imageInfos_id == "undefined") return;
1013              if (options.pictureDeriv == "Original" && data.src.match(RegExp("\-.." + ".jpg", "gi"))) {
1014                Autosize_resize(true, options);
1015              } else if (data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) {
1016                Autosize_resize(true, options);
1017              } else {
1018
1019              }
1020            }
1021          });
1022      //_________ theMainImage  ___________
1023
1024
1025      document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH;
1026    }
1027
1028    //__________________ changeImgSrc ______________________
1029
1030    /*****************************
1031    *      pamoorama
1032    ******************************/
1033
1034    jQuery("#pamoorama").bind("on", function () { alert($(this).text()); });
1035    jQuery("#pamoorama").bind("on", function (e) {
1036      myPamoorama = window.myPamoorama;
1037    });
1038    jQuery("#pamoorama_inner").live("on", function (e) {
1039      myPamoorama = window.myPamoorama;
1040    });
1041    jQuery('#pamoorama').live('ON', function (e) {
1042      jQuery(jQuery('.debug').get(1)).trigger('ON');
1043      Autosize_resize(true, options);
1044    });
1045
1046    //===============================================
1047    // jQuery("#theImage").trigger("Start_right");
1048    //===============================================
1049    jQuery("#theImage").live('Start_right', function (e) {
1050      if (typeof Zone_image == "undefined") return
1051      test_w = window.myPamoorama.autoSlideFx.to;
1052      test_w = window.myPamoorama.autoScrollFx.to;
1053      nf = jQuery("#pamoorama_thumb").height();
1054      jQuery("#pamoorama_thumb img").width(200);
1055      jQuery("#pamoorama_thumb img").height(nf);
1056      // 200=window.myPamoorama.imageWidth
1057      // frame = Zone_image.container.width
1058      nw = (200 * Zone_image.image.width) / window.myPamoorama.imageWidth;
1059      jQuery("#pamoorama_frame").width(nw);
1060    });
1061    //===============================================
1062    // jQuery("#theImage").trigger("Start_left");
1063    //===============================================
1064    jQuery("#theImage").live('Start_left', function (e) {
1065      if (typeof Zone_image == "undefined") return
1066      jQuery("#theImage").show(0);
1067      window.myPamoorama.autoSlideFx.to = 0;
1068      test_w = window.myPamoorama.autoSlideFx.to;
1069      test_w = window.myPamoorama.autoScrollFx.to;
1070      nf = jQuery("#pamoorama_thumb").height();
1071      jQuery("#pamoorama_thumb img").width(200);
1072      jQuery("#pamoorama_thumb img").height(nf);
1073    });
1074
1075    /************************************
1076    * Wait_pamoorama
1077    ************************************/
1078    Wait_pamoorama = function () {
1079      if (Type_Img != "pamoorama") return;
1080      tempo = 0;
1081      Wait_pamoorama_st = false;
1082
1083
1084      while (Wait_pamoorama_st == false) {
1085        Wait_pamoorama_st = Wait_pamoorama_time();
1086        jQuery.noop();
1087      }
1088      tempo = 0;
1089      if (nopano) {
1090        if (window.myPamoorama.options.autoscrollOnLoad) {
1091          window.myPamoorama.startAnimRight();
1092          jQuery.delay(100);
1093        }
1094
1095
1096
1097      }
1098
1099    }
1100    //__________________ Wait_pamoorama ______________________
1101    jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) {
1102
1103
1104
1105
1106
1107    }).mouseover(function (i) {
1108
1109    })
1110
1111
1112    Wait_pamoorama_time = function () {
1113      if (nopano == true) return true;
1114
1115
1116
1117      if (jQuery("#pamoorama").length) {
1118        tempo = tempo + 1;
1119
1120        mypanorama = window.myPamoorama;
1121        if (!mypanorama) {
1122          if (tempo > 500) return true;
1123          setTimeout("Wait_pamoorama_time()", 500);
1124          return false;
1125
1126        }
1127
1128        if (mypanorama.skipInit == false) {
1129          if (tempo > 500) return true;
1130          setTimeout("Wait_pamoorama_time()", 500);
1131          return false;
1132        }
1133        //=============================================================
1134        if (Math.abs(mypanorama.imageHeight) < 100) {
1135          setTimeout("Wait_pamoorama_time()", 500);
1136          return false;
1137        }
1138
1139        if (jQuery(".infos").length > 0) {
1140          jQuery(".infos").empty();
1141          jQuery(".infos").hide();
1142        }
1143
1144        nopano = true;
1145
1146        Zone_image = { image_init: { width: mypanorama.imageWidth,
1147          height: mypanorama.imageHeight
1148        }
1149        }
1150        jQuery("#pamoorama").trigger("ON");
1151        return true;
1152
1153      }
1154    }
1155    //__________________ Wait_pamoorama time______________________
1156
1157    /**********************
1158    *
1159    ***********************/
1160    Wait_Affichage = function () {
1161      Wait_Affichage_st = false;
1162      while (Wait_Affichage_st == false) {
1163        jQuery.noop();
1164        Wait_Affichage_st = Wait_Affichage_time();
1165      }
1166    }
1167    //__________________ Wait_Affichage ______________________
1168
1169
1170    Wait_Affichage_time = function () {
1171      if (typeof fade_in == "undefined") fade_in = 1000;
1172      fade_in = parseInt(fade_in);
1173      /*
1174      if (!Autosize_resize()) {
1175      setTimeout("Wait_Affichage()", 500);
1176      return
1177      } 
1178      nu_img++;     
1179      */
1180      if (typeof fade_in == "undefined") fade_in = 0;
1181
1182      //   if (nu_img > 1) return;
1183      if (typeof stb != "undefined")
1184        stb.stop().fadeTo(3500, 0);
1185      if (typeof theMainImage_id == "undefined") return true;
1186
1187      if (theMainImage_id.selector) {
1188        theMainImage_id = theMainImage_id.selector;
1189      }
1190      if (theMainImage_id == null) return;
1191
1192      if (jQuery(theMainImage_id).length == 0) {
1193        if (jQuery("#pamoorama_inner").length > 0) {
1194          return true;
1195        }
1196        //=== attente Image chargée ===
1197        if (tempo > 100) return true;
1198        tempo++;
1199        setTimeout("Wait_Affichage_time()", 500);
1200        return false;
1201
1202      } else {
1203
1204        img_h = jQuery(theMainImage_id).height();
1205        img_w = jQuery(theMainImage_id).width();
1206
1207        if (typeof infos_theImage == "undefined") return;
1208        jQuery("#ret_autosize").trigger('ON', {
1209          width: img_w,
1210          height: img_h,
1211          theImage: theMainImage_id,
1212          img_src: infos_theMainImage.src,
1213          window_height: infos_theImage.height,
1214          window_width: infos_theImage.width
1215        });
1216      }
1217      return true;
1218    }
1219    //______________ Wait_affichage ______
1220
1221
1222    /***********************
1223    *
1224    **********************/
1225    init_img = function (theImg) {
1226      if (theImg.complete == false) {
1227        return;
1228      }
1229      name_src = theImg.src;
1230      img_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() }
1231
1232      if (typeof theImg.naturalWidth != "undefined")
1233        img_init.width = theImg.naturalWidth;
1234      if (typeof theImg.naturalHeight != "undefined")
1235        img_init.height = theImg.naturalHeight;
1236      img_init.rapport = img_init.width / img_init.height;
1237      if (typeof Zone_image == "undefined") Zone_image = { image: {} };
1238      if (typeof Zone_image.image == "undefined") Zone_image.image = { height: Zone_image.image_init.height, width: Zone_image.image_init.width };
1239      // theImg.height = img_init.height;
1240      //  theImg.width = img_init.width;
1241
1242      Zone_image.image_init = { height: img_init.height, width: img_init.width, rapport: img_init.rapport };
1243      Zone_image.zoom = Zone_image.image_init.height / img_init.height;
1244
1245      if (typeof Zone_image.src == "undefined") {
1246        Zone_image.src = name_src;
1247        return false;
1248      }
1249      stx = name_src.match(RegExp(Zone_image.src, "gi"));
1250      return stx;
1251    }
1252    //___________ init_img _______
1253
1254
1255
1256    //===========================================
1257    //
1258    //===========================================
1259    Set_Map = function (nds) {
1260      p0 = jQuery("#map").offset();
1261      if (!p0) return;
1262      infos_mapPicture = jQuery("#mapPicture").infos({ absolute: true });
1263      infos_theImage = jQuery("#theImage").infos({ absolute: true });
1264      jQuery("#map").removeAttr("height");
1265      jQuery("#map").removeAttr("width");
1266      jQuery("#map").width(infos_theImage.width - (infos_mapPicture.width));
1267      jQuery("#map").height(jQuery(window).height() - infos_theImage.top - infos_theImage.general.marges.height);
1268      return true;
1269    }
1270
1271    jQuery("map [name='#Autosize'] area").mouseover(function (e) {
1272      return;
1273    });
1274    //___ Set_Map ___
1275
1276    //=====================================
1277    //
1278    //=====================================
1279    Get_Maxi = function (Maxi_image) {
1280      var pt = options.liste_type;
1281      if (pt.length > 0) {
1282        tw = Maxi_image.width;  // valeur maxi
1283        th = Maxi_image.height;  // valeur maxi
1284        n = 0;
1285        maxi_size = { w: Maxi_image.width, h: Maxi_image.height, idx: -1 };
1286        mini_size = { w: tw, h: th, idx: 0 };
1287        size_derive = { w: 0, h: 0 };
1288        size_encours = { w: tw, h: th };
1289        //=================================
1290        jQuery(pt).each(function (i) {
1291          vn = this;
1292          size_derive = { w: parseInt(vn[2]), h: parseInt(vn[3]) };
1293          if (vn[0] == options.pictureSelType || vn[0] == "Original") {
1294            maxi_size = size_derive;
1295            maxi_size.idx = n;
1296            return false
1297          }
1298
1299          if (vn[0] != "square" && vn[0] != "thumb" && vn[0] != "SelMaxi" && vn[0] != "Autosize") {
1300            if (size_derive.h > size_encours.h) {
1301              if (maxi_size.idx < 0) {
1302                maxi_size = size_derive;
1303                maxi_size.idx = n;
1304                if (options.pictureSelType == "SelMaxi" || options.pictureSelType == "Autosize")
1305                  return false
1306              }
1307            }
1308            if (size_derive.h < size_encours.h && size_derive.h > 10) {
1309              mini_size = size_derive;
1310              mini_size.idx = n;
1311            }
1312          }
1313          n++;
1314        });
1315
1316
1317
1318
1319        n = maxi_size.idx;
1320        if (n < 0) {
1321          n = mini_size.idx;
1322        }
1323        if (options.pictureSelType.match(RegExp("SelMaxi", "gi"))) {
1324          n = mini_size.idx;
1325
1326        }
1327        if (options.pictureSelType.match(RegExp("Autosize", "gi"))) {
1328
1329        }
1330
1331        pictureDeriv = pt[n][0];
1332        last_id = pt[n][0];
1333        jQuery(".switchCheck").each(function (i) {
1334
1335          if (!this.id.match(RegExp("Original", "gi"))) {
1336            if (this.id.match(RegExp("SelMaxi", "gi"))) return false;
1337            last_id = this.id.replace("derivativeChecked", "");
1338          }
1339          if (last_id.match(RegExp(pictureDeriv, "gi"))) return false;
1340        });
1341
1342        options.pictureDeriv = last_id;
1343
1344        return { url: pt[n][1], pictureDeriv: last_id, pictureMap: last_id, width: pt[n][2], height: pt[n][3] };
1345      }
1346      return { imgSrc: "", pictureDeriv: "", width: "", height: "" };
1347    }
1348    //_______________ Get_Maxi ______
1349
1350    /********************
1351    *
1352    ********************/
1353    Select_Image = function () {
1354      var pt = options.liste_type;
1355
1356
1357      if (pt.length > 0) {
1358        //===== calcul Image ===
1359        if (typeof imageInfos_id == "undefined") return;
1360        Calcul_Image();
1361        options.theImageMargeZone = Zone_image.marges;
1362        if (Type_Img != 'charlie') {
1363          IMg = Get_Maxi(Zone_image.image);
1364          imgSrc = IMg.url;
1365          if (options.imgSrc.match(RegExp(imgSrc, "gi")))
1366            options.imgSrc = imgSrc;
1367
1368          img_width = IMg.width;
1369          img_height = IMg.height;
1370
1371          Zone_image.image_init = { height: IMg.height,
1372            width: IMg.width,
1373            rapport: IMg.width / IMg.height
1374
1375          };
1376          if (typeof Zone_image.image == "undefined")
1377            Zone_image.image = { height: IMg.height,
1378              width: IMg.width,
1379              rapport: IMg.width / IMg.height
1380
1381            };
1382        } else {
1383          return;
1384        }
1385        Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height;
1386        if (typeof Zone_image.src == "undefined") Zone_image.src = " ";
1387
1388        identique = Zone_image.src.match(RegExp(imgSrc, "gi"));
1389        if (identique) return;
1390        href_path = "javascript:changeImgSrc('" + imgSrc + "', '" + IMg.pictureDeriv + "', '" + IMg.pictureMap + "', '" + options.pictureSelType + "')";
1391        jQuery(".linkAutosize").attr("href", href_path);
1392        theImg = document.getElementById(theMainImage_id.replace("#", ""));
1393
1394        if ((theImg == null) || theImg.tagName != "IMG") {
1395          imgSrc_i = jQuery(theImg).css("backgroundImage");
1396          imgSrc_j = jQuery(theImg).css("background-image");
1397          return;
1398        } else {
1399          last_id = IMg.pictureDeriv;
1400          changeImgSrc(imgSrc, last_id, IMg.pictureMap, options.pictureSelType);
1401        }
1402
1403        theImg.useMap = "#map" + IMg.pictureMap;
1404        return true;
1405
1406
1407        theImg = document.getElementById(theMainImage_id.replace("#", ""));
1408        if (init_img(theImg)) {
1409
1410          return true;
1411        }
1412        return false;
1413
1414      } else {
1415
1416
1417        return false;
1418      }
1419
1420
1421    };  //_______________ Select_Image ______
1422
1423
1424    /*************************************************
1425    * correction pamoorama
1426    *************************************************/
1427
1428    Set_Pamoorama = function (Format) {
1429      myPamoorama = window.myPamoorama;
1430      if (Type_Img == "pamoorama") {
1431
1432        if (!nopano) {
1433          theMainImage_Id = "#pamoorama";
1434          nopano = false;
1435          Wait_pamoorama();
1436          infos_theMainImage = jQuery(theMainImage_Id).infos();
1437          //theMainImage_Id = "#pamoorama";
1438        }
1439
1440
1441        if (typeof myPamoorama == "undefined") {
1442          return;
1443        }
1444        //========================================================= 
1445        if (!nopano) {
1446          //theMainImage_Id = "#pamoorama";
1447          nopano = false;
1448          Wait_pamoorama();
1449          infos_theMainImage = jQuery(theMainImage_Id).infos();
1450          //theMainImage_Id = "#pamoorama";
1451        }
1452
1453
1454        infos_pamoorama_outter = jQuery("#pamoorama_outter").infos({ absolute: true });
1455        infos_pamoorama_inner = jQuery("#pamoorama_inner").infos({ absolute: true });
1456        infos_pamoorama_frame = jQuery("#pamoorama_frame").infos({ absolute: true });
1457        infos_frame = jQuery(myPamoorama.frame).infos({ absolute: true });
1458
1459
1460        //====================================================
1461        marges_w = infos_pamoorama.general.marges.width;
1462        marges_h = infos_pamoorama.general.marges.height;
1463
1464        jQuery("#pamoorama_footer").css({
1465          width: Format.width + "px"
1466        });
1467        infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
1468        marges_h += infos_pamoorama_footer.general.height;
1469        outter_height = Format.height;
1470
1471        Zoom_pano = (Format.height - marges_h) / Zone_image.image_init.height;
1472        new_image = { height: Math.ceil(Zone_image.image_init.height * Zoom_pano),
1473          width: Math.ceil(Zone_image.image_init.width * Zoom_pano)
1474        }
1475
1476        jQuery("#pamoorama_inner").css({
1477          width: new_image.width + "px", height: new_image.height + "px", "background-size": "100%"
1478        });
1479        //---------- test largeur image
1480        new_width = Format.width - (options.marge_right + options.marge_left);
1481
1482        if (new_width > new_image.width) {
1483          new_width = new_image.width;
1484          jQuery("#pamoorama_outter").css({
1485
1486            align: "center",
1487            margin: "0"
1488          });
1489        }
1490        outter_width = new_width;
1491
1492        jQuery("#pamoorama_outter").css({
1493          align: 'center',
1494          margin: 'auto',
1495          width: outter_width + "px",
1496          height: Format.height - marges_h + "px"
1497        });
1498        //============= Mise à l'echelle ==================
1499        window.myPamoorama.options.width = Math.ceil(Format.width);
1500        //==================================================================
1501        new_max_left = new_image.width - outter_width;
1502        if (!window.myPamoorama.outter) return;
1503        window.myPamoorama.outter.scrollTo(new_max_left, 0);
1504
1505        if (typeof window.myPamoorama.autoScrollFx != "undefined") window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0);
1506        window.myPamoorama.ratio = Math.ceil(new_image.width / 200);
1507        window.myPamoorama.imageWidth = new_image.width;
1508        window.myPamoorama.imageHeight = new_image.height;
1509        nf = jQuery("#pamoorama_thumb").height();
1510        jQuery("#pamoorama_thumb img").width(180);
1511        jQuery("#pamoorama_thumb img").height(nf);
1512
1513        jQuery("#pamoorama_thumb").css({
1514          /*   position: "absolute", */
1515          left: (Format.width - 215) + "px"
1516
1517        });
1518        jQuery("#pamoorama_thumb img").css({
1519
1520        });
1521        // 200=window.myPamoorama.width
1522        // frame = Zone_image.container.width
1523
1524        nw = (window.myPamoorama.image.width * Format.width) / window.myPamoorama.imageWidth;
1525        jQuery("#pamoorama_frame").width(nw);
1526
1527
1528      } // 
1529    } // Set_Pamoorama
1530
1531    /*********************************************************/
1532
1533    Toggle_bp = function () {
1534      options.cl_visible = !options.cl_visible;
1535      Autosize_resize();
1536      Wait_Affichage();
1537
1538    }
1539
1540    //====================================
1541    //
1542    //====================================
1543    Calcul_Image = function () {
1544
1545      /****************************************/
1546      if (typeof imageInfos_id == "undefined") return;
1547      infos_imageInfos = jQuery(imageInfos_id).infos({ absolute: true });             // information
1548      infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });         // Image   
1549      // commentContent
1550      // copyright
1551
1552
1553
1554      pos_top = options.pos_top;
1555      //    pos_top = infos_theImage.top;
1556
1557      pos = jQuery(theImage_id).offset();
1558      infos_theImage = jQuery(theImage_id).infos(true);   // container
1559      infos_window = jQuery(window).infos(true);   // window
1560      w = infos_theImage.general.marges.width
1561
1562      container = {
1563        height: infos_window.height - options.theImageTop,
1564        width: infos_window.width - options.theImageLeft - options.theImageRight
1565      }
1566      marge_left = options.marge_left | 0;
1567      marge_right = options.marge_right | 0;
1568      marge_top = options.marge_top | 0;
1569      marge_bottom = options.marge_bottom | 0;
1570
1571      //==========================================================
1572      if (test_theme("stripped")) {
1573        infos_the_page.margin.left = 20;  //taille fleche
1574        infos_the_page.margin.right = 20;
1575      }
1576
1577
1578      if (test_theme("elegant")) {
1579
1580        if (infos_imageInfos.visible == true) {
1581          //  marge_right += infos_imageInfos.general.width; ;
1582
1583        } else {
1584          marge_right += 0;
1585
1586        }
1587        marge_right += 1;
1588        marge_left += 1;
1589
1590      } else if (test_theme("stripped")) {
1591
1592      } else if (test_theme("simple")) {
1593
1594
1595
1596      } else if (test_theme("OS")) {
1597
1598      } else if (test_theme("pur")) {
1599        marge_right += 0;
1600        // marge_right += 25;
1601      } else if (test_theme("mont")) {
1602        marge_right += 0;
1603
1604        // marge_right += 25;
1605
1606
1607      } else {
1608
1609
1610
1611      }
1612
1613
1614      retrait_img = {};
1615      //========== Format Image ============== 
1616      retrait_img.height = Math.ceil(options.marges_llgbo || 0)
1617      + Math.ceil(infos_theMainImage.general.marges.height);
1618      retrait_img.height += 2;
1619
1620
1621      //===============================================================
1622      retrait_img.width = Math.ceil(infos_theMainImage.general.marges.width); // borderwidth+padding
1623      retrait_img.width = Math.ceil(infos_theImage.general.marges.width); // borderwidth+padding
1624      retrait_img.width += Math.ceil(options.marges_llgbo || 0);
1625      retrait_img.width += 2;
1626      if (!options.check_desc_v)
1627        marge_bottom = 0;
1628
1629      //================== Limite Format Image =====================
1630      container.height_interne = container.height - marge_top - marge_bottom;
1631      container.width_interne = container.width - marge_left - marge_right;
1632
1633      container.height_interne = Math.max(container.height_interne, Math.ceil(options.mini_height) + retrait_img.height),
1634      container.width_interne = Math.max(container.width_interne, Math.ceil(options.mini_width) + retrait_img.width)
1635
1636
1637      image_max = {
1638        height: (container.height_interne - retrait_img.height),
1639        width: (container.width_interne - retrait_img.width)
1640      }
1641      //=========================
1642      // test débordement
1643      //=========================
1644      height_theMainImage = Math.ceil(image_max.height);
1645      width_theMainImage = Math.ceil(image_max.width);
1646
1647      if (typeof Zone_image.image_init.rapport == "undefined") {
1648        Zone_image.image_init.rapport = options.ratio;
1649      }
1650      if (Type_Img == "charlie") {
1651        width_theMainImage = height_theMainImage * options.ratio;
1652        Zone_image.image_init.rapport = options.ratio;
1653
1654      } else if (Type_Img == "pamoorama") {
1655        if (height_theMainImage > container.height_interne) {
1656          n = options.pictureSelType;
1657        }
1658      } else {
1659
1660        height_theMainImage = Math.ceil(width_theMainImage / options.ratio);
1661
1662
1663
1664        if (height_theMainImage > container.height_interne) {
1665          image_max.height = container.height_interne;
1666          image_max.width = image_max.height * Zone_image.image_init.rapport;
1667          width_theMainImage = Math.ceil(image_max.width);
1668          height_theMainImage = Math.ceil(image_max.height);
1669        }
1670        if (width_theMainImage > container.width_interne) {
1671          image_max.width = container.width_interne;
1672          image_max.height = image_max.width / Zone_image.image_init.rapport;
1673          width_theMainImage = Math.ceil(image_max.width);
1674          height_theMainImage = Math.ceil(image_max.height);
1675
1676        } else if (width_theMainImage > container.width) {
1677
1678        } else {
1679
1680        }
1681      }
1682      //=================================================================
1683      Zone_image.image = {
1684        width: width_theMainImage,
1685        height: height_theMainImage,
1686        rapport: width_theMainImage / height_theMainImage
1687      };
1688      Zone_image.marges = { width: marge_left + marge_right + retrait_img.width,
1689        height: marge_top + marge_bottom + retrait_img.height
1690      }
1691      Zone_image.src = jQuery(theMainImage_id).attr("src");
1692    }
1693
1694    /*********************************************
1695    * Calcul les dimensions.
1696    *********************************************/
1697    Get_dimensions = function (force, parametres) {
1698      new_img = jQuery(theMainImage_id).infos({ absolute: true });
1699      new_dim = jQuery(theImage_id).infos({ absolute: true });
1700      new_win = jQuery(window).infos({ absolute: true }); // avec ascenseur   
1701      options.theImageTop = new_dim.top;
1702      options.theImageLeft = new_dim.left;
1703      options.theImageRight = (new_win.width - new_dim.right);
1704      options.marge_bottom = Math.ceil(new_dim.out.bottom - new_img.out.bottom);
1705      if (Type_Img == "iframe") { }
1706      new_dim.out.bottom = new_win.height - options.marge_bottom;
1707
1708      options.theImageBottom = new_win.height - new_dim.out.bottom;
1709      options.marge_top = Math.ceil(new_img.top - new_dim.top);
1710
1711      if (options.theImageBottom < 0) {
1712        options.theImageBottom = 0;
1713      }
1714      options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight;
1715      options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop;
1716      var chk = eval("options." + user_status + "_enabled");
1717      if (chk == "") { return; }
1718
1719      if (Type_Img != "map" && Type_Img != "iframe")
1720        Select_Image();
1721      infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
1722      Zone_image.src = infos_theMainImage.src;
1723      useMap = options.pictureSelType;
1724      /*
1725      if (useMap) {
1726      if (!useMap.match(RegExp("Autosize", "gi"))) {
1727      if (typeof img_height != "undefined") {
1728      jQuery(theImg).height(img_height);
1729      jQuery(theImg).width(img_width);
1730      }
1731      return;
1732      }
1733      }
1734
1735      if (options.imageAutosize) {
1736      return true; //stripped
1737      }
1738
1739      if (typeof options.cl_visible == "undefined") return;
1740      if (!options.cl_visible == true) { return; }
1741      */
1742
1743      //=================================================================
1744      switch (Type_Img) {
1745        case "map":
1746          if (Set_Map(true)) return false;
1747          break
1748        case "panorama":
1749          if (!theMainImage_id) {
1750
1751          }
1752          infos_theImage = jQuery(theMainImage_id).infos();
1753          infos_the_page = jQuery("#the_page").infos();
1754          img_finale.height = infos_theImage.height;
1755          break
1756        case "img":
1757
1758
1759
1760
1761
1762          break
1763        case "img_autre":
1764          if (!theMainImage_id) {
1765            if (DEBUG_autosize.match("true", gi)) alert("The_MainImage=null");
1766            return;
1767
1768          }
1769
1770          infos_the_page = jQuery("#the_page").infos();
1771
1772
1773          break
1774        case "embed":
1775          //
1776          if (infos_theMainImage.width == 0)
1777            infos_theMainImage = jQuery("#thePicturePage").infos();
1778          if (infos_theMainImage.width == 0)
1779            infos_theMainImage = jQuery("#the_page").infos();
1780
1781
1782          iph1 = jQuery("#theImage div").infos();
1783
1784          break
1785        case "charlie":
1786
1787          Zone_image.zoom = 1;
1788
1789          break
1790
1791        case "iframe":
1792          wpng = 0;
1793          Zone_image.image.width = options.theImageWidth;
1794          Zone_image.image.height = options.theImageHeight;
1795          Zone_image.zoom = 1;
1796          break
1797        case "pamoorama":
1798          Wait_pamoorama();
1799          break
1800      }
1801
1802
1803
1804      //=================================================
1805      if (Zone_image.image.height < options.mini_height2) {
1806        Zone_image.image.height = parseInt(options.mini_height2);
1807        Zone_image.image.width = Math.ceil(Zone_image.image.height * Zone_image.image_init.rapport);
1808      }
1809      if (Zone_image.image.width < options.mini_width2) {
1810        Zone_image.image.width = parseInt(options.mini_width2);
1811        Zone_image.image.height = Math.ceil(Zone_image.image.width / Zone_image.image_init.rapport);
1812      }
1813      //==================================================
1814      //   ImageWidthidth largeur à atteindre
1815      //   Calcul du rapport d'agrandissement
1816
1817      echelle_max = parseFloat(options.echelle_max, '3');
1818      if (Zone_image.zoom > echelle_max) {
1819        Zone_image.zoom = echelle_max;
1820        Zone_image.image.width = parseInt(Zone_image.image_init.width * Zone_image.zoom);
1821        if (Zone_image.image_init.rapport > 0)
1822          Zone_image.image.height = parseInt(Zone_image.image_init.width / Zone_image.image_init.rapport);
1823      }
1824      if (Type_Img != "pamoorama") {
1825        mxi = Math.ceil(Zone_image.image.height + Zone_image.marges.height);
1826        Zone_image.container.height = Math.max(Zone_image.container.height, mxi);
1827      }
1828      img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
1829      return true;
1830    }
1831    //________________ Get_dimensions ___________________
1832
1833
1834    /*****************************
1835    *  init_gen
1836    *****************************/
1837    init_gen = function (e) {
1838      theImg = document.getElementById(theMainImage_id.replace("#", ""));
1839      //==================================================
1840      marges_llgbo = 0;
1841      options.marges_llgbo = 0;
1842      if (jQuery(llgbo_id).length > 0) {
1843        infos_llgbo = jQuery(llgbo_id).infos(true);
1844        if (infos_llgbo.visible == true) {
1845          if (infos_llgbo.height > 0) {
1846            infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
1847            infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
1848            //=============================================
1849            ll2 = infos_llgboframe1.width; // llgboframe1
1850            ll1 = infos_llgboframe31.general.width; // llgboframe31
1851            options.marges_llgbo = (ll1 - ll2);
1852            infos_llgboh2 = jQuery("#llgboh2").infos();
1853          }
1854        }
1855
1856        marges_llgbo = options.marges_llgbo;
1857      }
1858
1859      //========= Récupération des informations ============= 
1860
1861      options.marge_top = 0;
1862      pAll = jQuery(llgbo_id).absoluteAll({ absolute: true });
1863      infos_llgbo.top = pAll.Top;
1864      infos_llgbo.bottom = pAll.Bottom;
1865      pAll = jQuery(theMainImage_id).absoluteAll({ absolute: true });
1866      pos_top = pAll.Top; ;
1867      pos_bottom = pAll.Bottom; ;
1868
1869      if (infos_llgbo.top > 0) {
1870        pos_top = infos_llgbo.top;
1871
1872        options.marge_top = infos_theMainImage.top - infos_theImage.top;
1873      } else
1874        pos_top = infos_theImageAndInfos.top;
1875
1876      options.pos_top = pos_top;
1877      options.marge_left = infos_theImage.general.marges.left + Math.ceil(options.marge_gauche);
1878      options.marge_right = infos_theImage.general.marges.right + Math.ceil(options.marge_droite);
1879      options.marge_top += infos_theImage.general.marges.top + infos_content.general.marges.top + Math.ceil(options.marge_haute);
1880      options.marge_bottom = Math.ceil(options.marge_basse); // +infos_content.general.marges.bottom; ;
1881      if (options.pictureDeriv == null)
1882        options.first = true;
1883      else
1884        options.first = false;
1885      //=================== Gestion liste photos size ============================
1886      us = 0;
1887      if (!options.theMainImageWidth) options.theMainImageWidth = options.scaledWidth;
1888      if (!options.theMainImageHeight) options.theMainImageHeight = options.scaledHeight;
1889
1890      if (options.first) {
1891        if (options.pictureDeriv) {
1892
1893          pictureSelType = options.pictureSelType;
1894          options.pictureMap = options.pictureDeriv;
1895
1896        } else {
1897          IMg = Get_Maxi(Zone_image.image);
1898          options.pictureDeriv = IMg.pictureDeriv;
1899          imgSrc = IMg.url;
1900          width = IMg.width;
1901          height = IMg.height;
1902          options.pictureDeriv = IMg.pictureDeriv;
1903          options.pictureMap = IMg.pictureMap;
1904        }
1905      }
1906      if (pictureSelType_user != options.pictureSelType) {
1907        /*
1908        user_status = options.user_status;
1909        pictureSelType_user = eval("options." + user_status + "_type"); //limite taille
1910        */
1911        pictureDeriv_user = options.pictureDeriv;
1912        options.pictureDeriv_user = pictureDeriv_user;
1913        pictureSelType = options.pictureSelType;
1914      }
1915      //=================== 2==================================
1916      href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "SelMaxi" + "')";
1917      spans = jQuery("#derivativeCheckedSelMaxi").next();
1918      spans.attr("href", href_path);
1919      spans.attr("name", "SelMaxi");
1920      spans = spans.find("span");
1921      spans.attr("name", "SelMaxi");
1922      spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")");
1923      //==========================================================
1924      href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "Autosize" + "')";
1925
1926      spans = jQuery("#derivativeCheckedAutosize").next();
1927      spans.attr("href", href_path);
1928      spans.attr("name", "Autosize");
1929      spans = spans.find("span");
1930      spans.attr("name", "Autosize");
1931      spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")");
1932      //==========================================================
1933
1934      if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
1935        spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
1936        spans.addClass("linkAutosize");
1937        spans.find("span").addClass("auto_details");
1938      }
1939      pictureDeriv = options.pictureDeriv;
1940      Autosize_resize(true, options);
1941      Autosize_resize(true, options);
1942    };
1943    //_______________________ init_gen _______________________
1944
1945
1946    /*********************************************
1947    * DEBUG ....
1948    *********************************************/
1949    /*
1950    if (DEBUG_autosize.match("true",gi))   {
1951    for (var i = 0; i < 10; i++) {
1952    jQuery('#adddebugs').click();
1953    }
1954    jQuery(jQuery('.debug').get(i - 1)).click();
1955    }
1956    */
1957
1958    // Custom Event, ON to turn on a debug.
1959    jQuery('.debug').live('ON', function (e) {
1960
1961      nu_img = jQuery(this).text();
1962      jQuery('.debug').trigger('OFF');
1963      jQuery(this).addClass('debugOn');
1964
1965    });
1966
1967    // On Click = debugs On
1968    jQuery('.debug').live('click', function (e) {
1969      i = jQuery(this).text();
1970      jQuery(this).trigger('ON');
1971    });
1972
1973    // Custom Event, Turn off a debug
1974    jQuery('.debug').live('OFF', function (e) {
1975      jQuery(this).removeClass('debugOn');
1976    });
1977
1978    // on Double Click, remove the debug from the DOM
1979    jQuery('.debug').live('dblclick', function () {
1980      jQuery(this).fadeOut(function () { jQuery(this).remove() });
1981    });
1982
1983    // Add another debug to the DOM
1984    jQuery('#adddebugs').click(function () {
1985      i = jQuery('.debug').length;
1986      jQuery('<div>' + i + '</div>')
1987    .addClass('debug')
1988    .appendTo('#debugsContainer');
1989    });
1990
1991
1992
1993    if (DEBUG_autosize.match("mouse", "gi")) {
1994      var mouseLocation = new Point(-500, -500);
1995      function Point(x, y) {
1996        this.x = x; this.y = y;
1997      }
1998      register_position();
1999
2000      function register_position() {
2001        mouse_x = 0;
2002        mouse_y = 0;
2003        //  document.onmousemove = position;
2004
2005      }
2006
2007      function position(evt) {
2008        if (!evt) evt = window.event;
2009        mouseLocation.x = evt.clientX;
2010        mouseLocation.y = evt.clientY;
2011      }
2012
2013      jQuery("div,a,img").mousemove(function (evt) {
2014
2015        if (!evt) evt = window.event;
2016        mouseLocation.x = evt.clientX;
2017        mouseLocation.y = evt.clientY;
2018        Context = jQuery(this).context.nodeName;
2019        obj_id = "#" + this.id.toString();
2020        infos_g = jQuery(obj_id).infos(true);
2021        infos_g.top = jQuery(obj_id).absoluteTop();
2022        wg = jQuery("body").width() - infos_g.right;
2023
2024        affiche_debug({
2025
2026          Debug1: Debug_info(1, "x:" + mouseLocation.x
2027    + " y: " + mouseLocation.y
2028    + " id: " + obj_id
2029    + " top: " + infos_g.top,
2030    +" Node: " + Context
2031    , "->")
2032    ,
2033          Debug2: Debug_info(2, "W:" + infos_g.general.width
2034    + " H: " + infos_g.general.height
2035    + " right: " + (wg)
2036    + " left: " + infos_g.left
2037    + " Node: " + Context
2038    , "->")
2039        });
2040
2041      });
2042
2043    }
2044
2045
2046    //=======================================================================================
2047    Debug_info = function (index, infos, Nom_str) {
2048      if (typeof infos == "undefined") return;
2049      width_g = Math.ceil(jQuery("body").width() / 5) - 10;
2050      if (typeof infos.height != "undefined") {
2051        message = " -- > Info : " + Nom_str + " " + infos.id + "\n" +
2052                         "Info nodeName: " + infos.nodeName + "\n" +
2053                         "Info width: " + infos.width + "\n" +
2054                         "Info height: " + infos.height + "\n" +
2055                         "Info top: " + infos.top + "\n" +
2056                         "Info left: " + infos.left + "\n" +
2057                         "Info position: " + infos.position + "\n";
2058
2059        myDebug = { id: "Debug" + index, texte: message,
2060          css: {
2061            color: "black",
2062            opacity: "1",
2063            position: "absolute",
2064            height: infos.height || pos_top - 30 + "px",
2065            width: infos.width || width_g + "px",
2066            left: infos.left || 0 + "px",
2067            border: "solid 1px green",
2068            top: infos.top + "px"
2069          }
2070        }
2071        return myDebug;
2072
2073      } else {
2074        if (typeof old_messages == "undefined") {
2075          old_messages = new Array();
2076
2077        }
2078        if (infos != "" && infos != "undefined") {
2079          nc0 = old_messages[index] || "";
2080          if (typeof nc0 != "undefined") {
2081            nc0 = nc0.toString().split("<br />");
2082            if (nc0.length > 4) nc0.shift();
2083            old_messages[index] = nc0.join("<br />");
2084          }
2085          old_messages[index] += "" + Nom_str + "->" + infos + "<br />";
2086          message = old_messages[index];
2087          colors = Array('black', 'white', 'white', 'white', 'white', 'white', 'red');
2088          myDebug = { id: "Debug" + index, texte: message,
2089            css: { display: "block",
2090              color: colors[index - 1],
2091              opacity: "1",
2092              position: "absolute",
2093              align: "left",
2094              height: 80 + "px",
2095              width: width_g + "px",
2096              left: ((index - 1) * width_g) + "px",
2097              border: "solid 1px green",
2098              top: 0 + "px"
2099            }
2100          }
2101          return myDebug;
2102        }
2103      }
2104
2105
2106    } //Debug_info
2107    //====================================================
2108    affiche_debug = function (aff_infos) {
2109      jQuery(jQuery("[id ^='Debug']")).each(function (i) {
2110        if (aff_infos[this.id]) {
2111          if (aff_infos[this.id].css) {
2112            jQuery("#" + this.id).css(aff_infos[this.id].css);
2113            jQuery("#" + this.id).html(aff_infos[this.id].texte);
2114          }
2115        }
2116      });
2117      return;
2118    }
2119    //___________ affiche_debug ____
2120    //====================================================
2121    function Debug_pos() {
2122      return;
2123      if (DEBUG_autosize.match("true", gi)) {
2124
2125        jQuery("[id ^='Debug']").show();
2126        /*
2127        Debug2  background-color:yellow
2128        Debug3 background-color:blue
2129        Debug4 background-color:green
2130        Debug5 background-color:red
2131
2132        */
2133
2134        affiche_debug({
2135          Debug5: Debug_info(5, infos_theMainImage, "infos_theMainImage")
2136        });
2137      }
2138    } // Debug_pos
2139    //==========================================================
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149  });                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     // ready
2150
2151
2152  jQuery("#derivativeSwitchBox a").click(function (e) {
2153    k1 = 0;
2154  });
Note: See TracBrowser for help on using the repository browser.