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

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

[extensions] Autosize update to piwigo 2.5 (fix autosize with pamooramics)

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