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

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

[extensions] Autosize fix bug crop

File size: 79.6 KB
Line 
1// problème avec GMaps+diaporama:
2// corriger   gmaps_pip.class.inc.php ajouter ligne 90 if ( !isset($_GET['slideshow']))
3//============================================================== 
4  jQuery.Affiche_script = { version: '2.0.0' };
5  /********************************************
6  *  document ready
7  ********************************************/
8  jQuery(document).ready(function (jQuery) {
9    var Type_Img;
10    var theImg;
11    var Zone_image;
12
13    /******************************************
14    * test_theme("mont,pur") ...
15    ******************************************/
16
17    test_theme = function (param) {
18      if (!param) return
19      if (!options.theme) return;
20
21      regx = new RegExp(param, "gi");
22      return (options.theme.match(regx))
23
24    }
25    /******************************************
26    * Save_cookies
27    ******************************************/
28    Save_cookies = function (parametres) {
29      parametres.windowHeight = jQuery(window).height();
30      parametres.windowWidth = jQuery(window).width();
31      try {
32        if (parametres.pictureDeriv) jQuery.cookie('picture_deriv', parametres.pictureDeriv, { path: COOKIE_PATH });
33        if (parametres.pictureSelType) jQuery.cookie('picture_sel_type', parametres.pictureSelType, { path: COOKIE_PATH });
34        if (parametres.pictureMap) jQuery.cookie('picture_map', parametres.pictureMap, { path: COOKIE_PATH });
35        if (parametres.imgSrc) jQuery.cookie('img_src', parametres.imgSrc, { path: COOKIE_PATH });
36        if (parametres.theMainImageHeight) jQuery.cookie('theMainImageHeight', parametres.theMainImageHeight, { path: COOKIE_PATH });
37        if (parametres.theMainImageWidth) jQuery.cookie('theMainImageWidth', parametres.theMainImageWidth, { path: COOKIE_PATH });
38        if (parametres.theImageHeight) jQuery.cookie('theImageHeight', parametres.theImageHeight, { path: COOKIE_PATH });
39        if (parametres.theImageWidth) jQuery.cookie('theImageWidth', parametres.theImageWidth, { path: COOKIE_PATH });
40        if (parametres.windowHeight) jQuery.cookie('windowHeight', parametres.windowHeight, { path: COOKIE_PATH });
41        if (parametres.windowWidth) jQuery.cookie('windowWidth', parametres.windowWidth, { path: COOKIE_PATH });
42        if (parametres.theImageTop) jQuery.cookie('theImageTop', parametres.theImageTop, { path: COOKIE_PATH });
43        if (parametres.theImageLeft) jQuery.cookie('theImageLeft', parametres.theImageLeft, { path: COOKIE_PATH });
44        if (parametres.theImageRight) jQuery.cookie('theImageRight', parametres.theImageRight, { path: COOKIE_PATH });
45        if (parametres.theImageBottom) jQuery.cookie('theImageBottom', parametres.theImageBottom, { path: COOKIE_PATH });
46        if (parametres.theImageMargeZone) {
47          jQuery.cookie('theImageMargeWidth', parametres.theImageMargeZone.width, { path: COOKIE_PATH });
48          jQuery.cookie('theImageMargeHeight', parametres.theImageMargeZone.height, { path: COOKIE_PATH });
49        }
50      } catch (e) {
51        n = 1;
52      }
53
54
55    }
56    //____________________ Save_cookies _____________________________
57    /************************************************
58    *  Get COOKIE
59    *************************************************/
60    Get_cookies = function () {
61      parametres = {
62        pictureDeriv: jQuery.cookie('picture_deriv'),
63        pictureMap: jQuery.cookie('picture_map'),
64        pictureSelType: jQuery.cookie('picture_sel_type'),
65
66        imgSrc: jQuery.cookie('img_src'),
67        theMainImageHeight: jQuery.cookie('theMainImageHeight'),
68        theMainImageWidth: jQuery.cookie('theMainImageWidth'),
69
70        windowHeight: jQuery.cookie('windowHeight'),
71        windowWidth: jQuery.cookie('windowWidth'),
72
73        theImageHeight: jQuery.cookie('theImageHeight'),
74        theImageWidth: jQuery.cookie('theImageWidth'),
75        theImageTop: jQuery.cookie('theImageTop'),
76        theImageLeft: jQuery.cookie('theImageLeft'),
77        theImageBottom: jQuery.cookie('theImageBottom'),
78        theImageRight: jQuery.cookie('theImageRight'),
79        theImageMargeZone: { width: jQuery.cookie('theImageMargeWidth'),
80          height: jQuery.cookie('theImageMargeHeight')
81        }
82
83
84      }
85      return parametres;
86    }
87    //____________________ Get_cookies _____________________________
88
89
90
91    /*************************************************
92    * Recupère le Type d'mage
93    *************************************************/
94    Get_type_img = function (e) {
95      //====== détection du type d'images ======
96
97      if (jQuery("#charlie").length > 0) {
98        Type_Img = "charlie";
99      } else if (jQuery("#Panorama").length > 0) {
100        Type_Img = "panorama";
101
102      } else if (jQuery("#pamoorama").length > 0) {
103        Type_Img = "pamoorama";
104        options.valide = true;
105
106        infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true });
107
108      } else if (jQuery("#map").length > 0 || jQuery("#mapPicture").length > 0) {
109        Type_Img = "map";
110      } else if (jQuery("#Panorama").length) {
111        Type_Img = "panorama";
112      } else if ((jQuery("#theImage" + " iframe").length + jQuery("#theImage" + " object").length + jQuery("#theImage" + " embed").length) > 0) {
113
114        if (jQuery("#theImage" + " object").length > 0) {
115
116          type_src = "object";
117
118        } else if (jQuery("#theImage" + " embed").length > 0) {
119
120          type_src = "embed";
121
122        } else {
123
124          type_src = "iframe";
125        }
126        nbf = jQuery("#theImage" + " " + type_src).length;
127        frm1 = jQuery("#theImage" + " " + type_src).get(0);
128        Type_Img = "iframe";
129        //'fb - xfbml - like - button
130        objs = jQuery("#theImage" + " div").get(0);
131        if (jQuery(objs).length > 0) {
132          id_0 = jQuery(objs).attr("id");
133          if (id_0 == "") {
134            jQuery(objs).attr("id", "charlie");
135          } else {
136            if (nbf > 1) {
137              jQuery(frm1).attr("id", "charlie");
138            } else {
139              //  Type_Img = "img";
140            }
141          }
142        } else {
143          jQuery(frm1).attr("id", "iframe");
144          jQuery(frm1).wrap('<div id="' + "theMainImage" + '" style="border:1px solid Transparent" />');
145        }
146
147
148      } else if (jQuery("#theImage").find("img").length > 0) {
149        Type_Img = "img";
150      } else if (jQuery("#theImage" + "Box").find("img").length > 0) {
151        Type_Img = "img";
152        Parent = Parent + "Box";
153      } else if (jQuery("img").length > 0) {
154        Type_Img = "img_autre";
155        return;
156      } else {
157        return;
158      }
159    }
160    //____________________ Get_type_img _____________________________
161
162    //====================================
163    //  set_cl
164    //====================================
165    set_cl = function (Valid) {
166
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(".Autosize").css("top"));
513    options.marge_basse = Math.max(
514  jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("bottom")),
515  options.marge_basse
516  );
517
518    options.marge_gauche = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("left"));
519    options.marge_droite = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").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
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        options.pictureSelType = retour.pictureSelType;
832        options.pictureDeriv = retour.pictureDeriv;
833        options.pictureMap = retour.pictureDeriv;
834
835        if (this.name) {
836          options.pictureSelType = this.name;
837          // n = Get_dimensions(true, options);
838        } else {
839
840        }
841        Autosize_resize(true, options);
842      }
843    });
844    //__________ fin click #derivativeSwitchBox a ____________
845
846    jQuery("input").click(function () {
847      if (this.name.match(RegExp("_enabled", "gi"))) {
848        sel = "[name*=" + this.name + "]";
849        obj = jQuery("tr" + sel);
850
851        if (this.checked)
852          obj.css({ backgroundColor: "green", color: "white" });
853        else
854          obj.css({ backgroundColor: "red", color: "white" });
855        return;
856      }
857      return;
858    });
859
860
861    //====================================
862    Autosize_init = function (name, value) {
863      img_defaut = { height: options.scaled_height, width: options.scaled_width };
864      img_reelle = { height: options.theImageHeight, width: options.theImageWidth };
865      img_init = { height: options.theImageHeight, width: options.theImageWidth };  // taille initiale
866
867      img_finale = img_init;
868
869      useMap = infos_theMainImage.useMap; // #mapmedium
870
871      useMap = options.pictureMap; // #mapxxx
872      pictureDeriv = options.pictureDeriv; //picturederiv xxx
873
874
875      old_img = options.imgSrc;
876      old_window_height = options.windowHeight || jQuery(window).height();
877      old_window_width = options.windowWidth || jQuery(window).width();
878      old_img_h = options.imgHeight;
879      old_img_w = options.imgWidth;
880      if (infos_theMainImage.visible == true) {
881        theImg = document.getElementById(theMainImage_id.replace("#", ""));
882        theImg.useMap = useMap;
883      }
884      fade_in = parseInt(options.fade_in || 0);
885
886    }
887    //____________________ Autosize_init _____________________
888
889    /***************************
890    * Autosize_resize
891    ***************************/
892    Autosize_resize = function (force, parametres) {
893
894      nAuto = Get_dimensions(true, options);
895
896      Save_cookies(options);
897      if (!options.valide || nAuto == false || (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi")) {
898        if (options.imageAutosize == true) {
899          options.pictureSelType = options.pictureDeriv;
900          Zone_image.image_init.width = jQuery(theImg).width();
901          Zone_image.image_init.height = jQuery(theImg).height();
902          set_cl("no");
903          Set_llbgo(true);
904          return;
905        }
906        //  jQuery(theImg).width(Zone_image.image_init.width);
907        jQuery(theImg).height(Zone_image.image_init.height);
908        set_cl("no");
909        Set_llbgo(true);
910        return;
911
912      }
913      infos_theImage = jQuery(theImage_id).infos(true);
914      if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
915      if (img_finale.width && (img_finale.width != Zone_image.image.width || img_finale.height != Zone_image.image.height)) {
916        img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
917      }
918
919      //======================================================
920
921      affiche_debug({
922
923        Debug1: Debug_info(1, "Cont:" + infos_theImage.width
924    + " X " + infos_theImage.height
925    + " IMG: " + img_finale.width
926    + " X " + img_finale.height
927    + " mgw : " + Zone_image.marges.width
928    , "->")
929      });
930
931      if (Type_Img == "pamoorama") {// img_finale.width
932        jQuery("#pamoorama").width(img_finale.width);
933        jQuery("#pamoorama").height(img_finale.height);
934
935
936        infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true });
937
938        Set_Pamoorama({ width: img_finale.width, height: img_finale.height });
939        if (nopano)
940          if (window.myPamoorama.options.autoscrollOnLoad) {
941            window.myPamoorama.startAnimRight();
942          }
943
944        //jQuery(theMainImage_id).height(Zone_image.image.height);
945      } else if (Type_Img == "panorama") {
946        // jQuery("#pamoorama").width(img_finale.width);
947        // jQuery("#pamoorama").height(img_finale.height);
948
949
950
951        //   jQuery("#theImage img.simple_panorama").panorama(asp_options);
952      } else {
953        if (options.imageAutosize == false)
954          if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
955            jQuery(theMainImage_id).height(Zone_image.image.height);
956            r1 = infos_theImage.width / infos_theImage.height;
957            // jQuery(theMainImage_id).width(Zone_image.image.width/r1);
958            jQuery(theMainImage_id).css("margin-top", options.marge_haute);
959
960
961          } else {
962            jQuery(theMainImage_id).width(Zone_image.image_init.width);
963            jQuery(theMainImage_id).height(Zone_image.image_init.height);
964          }
965
966
967        if (Type_Img == "charlie" || Type_Img == "iframe") {
968          init_w1 = Zone_image.image.width;
969          init_h1 = Zone_image.image.height;
970
971          if (pictureSelType_user != "Autosize" && pictureSelType_user != "SelMaxi") {
972            init_w1 = Autosize_options.ideal_size_width;
973            init_h1 = Autosize_options.ideal_size_height;
974          }
975          if (Type_Img == "charlie") {
976            dp1 = jQuery("#charlie").offset();
977            dp = jQuery("#" + the_mainImage_obj).offset();
978            if (dp) {
979              if (wpng == 0)
980                wpng = Math.abs(dp.left - dp1.left) * 2;
981            }
982            png_h = init_h1;
983            w01 = init_w1 - wpng;
984
985            jQuery("#" + "theImage").css({ padding: 0 });
986            if (!png_h) {
987              png_h = jQuery("#theMainImage").height();
988              h01 = png_h;
989            } else
990              h01 = Math.ceil(w01 / Zone_image.image.rapport);
991            //==== Zone Affichage =====
992            jQuery("#theMainImage").height(png_h);
993            jQuery("#theMainImage").width(w01 + wpng);
994            jQuery("#theMainImage").css({ verticalAlign: "middle", align: "center", textAlign: "center", margin: "auto" });
995
996            jQuery("#" + the_mainImage_obj).attr("width", w01);
997            jQuery("#" + the_mainImage_obj).attr("height", h01);
998
999            jQuery("#theMainImage_emb").attr("width", w01); //firefox opera
1000            jQuery("#theMainImage_emb").attr("height", h01);
1001
1002            if (jQuery("#theMainImage_vid").length > 0) {
1003              jQuery("#theMainImage_vid").attr("width", w01);
1004              jQuery("#theMainImage_vid").attr("height", h01);
1005            }
1006            if (jQuery("video").length > 0) {
1007              jQuery("video").attr("width", w01);
1008              jQuery("video").attr("height", h01);
1009            }
1010            jQuery("#" + Type_Img).height(png_h);
1011            jQuery("#" + Type_Img + " div").width(w01);
1012            jQuery("#theImage").css({ height: "auto" });
1013          } else {
1014            jQuery("#theImage").css({ height: "auto" });
1015            jQuery("#theMainImage").css({ width: "auto", height: "auto" });
1016            jQuery("#" + Type_Img).attr("width", init_w1 - (infos_theMainImage.borderwidth.left + infos_theMainImage.borderwidth.right));
1017            jQuery("#" + Type_Img).attr("height", init_h1 - (infos_theMainImage.borderwidth.top + infos_theMainImage.borderwidth.bottom));
1018          }
1019          jQuery("#" + Type_Img).show(options.fade_in);
1020        }
1021
1022
1023      }
1024
1025      set_cl();
1026      Set_llbgo(true);
1027      return true;
1028    };
1029    //_________________Autosize ____________________________________   
1030
1031    /*****************
1032    * changeImgSrc
1033    ******************/
1034    changeImgSrc = function (url, typeSave, typeMap, type) {
1035      if (type == "Autosize" || type == "SelMaxi") {
1036
1037      }
1038      if (COOKIE_PATH == type) {
1039        type = options.pictureSelType;
1040      }
1041      if (typeof type != "undefined") {
1042        options.pictureSelType = type;
1043      } else {
1044        type = options.pictureSelType;
1045      }
1046      options.pictureDeriv = typeSave;
1047      typeMap = typeSave;
1048      options.pictureMap = typeMap;
1049      options.pictureDeriv = typeSave;
1050      jQuery.cookie('picture_deriv', typeSave, { path: COOKIE_PATH });
1051
1052      url_old = jQuery("#theMainImage").attr("src");
1053
1054      jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
1055      if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) {
1056        jQuery('#derivativeChecked' + type).css('visibility', 'visible');
1057        jQuery.cookie('picture_sel_type', type, { path: COOKIE_PATH });
1058      } else {
1059
1060        jQuery('#derivativeChecked' + typeSave).css('visibility', 'visible');
1061        jQuery.cookie('picture_sel_type', typeSave, { path: COOKIE_PATH });
1062      }
1063      if (url != url_old) {
1064        jQuery("#theMainImage").attr("src", url);
1065      }
1066      // jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")
1067      jQuery("#theMainImage").removeAttr("width height")
1068      .load(function (i) {
1069        if (!init_img(this)) {
1070          return;
1071        }
1072        //=======================================================================   
1073
1074      })
1075      .error(function (e) {
1076        imgsrc = this.src;
1077        if (!this.complete) {
1078          // le fichier n'est pas present
1079          imgsrc = jQuery(this).attr("src");
1080          return false;
1081        }
1082
1083      })
1084           .live("Success", function (e) {
1085             if (typeof imageInfos_id == "undefined") return false;
1086           })
1087
1088            .live("Error", function (data) {
1089              if (typeof imageInfos_id == "undefined") return;
1090
1091            })
1092             .live("fail", function (data) {
1093               if (typeof imageInfos_id == "undefined") return;
1094
1095             })
1096              .live("Progress", function (data) {
1097                if (typeof imageInfos_id == "undefined") return;
1098
1099              })
1100              .live("IsRejected", function (data) {
1101                if (typeof imageInfos_id == "undefined") return;
1102
1103              })
1104         .live("Finish", function (e, data) {
1105           if (typeof imageInfos_id == "undefined") return;
1106
1107         })
1108         .live("change", function (e) {
1109           theMainImage_st = this.complete;
1110           imgsrc = this.src;
1111         })
1112            .live("Complete", function (e, data) {
1113              if (data.statusText != "OK") {
1114                popup = jQuery(".errors");
1115                if (popup.length == 0) {
1116                  jQuery("#theImage").append("<div class='errors'><span></span></div>");
1117                }
1118                jQuery(".errors").text("Erreur : [" + data.done + "] " + data.src);
1119                jQuery(".errors").show().delay(10000).hide(2000);
1120                return;
1121              }
1122              if (data.src) { }
1123              if (options.pictureDeriv == "Original" && data.src.match(RegExp("\-.." + ".jpg", "gi"))) {
1124                //    Autosize_resize(true, options);
1125              } else if (data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) {
1126                //    Autosize_resize(true, options);
1127              } else {
1128
1129              }
1130
1131            });
1132      //_________ theMainImage  ___________
1133
1134    }
1135
1136    //__________________ changeImgSrc ______________________
1137
1138    /*****************************
1139    *      pamoorama
1140    ******************************/
1141
1142
1143    jQuery("#pamoorama").bind("on", function () { alert($(this).text()); });
1144    jQuery("#pamoorama").bind("on", function (e) {
1145      myPamoorama = window.myPamoorama;
1146    });
1147    jQuery("#pamoorama_inner").live("on", function (e) {
1148      myPamoorama = window.myPamoorama;
1149    });
1150    jQuery('#pamoorama').live('ON', function (e) {
1151      jQuery(jQuery('.debug').get(1)).trigger('ON');
1152      Autosize_resize(true, options);
1153    });
1154
1155    //===============================================
1156    // jQuery("#theImage").trigger("Start_right");
1157    //===============================================
1158    jQuery("#theImage").live('Start_right', function (e) {
1159      if (typeof Zone_image == "undefined") return
1160      test_w = window.myPamoorama.autoSlideFx.to;
1161      test_w = window.myPamoorama.autoScrollFx.to;
1162      nf = jQuery("#pamoorama_thumb").height();
1163      jQuery("#pamoorama_thumb img").width(200);
1164      jQuery("#pamoorama_thumb img").height(nf);
1165      // 200=window.myPamoorama.imageWidth
1166      // frame = Zone_image.container.width
1167      nw = (200 * Zone_image.image.width) / window.myPamoorama.imageWidth;
1168      jQuery("#pamoorama_frame").width(nw);
1169    });
1170    //===============================================
1171    // jQuery("#theImage").trigger("Start_left");
1172    //===============================================
1173    jQuery("#theImage").live('Start_left', function (e) {
1174      if (typeof Zone_image == "undefined") return
1175      jQuery("#theImage").show(0);
1176      window.myPamoorama.autoSlideFx.to = 0;
1177      test_w = window.myPamoorama.autoSlideFx.to;
1178      test_w = window.myPamoorama.autoScrollFx.to;
1179      nf = jQuery("#pamoorama_thumb").height();
1180      jQuery("#pamoorama_thumb img").width(200);
1181      jQuery("#pamoorama_thumb img").height(nf);
1182    });
1183
1184    /************************************
1185    * Wait_pamoorama
1186    ************************************/
1187    Wait_pamoorama = function () {
1188      if (Type_Img != "pamoorama") return;
1189      tempo = 0;
1190      Wait_pamoorama_st = false;
1191
1192
1193      while (Wait_pamoorama_st == false) {
1194        Wait_pamoorama_st = Wait_pamoorama_time();
1195        jQuery.noop();
1196      }
1197      tempo = 0;
1198      if (nopano) {
1199        if (window.myPamoorama.options.autoscrollOnLoad) {
1200          window.myPamoorama.startAnimRight();
1201          jQuery.delay(100);
1202        }
1203
1204
1205
1206      }
1207
1208    }
1209    //__________________ Wait_pamoorama ______________________
1210    jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) {
1211
1212    }).mouseover(function (i) {
1213
1214    });
1215
1216    Wait_pamoorama_time = function () {
1217      if (nopano == true) return true;
1218      if (jQuery("#pamoorama").length) {
1219        tempo = tempo + 1;
1220
1221        mypanorama = window.myPamoorama;
1222        if (!mypanorama) {
1223          if (tempo > 500) return true;
1224          setTimeout("Wait_pamoorama_time()", 500);
1225          return false;
1226
1227        }
1228
1229        if (mypanorama.skipInit == false) {
1230          if (tempo > 500) return true;
1231          setTimeout("Wait_pamoorama_time()", 500);
1232          return false;
1233        }
1234        //=============================================================
1235        if (Math.abs(mypanorama.imageHeight) < 100) {
1236          setTimeout("Wait_pamoorama_time()", 500);
1237          return false;
1238        }
1239
1240        if (jQuery(".infos").length > 0) {
1241          jQuery(".infos").empty();
1242          jQuery(".infos").hide();
1243        }
1244
1245        nopano = true;
1246
1247        Zone_image = { image_init: { width: mypanorama.imageWidth,
1248          height: mypanorama.imageHeight
1249        }
1250        }
1251        jQuery("#pamoorama").trigger("ON");
1252        return true;
1253
1254      }
1255    }
1256    //__________________ Wait_pamoorama time______________________
1257
1258    /**********************
1259    *
1260    ***********************/
1261    Wait_Affichage = function () {
1262      Wait_Affichage_st = false;
1263      while (Wait_Affichage_st == false) {
1264        jQuery.noop();
1265        Wait_Affichage_st = Wait_Affichage_time();
1266      }
1267    }
1268    //__________________ Wait_Affichage ______________________
1269
1270
1271    Wait_Affichage_time = function () {
1272      if (typeof fade_in == "undefined") fade_in = 1000;
1273      fade_in = parseInt(fade_in);
1274      /*
1275      if (!Autosize_resize()) {
1276      setTimeout("Wait_Affichage()", 500);
1277      return
1278      } 
1279      nu_img++;     
1280      */
1281      if (typeof fade_in == "undefined") fade_in = 0;
1282
1283      //   if (nu_img > 1) return;
1284      if (typeof stb != "undefined")
1285        stb.stop().fadeTo(3500, 0);
1286      if (typeof theMainImage_id == "undefined") return true;
1287
1288      if (theMainImage_id.selector) {
1289        theMainImage_id = theMainImage_id.selector;
1290      }
1291      if (theMainImage_id == null) return;
1292
1293      if (jQuery(theMainImage_id).length == 0) {
1294        if (jQuery("#pamoorama_inner").length > 0) {
1295          return true;
1296        }
1297        //=== attente Image chargée ===
1298        if (tempo > 100) return true;
1299        tempo++;
1300        setTimeout("Wait_Affichage_time()", 500);
1301        return false;
1302
1303      } else {
1304
1305        img_h = jQuery(theMainImage_id).height();
1306        img_w = jQuery(theMainImage_id).width();
1307
1308        if (typeof infos_theImage == "undefined") return;
1309        jQuery("#ret_autosize").trigger('ON', {
1310          width: img_w,
1311          height: img_h,
1312          theImage: theMainImage_id,
1313          img_src: infos_theMainImage.src,
1314          window_height: infos_theImage.height,
1315          window_width: infos_theImage.width
1316        });
1317      }
1318      return true;
1319    }
1320    //______________ Wait_affichage ______
1321
1322
1323    /***********************
1324    *
1325    **********************/
1326    init_img = function (theImg) {
1327      if (theImg.complete == false) {
1328        return;
1329      }
1330      name_src = theImg.src;
1331      stx = name_src.match(RegExp(Zone_image.src, "gi"));
1332      if (stx == null) {
1333        return false;
1334      }
1335      img_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() }
1336
1337      if (typeof theImg.naturalWidth != "undefined")
1338        img_init.width = theImg.naturalWidth;
1339      if (typeof theImg.naturalHeight != "undefined")
1340        img_init.height = theImg.naturalHeight;
1341      img_init.rapport = img_init.width / img_init.height;
1342      if (typeof Zone_image == "undefined") Zone_image = { image: {} };
1343      if (typeof Zone_image.image == "undefined") Zone_image.image = { height: Zone_image.image_init.height, width: Zone_image.image_init.width };
1344      // theImg.height = img_init.height;
1345      //  theImg.width = img_init.width;
1346
1347      Zone_image.image_init = { height: img_init.height, width: img_init.width, rapport: img_init.rapport };
1348      Zone_image.zoom = Zone_image.image_init.height / img_init.height;
1349
1350      if (typeof Zone_image.src == "undefined") {
1351        Zone_image.src = name_src;
1352        return false;
1353      }
1354      stx = name_src.match(RegExp(Zone_image.src, "gi"));
1355      return stx;
1356    }
1357    //___________ init_img _______
1358
1359
1360
1361    //===========================================
1362    //
1363    //===========================================
1364    Set_Map = function (nds) {
1365      p0 = jQuery("#map").offset();
1366      if (!p0) return;
1367      infos_mapPicture = jQuery("#mapPicture").infos({ absolute: true });
1368      infos_theImage = jQuery("#theImage").infos({ absolute: true });
1369      jQuery("#map").removeAttr("height");
1370      jQuery("#map").removeAttr("width");
1371      jQuery("#map").width(infos_theImage.width - (infos_mapPicture.width));
1372      jQuery("#map").height(jQuery(window).height() - infos_theImage.top - infos_theImage.general.marges.height);
1373      return true;
1374    }
1375
1376    jQuery("map [name='#Autosize'] area").mouseover(function (e) {
1377      return;
1378    });
1379    //___ Set_Map ___
1380
1381    //=====================================
1382    //
1383    //=====================================
1384    Get_Maxi = function (Maxi_image) {
1385      var pt = options.liste_type;
1386      if (pt.length > 0) {
1387        tw = Maxi_image.width;  // valeur maxi
1388        th = Maxi_image.height;  // valeur maxi
1389        n = 0;
1390        maxi_size = { w: Maxi_image.width, h: Maxi_image.height, idx: -1 };
1391        mini_size = { w: tw, h: th, idx: 0 };
1392        size_derive = { w: 0, h: 0 };
1393        size_encours = { w: tw, h: th };
1394        //=================================
1395        jQuery(pt).each(function (i) {
1396          vn = this;
1397          v_pictureDeriv = vn[0]; v_imgSrc = vn[1]; v_width = parseInt(vn[2]); v_height = parseInt(vn[3]);
1398          size_derive = { w: v_width, h: v_height };
1399          if (v_pictureDeriv == options.pictureSelType || v_pictureDeriv == "Original") {
1400            maxi_size = size_derive;
1401            maxi_size.idx = n;
1402            return false
1403          }
1404
1405          if (v_pictureDeriv != "square" && v_pictureDeriv != "thumb" && v_pictureDeriv != "SelMaxi" && v_pictureDeriv != "Autosize") {
1406            if (size_derive.h > size_encours.h) {
1407              if (maxi_size.idx < 0) {
1408                maxi_size = size_derive;
1409                maxi_size.idx = n;
1410                if (options.pictureSelType == "SelMaxi" || options.pictureSelType == "Autosize")
1411                  return false
1412              }
1413            }
1414            if (size_derive.h < size_encours.h && size_derive.h > 10) {
1415              mini_size = size_derive;
1416              mini_size.idx = n;
1417            }
1418          }
1419          n++;
1420        });
1421
1422
1423
1424
1425        n = maxi_size.idx;
1426        if (n < 0) {
1427          n = mini_size.idx;
1428        }
1429        if (options.pictureSelType.match(RegExp("SelMaxi", "gi"))) {
1430          n = mini_size.idx;
1431
1432        }
1433        if (options.pictureSelType.match(RegExp("Autosize", "gi"))) {
1434
1435        }
1436
1437        pictureDeriv = pt[n][0];
1438        last_id = pt[n][0];
1439        jQuery(".switchCheck").each(function (i) {
1440
1441          if (!this.id.match(RegExp("Original", "gi"))) {
1442            if (this.id.match(RegExp("SelMaxi", "gi"))) return false;
1443            last_id = this.id.replace("derivativeChecked", "");
1444          }
1445          if (last_id == pictureDeriv)
1446            return false;
1447        });
1448
1449        options.pictureDeriv = last_id;
1450
1451        return { url: pt[n][1], pictureDeriv: last_id, pictureMap: last_id, width: pt[n][2], height: pt[n][3] };
1452      }
1453      return { imgSrc: "", pictureDeriv: "", width: "", height: "" };
1454    }
1455    //_______________ Get_Maxi ______
1456
1457    /********************
1458    *
1459    ********************/
1460    Select_Image = function () {
1461      var pt = options.liste_type;
1462
1463
1464      if (pt.length > 0) {
1465        //===== calcul Image ===
1466        if (typeof imageInfos_id == "undefined") return;
1467        Calcul_Image();
1468        options.theImageMargeZone = Zone_image.marges;
1469        if (Type_Img != 'charlie') {
1470          IMg = Get_Maxi(Zone_image.image);
1471          imgSrc = IMg.url;
1472          if (options.imgSrc.match(RegExp(imgSrc, "gi")))
1473            options.imgSrc = imgSrc;
1474
1475          img_width = IMg.width;
1476          img_height = IMg.height;
1477
1478          Zone_image.image_init = { height: IMg.height,
1479            width: IMg.width,
1480            rapport: IMg.width / IMg.height
1481
1482          };
1483          if (typeof Zone_image.image == "undefined")
1484            Zone_image.image = { height: IMg.height,
1485              width: IMg.width,
1486              rapport: IMg.width / IMg.height
1487
1488            };
1489        } else {
1490          return;
1491        }
1492        Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height;
1493        if (typeof Zone_image.src == "undefined") Zone_image.src = " ";
1494
1495        identique = Zone_image.src.match(RegExp(imgSrc, "gi"));
1496        if (identique) return;
1497        href_path = get_href(IMg.pictureDeriv);
1498        jQuery(".linkAutosize").attr("href", "javascript:" + href_path);
1499        theImg = document.getElementById(theMainImage_id.replace("#", ""));
1500
1501        if ((theImg == null) || theImg.tagName != "IMG") {
1502          imgSrc_i = jQuery(theImg).css("backgroundImage");
1503          imgSrc_j = jQuery(theImg).css("background-image");
1504          return;
1505        } else {
1506          last_id = IMg.pictureDeriv;
1507          eval(href_path);
1508          // changeImgSrc(imgSrc.replace("./",""), last_id, IMg.pictureMap, options.pictureSelType);
1509        }
1510
1511        theImg.useMap = "#map" + IMg.pictureMap;
1512        return true;
1513
1514
1515        theImg = document.getElementById(theMainImage_id.replace("#", ""));
1516        if (init_img(theImg)) {
1517
1518          return true;
1519        }
1520        return false;
1521
1522      } else {
1523
1524
1525        return false;
1526      }
1527
1528
1529    };  //_______________ Select_Image ______
1530
1531    get_href = function (NewpictureDeriv) {
1532      ref = path_names[0];
1533      for (i = 0; i < path_names.length; i++) {
1534        newHref = path_names[i];
1535        match = ",'" + NewpictureDeriv;
1536        newHref_ind = newHref.indexOf(match);
1537        if (newHref_ind > 0) {
1538          href = newHref;
1539          if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
1540            ref = href.replace("')", "','" + options.pictureSelType + "')");
1541          } else {
1542            ref = href;
1543          }
1544          break;
1545        }
1546
1547      }
1548
1549
1550      return ref;
1551    };
1552
1553    /*************************************************
1554    * correction pamoorama
1555    *************************************************/
1556
1557    Set_Pamoorama = function (Format) {
1558      myPamoorama = window.myPamoorama;
1559      if (Type_Img == "pamoorama") {
1560
1561        if (!nopano) {
1562          theMainImage_Id = "#pamoorama";
1563          nopano = false;
1564          Wait_pamoorama();
1565          infos_theMainImage = jQuery(theMainImage_Id).infos();
1566          //theMainImage_Id = "#pamoorama";
1567        }
1568
1569
1570        if (typeof myPamoorama == "undefined") {
1571          return;
1572        }
1573        //========================================================= 
1574        if (!nopano) {
1575          //theMainImage_Id = "#pamoorama";
1576          nopano = false;
1577          Wait_pamoorama();
1578          infos_theMainImage = jQuery(theMainImage_Id).infos();
1579          //theMainImage_Id = "#pamoorama";
1580        }
1581
1582
1583        infos_pamoorama_outter = jQuery("#pamoorama_outter").infos({ absolute: true });
1584        infos_pamoorama_inner = jQuery("#pamoorama_inner").infos({ absolute: true });
1585        infos_pamoorama_frame = jQuery("#pamoorama_frame").infos({ absolute: true });
1586        infos_frame = jQuery(myPamoorama.frame).infos({ absolute: true });
1587
1588
1589        //====================================================
1590        marges_w = infos_pamoorama.general.marges.width;
1591        marges_h = infos_pamoorama.general.marges.height;
1592
1593        jQuery("#pamoorama_footer").css({
1594          width: Format.width + "px"
1595        });
1596        infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
1597        marges_h += infos_pamoorama_footer.general.height;
1598        outter_height = Format.height;
1599
1600        Zoom_pano = (Format.height - marges_h) / Zone_image.image_init.height;
1601        new_image = { height: Math.ceil(Zone_image.image_init.height * Zoom_pano),
1602          width: Math.ceil(Zone_image.image_init.width * Zoom_pano)
1603        }
1604
1605        jQuery("#pamoorama_inner").css({
1606          width: new_image.width + "px", height: new_image.height + "px", "background-size": "100%"
1607        });
1608        //---------- test largeur image
1609        new_width = Format.width - (options.marge_right + options.marge_left);
1610
1611        if (new_width > new_image.width) {
1612          new_width = new_image.width;
1613          jQuery("#pamoorama_outter").css({
1614
1615            align: "center",
1616            margin: "0"
1617          });
1618        }
1619        outter_width = new_width;
1620
1621        jQuery("#pamoorama_outter").css({
1622          align: 'center',
1623          margin: 'auto',
1624          width: outter_width + "px",
1625          height: Format.height - marges_h + "px"
1626        });
1627        //============= Mise à l'echelle ==================
1628        window.myPamoorama.options.width = Math.ceil(Format.width);
1629        //==================================================================
1630        new_max_left = new_image.width - outter_width;
1631        if (!window.myPamoorama.outter) return;
1632        window.myPamoorama.outter.scrollTo(new_max_left, 0);
1633
1634        if (typeof window.myPamoorama.autoScrollFx != "undefined") window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0);
1635        window.myPamoorama.ratio = Math.ceil(new_image.width / 200);
1636        window.myPamoorama.imageWidth = new_image.width;
1637        window.myPamoorama.imageHeight = new_image.height;
1638        nf = jQuery("#pamoorama_thumb").height();
1639        jQuery("#pamoorama_thumb img").width(180);
1640        jQuery("#pamoorama_thumb img").height(nf);
1641
1642        jQuery("#pamoorama_thumb").css({
1643          /*   position: "absolute", */
1644          left: (Format.width - 215) + "px"
1645
1646        });
1647        jQuery("#pamoorama_thumb img").css({
1648
1649        });
1650        // 200=window.myPamoorama.width
1651        // frame = Zone_image.container.width
1652
1653        nw = (window.myPamoorama.image.width * Format.width) / window.myPamoorama.imageWidth;
1654        jQuery("#pamoorama_frame").width(nw);
1655
1656
1657      } // 
1658    } // Set_Pamoorama
1659
1660    /*********************************************************/
1661
1662    Toggle_bp = function () {
1663      options.cl_visible = !options.cl_visible;
1664      Autosize_resize();
1665      Wait_Affichage();
1666
1667    }
1668
1669    //====================================
1670    //
1671    //====================================
1672    Calcul_Image = function () {
1673
1674      /****************************************/
1675      if (typeof imageInfos_id == "undefined") return;
1676      infos_imageInfos = jQuery(imageInfos_id).infos({ absolute: true });             // information
1677      infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });         // Image   
1678      // commentContent
1679      // copyright
1680
1681      if (options.slideshow) {
1682
1683
1684      } else {
1685
1686      }
1687
1688
1689      pos_top = options.pos_top;
1690      //    pos_top = infos_theImage.top;
1691
1692      pos = jQuery(theImage_id).offset();
1693      infos_theImage = jQuery(theImage_id).infos(true);   // container
1694      infos_window = jQuery(window).infos(true);   // window
1695      w = infos_theImage.general.marges.width
1696
1697      container = {
1698        height: infos_window.height - options.theImageTop,
1699        width: infos_window.width - options.theImageLeft - options.theImageRight
1700      }
1701      marge_left = options.marge_left | 0;
1702      marge_right = options.marge_right | 0;
1703      marge_top = options.marge_top | 0;
1704
1705
1706      //==========================================================
1707      if (test_theme("stripped")) {
1708        infos_the_page.margin.left = 20;  //taille fleche
1709        infos_the_page.margin.right = 20;
1710
1711      } else if (test_theme("kardon")) {
1712
1713      } else if (test_theme("elegant")) {
1714
1715        if (infos_imageInfos.visible == true) {
1716          //  marge_right += infos_imageInfos.general.width; ;
1717
1718        } else {
1719          marge_right += 0;
1720
1721        }
1722        marge_right += 1;
1723        marge_left += 1;
1724
1725      } else if (test_theme("stripped")) {
1726
1727      } else if (test_theme("simple")) {
1728        infos_menubar = jQuery("#menubar").infos({ absolute: true });
1729        infos_imageInfoBar = jQuery("#imageInfoBar").infos({ absolute: true });
1730
1731        jQuery("#theImage").width(infos_imageInfoBar.left - infos_theImage.left - 2);
1732        marge_left += 0;
1733        marge_right += 0;
1734
1735      } else if (test_theme("OS")) {
1736
1737      } else if (test_theme("pur")) {
1738        marge_right += 0;
1739        // marge_right += 25;
1740      } else if (test_theme("mont")) {
1741        marge_right += 0;
1742
1743        // marge_right += 25;
1744
1745
1746      } else {
1747
1748
1749
1750      }
1751
1752
1753      retrait_img = {};
1754      //========== Format Image ============== 
1755      retrait_img.height = Math.ceil(options.marges_llgbo || 0)
1756      + Math.ceil(infos_theMainImage.general.marges.height) +
1757      +Math.ceil(options.marges_llgbo || 0);
1758      retrait_img.height += 2;
1759
1760
1761      //===============================================================
1762      retrait_img.width = Math.ceil(infos_theMainImage.general.marges.width); // borderwidth+padding
1763      retrait_img.width = Math.ceil(infos_theImage.general.marges.width); // borderwidth+padding
1764      retrait_img.width += Math.ceil(options.marges_llgbo || 0);
1765      retrait_img.width += 2;
1766      if (!options.check_desc_v)
1767        options.marge_bottom_2 = 0;
1768
1769
1770      marge_bottom = options.marge_bottom_2 + options.marge_bottom;
1771      //================== Limite Format Image =====================
1772      container.height_interne = container.height - marge_top - marge_bottom;
1773      container.width_interne = container.width - marge_left - marge_right;
1774
1775      container.height_interne = Math.max(container.height_interne, Math.ceil(options.mini_height) + retrait_img.height),
1776      container.width_interne = Math.max(container.width_interne, Math.ceil(options.mini_width) + retrait_img.width)
1777
1778
1779      image_max = {
1780        height: (container.height_interne - retrait_img.height),
1781        width: (container.width_interne - retrait_img.width)
1782      }
1783      //=========================
1784      // test débordement
1785      //=========================
1786      height_theMainImage = Math.ceil(image_max.height);
1787      width_theMainImage = Math.ceil(image_max.width);
1788
1789      if (typeof Zone_image.image_init.rapport == "undefined") {
1790        Zone_image.image_init.rapport = options.ratio;
1791      }
1792      if (Type_Img == "charlie") {
1793        width_theMainImage = height_theMainImage * options.ratio;
1794        Zone_image.image_init.rapport = options.ratio;
1795
1796      } else if (Type_Img == "pamoorama") {
1797        if (height_theMainImage > container.height_interne) {
1798          n = options.pictureSelType;
1799        }
1800      } else {
1801
1802        height_theMainImage = Math.ceil(width_theMainImage / options.ratio);
1803
1804
1805
1806        if (height_theMainImage > container.height_interne) {
1807          image_max.height = container.height_interne;
1808          image_max.width = image_max.height * Zone_image.image_init.rapport;
1809          width_theMainImage = Math.ceil(image_max.width);
1810          height_theMainImage = Math.ceil(image_max.height);
1811        }
1812        if (width_theMainImage > container.width_interne) {
1813          image_max.width = container.width_interne;
1814          image_max.height = image_max.width / Zone_image.image_init.rapport;
1815          width_theMainImage = Math.ceil(image_max.width);
1816          height_theMainImage = Math.ceil(image_max.height);
1817
1818        } else if (width_theMainImage > container.width) {
1819
1820        } else {
1821
1822        }
1823      }
1824      //=================================================================
1825      Zone_image.image = {
1826        width: width_theMainImage,
1827        height: height_theMainImage,
1828        rapport: width_theMainImage / height_theMainImage
1829      };
1830      Zone_image.marges = { width: marge_left + marge_right + retrait_img.width,
1831        height: marge_top + marge_bottom + retrait_img.height
1832      }
1833      Zone_image.src = jQuery(theMainImage_id).attr("src");
1834    }
1835
1836    /*********************************************
1837    * Calcul les dimensions.
1838    *********************************************/
1839    Get_dimensions = function (force, parametres) {
1840      new_img = jQuery(theMainImage_id).infos({ absolute: true });
1841      new_dim = jQuery(theImage_id).infos({ absolute: true });
1842      new_win = jQuery(window).infos({ absolute: true }); // avec ascenseur   
1843      options.theImageTop = new_dim.top;
1844      options.theImageLeft = new_dim.left;
1845      options.theImageRight = (new_win.width - new_dim.right);
1846      options.marge_bottom_2 = Math.ceil(new_dim.out.bottom - new_img.out.bottom);
1847
1848      if (Type_Img == "iframe") { }
1849      new_dim.out.bottom = new_win.height - options.marge_bottom_2;
1850
1851      options.theImageBottom = new_win.height - new_dim.out.bottom;
1852      if (options.slideshow) {
1853        options.marge_top = 0;
1854      } else {
1855        options.marge_top_2 = Math.ceil(new_img.top - new_dim.top) + options.marge_top;
1856      }
1857
1858      if (options.theImageBottom_2 < 0) {
1859        options.theImageBottom_2 = 0;
1860      }
1861
1862      options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight;
1863      options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop;
1864
1865      if (Type_Img != "map" && Type_Img != "iframe")
1866        Select_Image();
1867      infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
1868      Zone_image.src = infos_theMainImage.src;
1869      useMap = options.pictureSelType;
1870      //=================================================================
1871      switch (Type_Img) {
1872        case "map":
1873          if (Set_Map(true)) return false;
1874          break
1875        case "panorama":
1876          if (!theMainImage_id) {
1877
1878          }
1879          infos_theImage = jQuery(theMainImage_id).infos();
1880          infos_the_page = jQuery("#the_page").infos();
1881          if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
1882
1883          img_finale.height = infos_theImage.height;
1884          break
1885        case "img":
1886
1887
1888
1889
1890
1891          break
1892        case "img_autre":
1893          if (!theMainImage_id) {
1894            if (DEBUG_autosize.match("true", "gi")) alert("The_MainImage=null");
1895            return;
1896
1897          }
1898
1899          infos_the_page = jQuery("#the_page").infos();
1900
1901
1902          break
1903        case "embed":
1904          //
1905          if (infos_theMainImage.width == 0)
1906            infos_theMainImage = jQuery("#thePicturePage").infos();
1907          if (infos_theMainImage.width == 0)
1908            infos_theMainImage = jQuery("#the_page").infos();
1909
1910
1911          iph1 = jQuery("#theImage div").infos();
1912
1913          break
1914        case "charlie":
1915
1916          Zone_image.zoom = 1;
1917
1918          break
1919
1920        case "iframe":
1921          wpng = 0;
1922          Zone_image.image.width = options.theImageWidth;
1923          Zone_image.image.height = options.theImageHeight;
1924          Zone_image.zoom = 1;
1925          break
1926        case "pamoorama":
1927          Wait_pamoorama();
1928          break
1929      }
1930
1931
1932
1933      //=================================================
1934      if (Zone_image.image.height < options.mini_height2) {
1935        Zone_image.image.height = parseInt(options.mini_height2);
1936        Zone_image.image.width = Math.ceil(Zone_image.image.height * Zone_image.image_init.rapport);
1937      }
1938      if (Zone_image.image.width < options.mini_width2) {
1939        Zone_image.image.width = parseInt(options.mini_width2);
1940        Zone_image.image.height = Math.ceil(Zone_image.image.width / Zone_image.image_init.rapport);
1941      }
1942      //==================================================
1943      //   ImageWidthidth largeur à atteindre
1944      //   Calcul du rapport d'agrandissement
1945
1946      echelle_max = parseFloat(options.echelle_max, '3');
1947      if (Zone_image.zoom > echelle_max) {
1948        Zone_image.zoom = echelle_max;
1949        Zone_image.image.width = parseInt(Zone_image.image_init.width * Zone_image.zoom);
1950        if (Zone_image.image_init.rapport > 0)
1951          Zone_image.image.height = parseInt(Zone_image.image_init.width / Zone_image.image_init.rapport);
1952      }
1953      if (Type_Img != "pamoorama") {
1954        mxi = Math.ceil(Zone_image.image.height + Zone_image.marges.height);
1955        Zone_image.container.height = Math.max(Zone_image.container.height, mxi);
1956      } else {
1957
1958
1959      }
1960      img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
1961
1962      return true;
1963    }
1964    //________________ Get_dimensions ___________________
1965
1966
1967    /*****************************
1968    *  init_gen
1969    *****************************/
1970    init_gen = function (e) {
1971      theImg = document.getElementById(theMainImage_id.replace("#", ""));
1972      //==================================================
1973      marges_llgbo = 0;
1974      options.marges_llgbo = 0;
1975      if (jQuery(llgbo_id).length > 0) {
1976        infos_llgbo = jQuery(llgbo_id).infos(true);
1977        if (infos_llgbo.visible == true) {
1978          if (infos_llgbo.height > 0) {
1979            infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
1980            infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
1981            //=============================================
1982            ll2 = infos_llgboframe1.width; // llgboframe1
1983            ll1 = infos_llgboframe31.general.width; // llgboframe31
1984            options.marges_llgbo = (ll1 - ll2);
1985            infos_llgboh2 = jQuery("#llgboh2").infos();
1986          }
1987        }
1988
1989        marges_llgbo = options.marges_llgbo;
1990      }
1991
1992      //========= Récupération des informations ============= 
1993
1994      options.marge_top = 0;
1995      pAll = jQuery(llgbo_id).absoluteAll({ absolute: true });
1996      infos_llgbo.top = pAll.Top;
1997      infos_llgbo.bottom = pAll.Bottom;
1998      pAll = jQuery(theMainImage_id).absoluteAll({ absolute: true });
1999      pos_top = pAll.Top; ;
2000      pos_bottom = pAll.Bottom; ;
2001
2002      if (infos_llgbo.top > 0) {
2003        pos_top = infos_llgbo.top;
2004
2005        options.marge_top = infos_theMainImage.top - infos_theImage.top;
2006        options.marge_bottom = Math.ceil(options.marge_basse + options.marge_top);
2007
2008      } else {
2009        pos_top = infos_theImageAndInfos.top;
2010        options.marge_bottom = Math.ceil(options.marge_basse);
2011      }
2012
2013      options.pos_top = pos_top;
2014      options.marge_left = infos_theImage.general.marges.left + Math.ceil(options.marge_gauche);
2015      options.marge_right = infos_theImage.general.marges.right + Math.ceil(options.marge_droite);
2016      options.marge_top += infos_theImage.general.marges.top + infos_content.general.marges.top + Math.ceil(options.marge_haute);
2017
2018      if (options.pictureDeriv == null)
2019        options.first = true;
2020      else
2021        options.first = false;
2022      //=================== Gestion liste photos size ============================
2023      us = 0;
2024      if (!options.theMainImageWidth) options.theMainImageWidth = options.scaledWidth;
2025      if (!options.theMainImageHeight) options.theMainImageHeight = options.scaledHeight;
2026
2027      if (options.first) {
2028        if (options.pictureDeriv) {
2029
2030          pictureSelType = options.pictureSelType;
2031          options.pictureMap = options.pictureDeriv;
2032
2033        } else {
2034          IMg = Get_Maxi(Zone_image.image);
2035          options.pictureDeriv = IMg.pictureDeriv;
2036          imgSrc = IMg.url;
2037          width = IMg.width;
2038          height = IMg.height;
2039          options.pictureDeriv = IMg.pictureDeriv;
2040          options.pictureMap = IMg.pictureMap;
2041        }
2042      }
2043      if (pictureSelType_user != options.pictureSelType) {
2044        /*
2045        user_status = options.user_status;
2046        pictureSelType_user = eval("options." + user_status + "_type"); //limite taille
2047        */
2048        pictureDeriv_user = options.pictureDeriv;
2049        options.pictureDeriv_user = pictureDeriv_user;
2050        pictureSelType = options.pictureSelType;
2051      }
2052      Affiche_limite(pictureSelType_user);
2053
2054      //=================== 2==================================
2055      sav_p = options.pictureSelType;
2056      options.pictureSelType = "SelMaxi";
2057      href_path = get_href(options.pictureDeriv);
2058      spans = jQuery("#derivativeCheckedSelMaxi").next();
2059      spans.attr("href", "javascript:" + href_path);
2060      spans.attr("name", "SelMaxi");
2061      spans = spans.find("span");
2062      spans.attr("name", "SelMaxi");
2063      spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")");
2064      //==========================================================
2065      options.pictureSelType = "Autosize";
2066      href_path = get_href(options.pictureDeriv);
2067      spans = jQuery("#derivativeCheckedAutosize").next();
2068      spans.attr("href", "javascript:" + href_path);
2069      spans.attr("name", "Autosize");
2070      spans = spans.find("span");
2071      spans.attr("name", "Autosize");
2072      spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")");
2073      //==========================================================
2074      options.pictureSelType = sav_p;
2075      jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
2076      if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
2077        //  jQuery('#derivativeChecked' + options.pictureSelType).css('visibility', 'visible');
2078        spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
2079        spans.addClass("linkAutosize");
2080        spans.find("span").addClass("auto_details");
2081      } else {
2082        //  jQuery('#derivativeChecked' + options.pictureDeriv).css('visibility', 'visible');
2083      }
2084      pictureDeriv = options.pictureDeriv;
2085      Autosize_resize(true, options);
2086      Autosize_resize(true, options);
2087      jQuery("#" + Type_Img).show(options.fade_in);
2088    };
2089    //_______________________ init_gen _______________________
2090
2091
2092    /*********************************************
2093    * DEBUG ....
2094    *********************************************/
2095    /*
2096    if (DEBUG_autosize.match("true",gi))   {
2097    for (var i = 0; i < 10; i++) {
2098    jQuery('#adddebugs').click();
2099    }
2100    jQuery(jQuery('.debug').get(i - 1)).click();
2101    }
2102    */
2103
2104    // Custom Event, ON to turn on a debug.
2105    jQuery('.debug').live('ON', function (e) {
2106
2107      nu_img = jQuery(this).text();
2108      jQuery('.debug').trigger('OFF');
2109      jQuery(this).addClass('debugOn');
2110
2111    });
2112
2113    // On Click = debugs On
2114    jQuery('.debug').live('click', function (e) {
2115      i = jQuery(this).text();
2116      jQuery(this).trigger('ON');
2117    });
2118
2119    // Custom Event, Turn off a debug
2120    jQuery('.debug').live('OFF', function (e) {
2121      jQuery(this).removeClass('debugOn');
2122    });
2123
2124    // on Double Click, remove the debug from the DOM
2125    jQuery('.debug').live('dblclick', function () {
2126      jQuery(this).fadeOut(function () { jQuery(this).remove() });
2127    });
2128
2129    // Add another debug to the DOM
2130    jQuery('#adddebugs').click(function () {
2131      i = jQuery('.debug').length;
2132      jQuery('<div>' + i + '</div>')
2133    .addClass('debug')
2134    .appendTo('#debugsContainer');
2135    });
2136
2137
2138
2139    if (DEBUG_autosize.match("mouse", "gi")) {
2140      var mouseLocation = new Point(-500, -500);
2141      function Point(x, y) {
2142        this.x = x; this.y = y;
2143      }
2144      register_position();
2145
2146      function register_position() {
2147        mouse_x = 0;
2148        mouse_y = 0;
2149        //  document.onmousemove = position;
2150
2151      }
2152
2153      function position(evt) {
2154        if (!evt) evt = window.event;
2155        mouseLocation.x = evt.clientX;
2156        mouseLocation.y = evt.clientY;
2157      }
2158
2159      jQuery("div,a,img").mousemove(function (evt) {
2160
2161        if (!evt) evt = window.event;
2162        mouseLocation.x = evt.clientX;
2163        mouseLocation.y = evt.clientY;
2164        Context = jQuery(this).context.nodeName;
2165        obj_id = "#" + this.id.toString();
2166        infos_g = jQuery(obj_id).infos(true);
2167        infos_g.top = jQuery(obj_id).absoluteTop();
2168        wg = jQuery("body").width() - infos_g.right;
2169
2170        affiche_debug({
2171
2172          Debug1: Debug_info(1, "x:" + mouseLocation.x
2173    + " y: " + mouseLocation.y
2174    + " id: " + obj_id
2175    + " top: " + infos_g.top,
2176    +" Node: " + Context
2177    , "->")
2178    ,
2179          Debug2: Debug_info(2, "W:" + infos_g.general.width
2180    + " H: " + infos_g.general.height
2181    + " right: " + (wg)
2182    + " left: " + infos_g.left
2183    + " Node: " + Context
2184    , "->")
2185        });
2186
2187      });
2188
2189    }
2190
2191
2192    //=======================================================================================
2193    Debug_info = function (index, infos, Nom_str) {
2194      if (typeof infos == "undefined") return;
2195      width_g = Math.ceil(jQuery("body").width() / 5) - 10;
2196      if (typeof infos.height != "undefined") {
2197        message = " -- > Info : " + Nom_str + " " + infos.id + "\n" +
2198                         "Info nodeName: " + infos.nodeName + "\n" +
2199                         "Info width: " + infos.width + "\n" +
2200                         "Info height: " + infos.height + "\n" +
2201                         "Info top: " + infos.top + "\n" +
2202                         "Info left: " + infos.left + "\n" +
2203                         "Info position: " + infos.position + "\n";
2204
2205        myDebug = { id: "Debug" + index, texte: message,
2206          css: {
2207            color: "black",
2208            opacity: "1",
2209            position: "absolute",
2210            height: infos.height || pos_top - 30 + "px",
2211            width: infos.width || width_g + "px",
2212            left: infos.left || 0 + "px",
2213            border: "solid 1px green",
2214            top: infos.top + "px"
2215          }
2216        }
2217        return myDebug;
2218
2219      } else {
2220        if (typeof old_messages == "undefined") {
2221          old_messages = new Array();
2222
2223        }
2224        if (infos != "" && infos != "undefined") {
2225          nc0 = old_messages[index] || "";
2226          if (typeof nc0 != "undefined") {
2227            nc0 = nc0.toString().split("<br />");
2228            if (nc0.length > 4) nc0.shift();
2229            old_messages[index] = nc0.join("<br />");
2230          }
2231          old_messages[index] += "" + Nom_str + "->" + infos + "<br />";
2232          message = old_messages[index];
2233          colors = Array('black', 'white', 'white', 'white', 'white', 'white', 'red');
2234          myDebug = { id: "Debug" + index, texte: message,
2235            css: { display: "block",
2236              color: colors[index - 1],
2237              opacity: "1",
2238              position: "absolute",
2239              align: "left",
2240              height: 80 + "px",
2241              width: width_g + "px",
2242              left: ((index - 1) * width_g) + "px",
2243              border: "solid 1px green",
2244              top: 0 + "px"
2245            }
2246          }
2247          return myDebug;
2248        }
2249      }
2250
2251
2252    } //Debug_info
2253    //====================================================
2254    affiche_debug = function (aff_infos) {
2255      jQuery(jQuery("[id ^='Debug']")).each(function (i) {
2256        if (aff_infos[this.id]) {
2257          if (aff_infos[this.id].css) {
2258            jQuery("#" + this.id).css(aff_infos[this.id].css);
2259            jQuery("#" + this.id).html(aff_infos[this.id].texte);
2260          }
2261        }
2262      });
2263      return;
2264    }
2265    //___________ affiche_debug ____
2266    //====================================================
2267    function Debug_pos() {
2268      return;
2269      if (DEBUG_autosize.match("true", gi)) {
2270
2271        jQuery("[id ^='Debug']").show();
2272        /*
2273        Debug2  background-color:yellow
2274        Debug3 background-color:blue
2275        Debug4 background-color:green
2276        Debug5 background-color:red
2277
2278        */
2279
2280        affiche_debug({
2281          Debug5: Debug_info(5, infos_theMainImage, "infos_theMainImage")
2282        });
2283      }
2284    } // Debug_pos
2285    //==========================================================
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295  });                                                                                                                       // ready
2296
2297
2298
2299  jQuery("#derivativeSwitchBox a").click(function (e) {
2300    k1 = 0;
2301  });
Note: See TracBrowser for help on using the repository browser.