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

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

[extensions] Autosize fix compatibility with 2.4 (whith stripped white bloc )

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