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

Last change on this file since 18944 was 18944, checked in by cljosse, 12 years ago

[extensions] Autosize fix compatibility with 2.4 (charlie's,Embedded Videos)

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