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

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

[extensions] Autosize Minor corrections

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