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

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

[extensions] Autosize fix compatibility with 2.4 (fix bugs)

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