// problème avec GMaps+diaporama:
// corriger gmaps_pip.class.inc.php ajouter ligne 90 if ( !isset($_GET['slideshow']))
//==============================================================
jQuery.Affiche_script = { version: '2.0.0' };
/********************************************
* document ready
********************************************/
jQuery(document).ready(function (jQuery) {
var Type_Img;
var theImg;
var Zone_image;
/******************************************
* test_theme("mont,pur") ...
******************************************/
test_theme = function (param) {
if (!param) return
if (!options.theme) return;
regx = new RegExp(param, "gi");
return (options.theme.match(regx))
}
/******************************************
* Save_cookies
******************************************/
Save_cookies = function (parametres) {
parametres.windowHeight = jQuery(window).height();
parametres.windowWidth = jQuery(window).width();
try {
if (parametres.pictureSelType) jQuery.cookie('picture_sel_type', parametres.pictureSelType, { path: COOKIE_PATH });
if (parametres.pictureDeriv) jQuery.cookie('picture_deriv', parametres.pictureDeriv, { path: COOKIE_PATH });
if (parametres.pictureMap) jQuery.cookie('picture_map', parametres.pictureMap, { path: COOKIE_PATH });
if (parametres.imgSrc) jQuery.cookie('img_src', parametres.imgSrc, { path: COOKIE_PATH });
if (parametres.theMainImageHeight) jQuery.cookie('theMainImageHeight', parametres.theMainImageHeight, { path: COOKIE_PATH });
if (parametres.theMainImageWidth) jQuery.cookie('theMainImageWidth', parametres.theMainImageWidth, { path: COOKIE_PATH });
if (parametres.theImageHeight) jQuery.cookie('theImageHeight', parametres.theImageHeight, { path: COOKIE_PATH });
if (parametres.theImageWidth) jQuery.cookie('theImageWidth', parametres.theImageWidth, { path: COOKIE_PATH });
if (parametres.windowHeight) jQuery.cookie('windowHeight', parametres.windowHeight, { path: COOKIE_PATH });
if (parametres.windowWidth) jQuery.cookie('windowWidth', parametres.windowWidth, { path: COOKIE_PATH });
if (parametres.theImageTop) jQuery.cookie('theImageTop', parametres.theImageTop, { path: COOKIE_PATH });
if (parametres.theImageLeft) jQuery.cookie('theImageLeft', parametres.theImageLeft, { path: COOKIE_PATH });
if (parametres.theImageRight) jQuery.cookie('theImageRight', parametres.theImageRight, { path: COOKIE_PATH });
if (parametres.theImageBottom) jQuery.cookie('theImageBottom', parametres.theImageBottom, { path: COOKIE_PATH });
if (parametres.theImageMargeZone) {
jQuery.cookie('theImageMargeWidth', parametres.theImageMargeZone.width, { path: COOKIE_PATH });
jQuery.cookie('theImageMargeHeight', parametres.theImageMargeZone.height, { path: COOKIE_PATH });
}
} catch (e) {
}
}
//____________________ Save_cookies _____________________________
/************************************************
* Get COOKIE
*************************************************/
Get_cookies = function () {
parametres = {
pictureDeriv: jQuery.cookie('picture_deriv'),
pictureMap: jQuery.cookie('picture_map'),
imgSrc: jQuery.cookie('img_src'),
pictureSelType: jQuery.cookie('picture_sel_type'),
theMainImageHeight: jQuery.cookie('theMainImageHeight'),
theMainImageWidth: jQuery.cookie('theMainImageWidth'),
windowHeight: jQuery.cookie('windowHeight'),
windowWidth: jQuery.cookie('windowWidth'),
theImageHeight: jQuery.cookie('theImageHeight'),
theImageWidth: jQuery.cookie('theImageWidth'),
theImageTop: jQuery.cookie('theImageTop'),
theImageLeft: jQuery.cookie('theImageLeft'),
theImageBottom: jQuery.cookie('theImageBottom'),
theImageRight: jQuery.cookie('theImageRight'),
theImageMargeZone: { width: jQuery.cookie('theImageMargeWidth'),
height: jQuery.cookie('theImageMargeHeight')
}
}
return parametres;
}
//____________________ Get_cookies _____________________________
/*************************************************
* Recupère le Type d'mage
*************************************************/
Get_type_img = function (e) {
//====== détection du type d'images ======
if (jQuery("#charlie").length > 0) {
Type_Img = "charlie";
} else if (jQuery("#Panorama").length > 0) {
Type_Img = "panorama";
} else if (jQuery("#pamoorama").length > 0) {
Type_Img = "pamoorama";
options.valide = true;
infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true });
} else if (jQuery("#map").length > 0 || jQuery("#mapPicture").length > 0) {
Type_Img = "map";
} else if (jQuery("#Panorama").length) {
Type_Img = "panorama";
} else if ((jQuery("#theImage" + " iframe").length + jQuery("#theImage" + " object").length + jQuery("#theImage" + " embed").length) > 0) {
if (jQuery("#theImage" + " object").length > 0) {
type_src = "object";
} else if (jQuery("#theImage" + " embed").length > 0) {
type_src = "embed";
} else {
type_src = "iframe";
}
nbf = jQuery("#theImage" + " " + type_src).length;
frm1 = jQuery("#theImage" + " " + type_src).get(0);
Type_Img = "iframe";
//'fb - xfbml - like - button
objs = jQuery("#theImage" + " div").get(0);
if (jQuery(objs).length > 0) {
id_0 = jQuery(objs).attr("id");
if (id_0 == "") {
jQuery(objs).attr("id", "charlie");
} else {
if (nbf > 1) {
jQuery(frm1).attr("id", "charlie");
} else {
Type_Img = "img";
}
}
} else {
jQuery(frm1).attr("id", "iframe");
}
} else if (jQuery("#theImage").find("img").length > 0) {
Type_Img = "img";
} else if (jQuery("#theImage" + "Box").find("img").length > 0) {
Type_Img = "img";
Parent = Parent + "Box";
} else if (jQuery("img").length > 0) {
Type_Img = "img_autre";
return;
} else {
return;
}
}
//____________________ Get_type_img _____________________________
//====================================
// set_cl
//====================================
set_cl = function (Valid) {
if (typeof Valid == "undefined") Valid = options.pictureSelType.match(RegExp("Autosize", "gi")) || false;
if (typeof options.cl_visible == "undefined") return;
if (typeof src1 == "undefined") return;
if (options.cl_visible) src = src1;
else src = src2;
if (typeof options.pictureSelType != "undefined" && (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi")) {
if (options.pictureSelType == "SelMaxi") src = src6;
} else {
Valid = false;
src = src2;
jQuery("#bp_cla span").text("");
}
if (options.cl_visible) {
src_info = src3;
src_infos_1 = src3;
} else {
src_info = src4;
src_infos_1 = src5;
}
src_info = options.pictureDeriv;
if (!Valid) {
Zone_image.image.height = Zone_image.image_init.height;
Zone_image.image.width = Zone_image.image_init.width;
}
if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined") {
Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
zoom_cl = parseInt(100 * Zone_image.zoom) + "%"; ;
if (!Valid) {
if (options.pictureSelType == "SelMaxi")
zoom_cl = options.pictureSelType + " [" + options.pictureDeriv + "]";
else {
zoom_cl = "";
src_info = options.pictureDeriv;
}
}
jQuery('#bp_cla').attr('alt', src_info);
jQuery('#bp_cla').attr('title', src_info);
jQuery('#bp_cla').attr('Stitle', src_info);
jQuery('#bp_cla').attr('Stip', zoom_cl);
r = { width: jQuery("#theMainImage").width(), height: jQuery("#theMainImage").height(),
rap: jQuery("#theMainImage").width() / jQuery("#theMainImage").height(),
rap_init: Zone_image.image_init.rapport
}
jQuery('#bp_cla span').text(zoom_cl);
color_back = jQuery('#imageToolBar').css("backgroundColor");
try {
if (color_back.match(new RegExp("rgb", "gi"))) {
color_back = color_back.split("(")[1].split(")")[0].split(",");
color_back = "rgb(" + Math.abs(255 - color_back[0]) + ","
+ Math.abs(255 - color_back[1]) + ","
+ Math.abs(255 - color_back[2]) + ")";
}
else if (color_back.match(new RegExp("#", "gi")))
color_back = Math.abs("#65536" - color_back);
else
color_back = jQuery('body').css("color");
jQuery('#bp_cla span').css({ color: color_back, aling: "center" });
} catch (e) {
}
if (options.pictureDeriv) {
jQuery('.auto_details').text(" (" + Zone_image.image.width + " x " + Zone_image.image.height + ") " + options.pictureDeriv);
}
//===============================================
} else {
src = src6;
jQuery('.auto_details').text("");
}
bp_scr = jQuery('#bp_img_cla');
if (bp_scr.length > 0) {
src_enc = bp_scr.attr("src");
if (!src_enc.match(src)) {
bp_scr.get(0).src = src;
jQuery('#bp_img_cla').attr('alt', src_info);
jQuery('#bp_img_cla').attr('title', src_info);
}
}
}
//____________________ set_cl _____________________________
/********************************
* Set__llbgo
*********************************/
Set_llbgo = function (Force) {
if (options.marges_llgbo == 0) return;
if (Type_Img == "pamoorama") {
}
if (Force)
if (typeof LlgboFr_Resize == "function") {
LlgboFr_Resize();
}
if (Type_Img == "pamoorama" || Type_Img == "charlie") {
return;
}
if (!theImg) return;
if (theImg.useMap)
nom_map = theImg.useMap.replace("#", "");
else
nom_map = "Autosize";
maps = jQuery("map[name='" + nom_map + "']");
if (maps.length == 0) return;
// nom_map = maps[0].name;
maps = jQuery("map[name='" + nom_map + "'] area");
nb_zone = maps.length;
Largeur_zone = (Zone_image.image.width / nb_zone);
Hauteur_zone = (Zone_image.image.height);
init_zone = 0;
j = 0;
maps.each(function (e) {
init_zone = Largeur_zone * j;
rel = jQuery(this).attr("rel");
title = jQuery(this).attr("title");
alt = jQuery(this).attr("alt");
H = Hauteur_zone;
if (rel == "up") {
H = Hauteur_zone / 4;
}
coord = { x0: init_zone, y0: 0, x1: Math.ceil(init_zone + Largeur_zone), y1: Hauteur_zone };
jQuery(this).attr({ coords: "'" + coord.x0 + "," + coord.y0 + "," + coord.x1 + "," + coord.y1 + "'" });
j++;
});
return;
}
//__________ Set_llbgo _______________
/********************************************
* window LOAD
********************************************/
jQuery(window).load(function () {
href = location.href;
var aff_ok = false;
//=======================================================================
infos_theImage = jQuery(theImage_id).infos({ absolute: true });
infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general
if (infos_theMainImage.width == 0) {
if (Type_Img == "charlie") {
infos_theMainImage = jQuery("#charlie").infos(true);
theMainImage_id = "charlie";
options.valide = true;
} else if (Type_Img == "iframe") {
infos_theMainImage = jQuery("#iframe").infos(true);
theMainImage_id = "iframe";
options.valide = true;
infos_theMainImage.width = infos_theImage.general.width;
infos_theMainImage.height = infos_window.height - infos_theImage.top - options.marge_basse;
jQuery("#iframe").width(infos_theMainImage.width);
jQuery("#iframe").height(infos_theMainImage.height);
} else if (Type_Img == "pamoorama") {
infos_theMainImage = jQuery("#pamoorama").infos(true);
theMainImage_id = "#pamoorama";
options.valide = true;
} else {
jQuery("img").each(function (i) {
imgSrc = options.imgSrc;
});
infos_theMainImage = jQuery("#theImage img").infos();
}
if (infos_theMainImage.id == "")
jQuery("#theImage img").attr("id", "theMainImage");
infos_theMainImage = jQuery(theMainImage_id).infos();
}
infos_theImage = jQuery(theImage_id).infos(true); // conteneur
if (test_theme("simple")) {
jQuery(theMainImage_id).css({ maxWidth: "none" });
theImageAndInfos_id = "#content";
infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general
infos_theImage.height = infos_window.height - infos_theImage.top;
// jQuery(theImage_id).height(infos_theImage.height);
} else {
infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general
if (infos_theImageAndInfos.visible == false)
theImageAndInfos_id = "#imageContainer";
}
imageInfos_id = "#imageInfos";
content_id = "#content";
infos_content = jQuery(content_id).infos(true); // conteneur
infos_theImage = jQuery(theImage_id).infos(true); // conteneur
infos_imageInfos = jQuery(imageInfos_id).infos(true); // information
infos_theMainImage = jQuery(theMainImage_id).infos(true); // Image
infos_copyright = jQuery("#copyright").infos(true);
if (infos_theImage.top > infos_window.height) {
zheight = infos_window.height - infos_content.top;
} else {
zheight = infos_window.height - (infos_theImage.top);
}
if (options.check_desc_v) { }
infos_comments = jQuery("#comments").infos(true);
infos_Licence = jQuery(".licencetag").infos(true);
infos_imageComment = jQuery(imageComment_id).infos(true);
if (test_theme("simple")) {
} else {
if (test_theme("stripped")) {
} else
if (test_theme("blanc , pure, hr_ ")) {
options.marge_gauche += 10;
options.marge_droite += 10;
}
}
Zone_image = { image_init: {
width: infos_theMainImage.width,
height: infos_theMainImage.height,
rapport: infos_theMainImage.width / infos_theMainImage.height
},
image: {
width: infos_theImage.general.width,
height: infos_window.height - infos_theImage.top - options.marge_basse,
rapport: infos_theMainImage.width / infos_theMainImage.height
},
container: {
width: infos_theImage.general.width,
height: zheight,
margesWidth: infos_window.width - infos_theImage.width
}, marges: {
height: 0,
width: 0
}
}
Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
/***********************************************************
* RESIZE (une fois document chargé)
***********************************************************/
var new_dim;
jQuery(window).resize(function (event, ui) {
Autosize_resize(true, options);
return;
});
//_____________ widow.resize _______________
type_src = "div";
old_window = { width: 0, height: 0 };
List_autosize = new Array();
nu_img = 0;
tempo = 0;
infos_llgbo = jQuery(llgbo_id).infos(true);
infos_llgboh2 = jQuery("#llgboh2").infos(true);
marges_llgbo = 0;
//==========================================================================================
if (options.valide) {
init_gen();
}
});
//__________________window.onload_________________
/********************************************
* window unLOAD
********************************************/
jQuery(window).unload(function () {
// return;
});
//_________ unload ___________
//===================
// VARIABLES
//===================
// options
//===================
//=========================================================
/*messages = "This frame uses the W3C box model: " + jQuery.support.boxModel + "";
messages += "This frame uses the html5Clone: " + jQuery.support.html5Clone + "";*/
// jQuery("p").html(messages);
if (typeof (options) == "undefined") {
options = { imageAutosize: false }
}
options = jQuery.extend(Autosize_options, options);
var COOKIE_PATH = options.COOKIE_PATH;
var cookies = Get_cookies();
var defaults = {
imageAutosizeMargin: 0,
imageAutosize: false,
marge_basse: options.imageAutosizeMargin || 0,
DEBUG_autosize: false
};
options = jQuery.extend(defaults, options);
for (i = 0; i < options.liste_type.length; i++) {
options.liste_type[i] = options.liste_type[i].split(",");
}
options.theMainImageWidth = options.theMainImageWidth;
options.theMainImageHeight = options.theMainImageHeight;
jQuery("#form_autosize_picture").addClass("Autosize");
//===== marges suplémentaires en fonction theme ===
options.valide = jQuery(".Autosize").css("display") != "none";
options.marge_haute = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("top"));
options.marge_basse = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("bottom"));
options.marge_gauche = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("left"));
options.marge_droite = jQuery(".Autosize").Get_Val_int(jQuery(".Autosize").css("right"));
fade_in = options.fade_in || 0;
imageComment_id = ".imageComment";
if (test_theme("simple")) {
jQuery("#theImage p").addClass("imageComment");
}
if (test_theme("mont")) {
jQuery("#content").css({ marginLeft: 'auto' }); //monblanc
}
DEBUG_autosize = options.DEBUG_autosize;
Get_type_img();
var theMainImage_id = "#theMainImage";
var theImage_id = "#theImage";
var theImageAndInfos_id = "#theImageAndInfos";
var infos_window = jQuery(window).infos();
var infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general
var infos_content;
var infos_body;
var infos_the_page = jQuery("#the_page").infos(true);
var nopano;
var llgbo_id = "#llgbo0";
var marges_llgbo = 0;
var useMap = options.pictureMap; // #mapxxx
var user_status = options.user_status;
var pictureDeriv = options.pictureDeriv; // xxx
var pictureSelType_user = eval("options." + user_status + "_type"); //limite taille
if (Type_Img == "pamoorama")
options.pictureSelType = "Autosize";
if (pictureSelType_user != options.pictureSelType) {
if (pictureDeriv == null)
pictureDeriv = pictureDeriv_user;
else
pictureDeriv_user = pictureDeriv;
}
if (!options.valide) {
pictureDeriv = "medium";
pictureDeriv_user = pictureDeriv;
options.pictureDeriv = pictureDeriv;
}
//=============================================================
// REPONSE ACTION
//=============================================================
theMainImage_st = false;
jQuery("#reset").click(function () {
location.reload();
});
//===========================================================
// REPONSE TRIGGER
//===========================================================
jQuery('#ret_autosize').live('ON', function (e) {
if (nu_img == "") nu_img = 8;
jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
});
//==========================================================
jQuery("map area").mouseover(function (e) {
try {
nok = theImg.useMap;
hok = this;
}
catch (r) {
}
});
//==================================
// jQuery("#llgbo").trigger("ON");
//==================================
jQuery(llgbo_id).live('ON', function (e) {
n_id = this;
infos_llgbo = jQuery(llgbo_id).infos();
if (infos_llgbo.visible == false) return;
marges_llgbo = 0;
if (infos_llgbo.height > 0) {
infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
infos_llgboframe31 = jQuery(llgbo_id + " div:first").infos();
//=============================================
ll2 = infos_llgboframe1.width; // llgboframe1 interieur
ll1 = infos_llgboframe31.exterieur.width; // llgboframe31 avec border width
options.marges_llgbo = (ll1 - ll2);
infos_llgboh2 = jQuery("#llgboh2").infos();
}
});
//==============================
// jQuery("#mapPicture").trigger("ON");
//==============================
jQuery("#mapPicture").live('ON', function (e) {
p2 = jQuery("#infoSwitcher").infos();
});
//==============================
// jQuery("#map").trigger("ON");
//==============================
jQuery("#map").live('ON', function (e) {
p2 = jQuery("#map").infos();
});
//===================================
// jQuery("#theImage").trigger("ON");
//===================================
jQuery("#imageInfos").live('on', function (e) {
target = e.target.id;
});
//===================================
// jQuery("#theImage").trigger("ON");
//===================================
jQuery("#theImage").live('ON', function (e) {
target = e.target.id;
id = this.id;
Select_Image(); //+calcul
});
//=================================================================
jQuery(document).live('gallyInterfaceReady', function (e) {
i = jQuery(this).text();
jQuery(this).trigger('ON');
}
);
/*********************************
*
********************************/
var old_width;
jQuery("#theImage").resize(function (e) {
});
jQuery("#menuSwitcher,#infoSwitcher").click(function (e) {
options.set_sw = this.id;
setTimeout(function () { div_resize() }, 10);
nu_img = 0;
});
div_resize = function (i) {
jQuery("#theImage").trigger("resize");
/*
if (jQuery("#theImage").width() != old_width) {
setTimeout(function () { div_resize() }, 10);
}
*/
}
//===========================================
// jQuery("#theImageAndInfos").trigger("ON");
//===========================================
jQuery("#theImageAndInfos").live('ON', function (e) {
infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
// setTimeout(function () { Autosize_resize(true) }, 100);
nu_img = 0;
}); // fin click #theImageAndInfos ON
jQuery("#theImageAndInfos").resize(function (e) {
});
jQuery("#linkAutosize").click(function (e) {
nu_img = 0;
});
//==================================
//
//===================================
jQuery('#derivativeCheckedAutosize').click(function () {
try {
pathnames = jQuery(this).attr("href").split(":");
// eval(pathnames[1]);
} catch (e) {
n = false;
}
}); // fin click derivativeCheckedAutosize
//====================================================
if (typeof decode_href != 'function') {
function decode_href(myObj) {
href_path = jQuery(myObj).attr("href");
pt = href_path.split("(");
pt = pt[1].split(")");
pt = pt[0].replace(RegExp("'", "g"), "");
pt = pt.replace(RegExp(" ", "g"), "");
pt = pt.split(",");
source = pt[0];
pictureDeriv = pt[1];
pictureMap = pt[2];
if (pt.length > 3)
pictureSelType = pt[3];
else
pictureSelType = pt[1];
return { source: source,
pictureDeriv: pictureDeriv,
pictureMap: pictureMap,
pictureSelType: pictureSelType
}
}
}
jQuery("#derivativeSwitchBox a").click(function (e) {
retour = decode_href(this);
theImg = document.getElementById(theMainImage_id.replace("#", ""));
if (theImg) {
// options.pictureDeriv = retour.pictureDeriv;
options.pictureSelType = retour.pictureSelType;
options.pictureDeriv = retour.pictureDeriv;
options.pictureMap = retour.pictureDeriv;
if (this.name) {
options.pictureSelType = this.name;
n = Get_dimensions(true, options);
} else {
}
jQuery("#derivativeSwitchBox span").removeClass("auto_details linkAutosize");
jQuery("#derivativeSwitchBox a").removeClass("auto_details linkAutosize");
if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
spans.addClass("linkAutosize");
spans.find("span").addClass("auto_details");
jQuery(".auto_details").text("");
}
Autosize_resize(true, options);
}
});
//__________ fin click #derivativeSwitchBox a ____________
jQuery("input").click(function () {
if (this.name.match(RegExp("_enabled", "gi"))) {
sel = "[name*=" + this.name + "]";
obj = jQuery("tr" + sel);
if (this.checked)
obj.css({ backgroundColor: "green", color: "white" });
else
obj.css({ backgroundColor: "red", color: "white" });
return;
}
return;
});
//====================================
Autosize_init = function (name, value) {
img_defaut = { height: options.scaled_height, width: options.scaled_width };
img_reelle = { height: options.theImageHeight, width: options.theImageWidth };
img_init = { height: options.theImageHeight, width: options.theImageWidth }; // taille initiale
img_finale = img_init;
useMap = infos_theMainImage.useMap; // #mapmedium
useMap = options.pictureMap; // #mapxxx
pictureDeriv = options.pictureDeriv; //picturederiv xxx
old_img = options.imgSrc;
old_window_height = options.windowHeight || jQuery(window).height();
old_window_width = options.windowWidth || jQuery(window).width();
old_img_h = options.imgHeight;
old_img_w = options.imgWidth;
if (infos_theMainImage.visible == true) {
theImg = document.getElementById(theMainImage_id.replace("#", ""));
theImg.useMap = useMap;
}
fade_in = parseInt(options.fade_in || 0);
}
//____________________ Autosize_init _____________________
/***************************
* Autosize_resize
***************************/
Autosize_resize = function (force, parametres) {
n = Get_dimensions(true, options);
if (n == false) return;
Save_cookies(options);
if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
/**/
jQuery(theImg).width(Zone_image.image_init.width);
jQuery(theImg).height(Zone_image.image_init.height);
set_cl("no");
Set_llbgo(true);
return;
}
infos_theImage = jQuery(theImage_id).infos(true);
if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
if (img_finale.width && (img_finale.width != Zone_image.image.width || img_finale.height != Zone_image.image.height)) {
img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
}
r1 = Zone_image.image.width / Zone_image.image.height;
//======================================================
affiche_debug({
Debug1: Debug_info(1, "Cont:" + infos_theImage.width
+ " X " + infos_theImage.height
+ " IMG: " + img_finale.width
+ " X " + img_finale.height
+ " mgw : " + Zone_image.marges.width
, "->")
});
if (Type_Img == "pamoorama") {// img_finale.width
jQuery("#pamoorama").width(img_finale.width);
jQuery("#pamoorama").height(img_finale.height);
infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true });
Set_Pamoorama({ width: img_finale.width, height: img_finale.height });
if (nopano)
if (window.myPamoorama.options.autoscrollOnLoad) {
window.myPamoorama.startAnimRight();
}
//jQuery(theMainImage_id).height(Zone_image.image.height);
} else {
if (options.imageAutosize == false)
if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
jQuery(theMainImage_id).height(Zone_image.image.height);
jQuery(theMainImage_id).width(Zone_image.image.width);
} else {
jQuery(theMainImage_id).width(Zone_image.image_init.width);
jQuery(theMainImage_id).height(Zone_image.image_init.height);
}
if (Type_Img == "charlie" || Type_Img == "iframe") {
swfobj = jQuery("#" + Type_Img).infos({ absolute: true });
// jQuery("#" + Type_Img).attr({ height: Zone_image.image.height, width: Zone_image.image.width - 50 });
// jQuery(theMainImage_obj).attr({ height: Zone_image.image.height, width: Zone_image.image.width - 50 });
// jQuery(theMainImage_emb).attr({ height: Zone_image.image.height, width: Zone_image.image.width });
}
}
set_cl();
Set_llbgo(true);
return true;
};
//_________________Autosize ____________________________________
/*****************
* changeImgSrc
******************/
changeImgSrc = function (url, typeSave, typeMap, type) {
if (url) {
if (url.match(RegExp("i.php", "gi"))) {
urls = url.split("?");
}
}
url2 = jQuery("#theMainImage").attr("src");
if (typeof type != "undefined")
options.pictureSelType = type;
else {
options.pictureSelType = typeSave;
type = typeSave;
}
options.pictureDeriv = typeSave;
typeMap = typeSave;
jQuery('#derivativeSwitchBox .switchCheck').css('visibility', 'hidden');
if (typeof type != "undefined" && (type == "Autosize" || type == "SelMaxi")) {
jQuery('#derivativeChecked' + type).css('visibility', 'visible');
document.cookie = 'picture_sel_type=' + type + ';path=' + COOKIE_PATH;
} else {
jQuery('#derivativeChecked' + typeSave).css('visibility', 'visible');
document.cookie = 'picture_sel_type=' + typeSave + ';path=' + COOKIE_PATH;
}
options.pictureMap = typeMap;
options.pictureDeriv = typeSave;
document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH;
jQuery("#theMainImage").removeAttr("width height").attr("src", url)
.load(function (i) {
if (!init_img(this)) {
return;
}
//=======================================================================
})
.live("ON", function (e) {
theMainImage_st = this.complete;
imgsrc = this.src;
// alert(this.src + ' Image does not exist !!');
}).error(function (i) {
imgsrc = this.src;
});
/***********************
*
**********************/
jQuery("#theMainImage," + theMainImage_id + ",.preload, .next1 , ")
.error(function (e) {
if (!this.complete) {
// le fichier n'est pas present
src = jQuery(this).attr("src").replace("./_data/i/", "", 1);
src = this.src.split("/_data/i")[1];
url = 'i.php?' + src + "&ajaxload=true";
jQuery(theMainImage_id).attr("src", url);
/*
jQuery.ajax({
type: 'GET',
url: 'i.php?' + src + "&ajaxload=true",
dataType: 'json',
success: (function (data) {
j = data.url;
// jQuery(theMainImage_id).attr("src", data.url);
})
});
*/
}
})
.bind("Finish", function (e, data) {
if (typeof imageInfos_id == "undefined") return;
})
.bind("ON", function (e, data) {
if (data.status != "ok") {
popup = jQuery(".errors");
if (popup.length == 0) {
jQuery("#theImage").append("
");
}
jQuery(".errors").text("Erreur : [" + data.done + "] " + data.responseText);
jQuery(".errors").show().delay(10000).hide(2000);
return;
}
if (data.src) {
if (typeof imageInfos_id == "undefined") return;
if (options.pictureDeriv == "Original" && data.src.match(RegExp("\-.." + ".jpg", "gi"))) {
Autosize_resize(true, options);
} else if (data.src.match(RegExp(options.pictureDeriv.substr(0, 2) + ".jpg", "gi"))) {
Autosize_resize(true, options);
} else {
}
}
});
//_________ theMainImage ___________
document.cookie = 'picture_deriv=' + typeSave + ';path=' + COOKIE_PATH;
}
//__________________ changeImgSrc ______________________
/*****************************
* pamoorama
******************************/
jQuery("#pamoorama").bind("on", function () { alert($(this).text()); });
jQuery("#pamoorama").bind("on", function (e) {
myPamoorama = window.myPamoorama;
});
jQuery("#pamoorama_inner").live("on", function (e) {
myPamoorama = window.myPamoorama;
});
jQuery('#pamoorama').live('ON', function (e) {
jQuery(jQuery('.debug').get(1)).trigger('ON');
Autosize_resize(true, options);
});
//===============================================
// jQuery("#theImage").trigger("Start_right");
//===============================================
jQuery("#theImage").live('Start_right', function (e) {
if (typeof Zone_image == "undefined") return
test_w = window.myPamoorama.autoSlideFx.to;
test_w = window.myPamoorama.autoScrollFx.to;
nf = jQuery("#pamoorama_thumb").height();
jQuery("#pamoorama_thumb img").width(200);
jQuery("#pamoorama_thumb img").height(nf);
// 200=window.myPamoorama.imageWidth
// frame = Zone_image.container.width
nw = (200 * Zone_image.image.width) / window.myPamoorama.imageWidth;
jQuery("#pamoorama_frame").width(nw);
});
//===============================================
// jQuery("#theImage").trigger("Start_left");
//===============================================
jQuery("#theImage").live('Start_left', function (e) {
if (typeof Zone_image == "undefined") return
jQuery("#theImage").show(0);
window.myPamoorama.autoSlideFx.to = 0;
test_w = window.myPamoorama.autoSlideFx.to;
test_w = window.myPamoorama.autoScrollFx.to;
nf = jQuery("#pamoorama_thumb").height();
jQuery("#pamoorama_thumb img").width(200);
jQuery("#pamoorama_thumb img").height(nf);
});
/************************************
* Wait_pamoorama
************************************/
Wait_pamoorama = function () {
if (Type_Img != "pamoorama") return;
tempo = 0;
Wait_pamoorama_st = false;
while (Wait_pamoorama_st == false) {
Wait_pamoorama_st = Wait_pamoorama_time();
jQuery.noop();
}
tempo = 0;
if (nopano) {
if (window.myPamoorama.options.autoscrollOnLoad) {
window.myPamoorama.startAnimRight();
jQuery.delay(100);
}
}
}
//__________________ Wait_pamoorama ______________________
jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) {
}).mouseover(function (i) {
})
Wait_pamoorama_time = function () {
if (nopano == true) return true;
if (jQuery("#pamoorama").length) {
tempo = tempo + 1;
mypanorama = window.myPamoorama;
if (!mypanorama) {
if (tempo > 500) return true;
setTimeout("Wait_pamoorama_time()", 500);
return false;
}
if (mypanorama.skipInit == false) {
if (tempo > 500) return true;
setTimeout("Wait_pamoorama_time()", 500);
return false;
}
//=============================================================
if (Math.abs(mypanorama.imageHeight) < 100) {
setTimeout("Wait_pamoorama_time()", 500);
return false;
}
if (jQuery(".infos").length > 0) {
jQuery(".infos").empty();
jQuery(".infos").hide();
}
nopano = true;
Zone_image = { image_init: { width: mypanorama.imageWidth,
height: mypanorama.imageHeight
}
}
jQuery("#pamoorama").trigger("ON");
return true;
}
}
//__________________ Wait_pamoorama time______________________
/**********************
*
***********************/
Wait_Affichage = function () {
Wait_Affichage_st = false;
while (Wait_Affichage_st == false) {
jQuery.noop();
Wait_Affichage_st = Wait_Affichage_time();
}
}
//__________________ Wait_Affichage ______________________
Wait_Affichage_time = function () {
if (typeof fade_in == "undefined") fade_in = 1000;
fade_in = parseInt(fade_in);
/*
if (!Autosize_resize()) {
setTimeout("Wait_Affichage()", 500);
return
}
nu_img++;
*/
if (typeof fade_in == "undefined") fade_in = 0;
// if (nu_img > 1) return;
if (typeof stb != "undefined")
stb.stop().fadeTo(3500, 0);
if (typeof theMainImage_id == "undefined") return true;
if (theMainImage_id.selector) {
theMainImage_id = theMainImage_id.selector;
}
if (theMainImage_id == null) return;
if (jQuery(theMainImage_id).length == 0) {
if (jQuery("#pamoorama_inner").length > 0) {
return true;
}
//=== attente Image chargée ===
if (tempo > 100) return true;
tempo++;
setTimeout("Wait_Affichage_time()", 500);
return false;
} else {
img_h = jQuery(theMainImage_id).height();
img_w = jQuery(theMainImage_id).width();
if (typeof infos_theImage == "undefined") return;
jQuery("#ret_autosize").trigger('ON', {
width: img_w,
height: img_h,
theImage: theMainImage_id,
img_src: infos_theMainImage.src,
window_height: infos_theImage.height,
window_width: infos_theImage.width
});
}
return true;
}
//______________ Wait_affichage ______
/***********************
*
**********************/
init_img = function (theImg) {
if (theImg.complete == false) {
return;
}
name_src = theImg.src;
img_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() }
if (typeof theImg.naturalWidth != "undefined")
img_init.width = theImg.naturalWidth;
if (typeof theImg.naturalHeight != "undefined")
img_init.height = theImg.naturalHeight;
img_init.rapport = img_init.width / img_init.height;
if (typeof Zone_image == "undefined") Zone_image = { image: {} };
if (typeof Zone_image.image == "undefined") Zone_image.image = { height: Zone_image.image_init.height, width: Zone_image.image_init.width };
// theImg.height = img_init.height;
// theImg.width = img_init.width;
Zone_image.image_init = { height: img_init.height, width: img_init.width, rapport: img_init.rapport };
Zone_image.zoom = Zone_image.image_init.height / img_init.height;
if (typeof Zone_image.src == "undefined") {
Zone_image.src = name_src;
return false;
}
stx = name_src.match(RegExp(Zone_image.src, "gi"));
return stx;
}
//___________ init_img _______
//===========================================
//
//===========================================
Set_Map = function (nds) {
p0 = jQuery("#map").offset();
if (!p0) return;
infos_mapPicture = jQuery("#mapPicture").infos({ absolute: true });
infos_theImage = jQuery("#theImage").infos({ absolute: true });
jQuery("#map").removeAttr("height");
jQuery("#map").removeAttr("width");
jQuery("#map").width(infos_theImage.width - (infos_mapPicture.width));
jQuery("#map").height(jQuery(window).height() - infos_theImage.top - infos_theImage.general.marges.height);
return true;
}
jQuery("map [name='#Autosize'] area").mouseover(function (e) {
return;
});
//___ Set_Map ___
//=====================================
//
//=====================================
Get_Maxi = function (Maxi_image) {
var pt = options.liste_type;
if (pt.length > 0) {
tw = Maxi_image.width; // valeur maxi
th = Maxi_image.height; // valeur maxi
n = 0;
maxi_size = { w: Maxi_image.width, h: Maxi_image.height, idx: -1 };
mini_size = { w: tw, h: th, idx: 0 };
size_derive = { w: 0, h: 0 };
size_encours = { w: tw, h: th };
//=================================
jQuery(pt).each(function (i) {
vn = this;
size_derive = { w: parseInt(vn[2]), h: parseInt(vn[3]) };
if (vn[0] == options.pictureSelType || vn[0] == "Original" ) {
maxi_size = size_derive;
maxi_size.idx = n;
return false
}
if (vn[0] != "square" && vn[0] != "thumb" && vn[0] != "SelMaxi" && vn[0] != "Autosize") {
if (size_derive.h > size_encours.h) {
if (maxi_size.idx < 0) {
maxi_size = size_derive;
maxi_size.idx = n;
if (options.pictureSelType == "SelMaxi" || options.pictureSelType == "Autosize")
return false
}
}
if (size_derive.h < size_encours.h && size_derive.h > 10) {
mini_size = size_derive;
mini_size.idx = n;
}
}
n++;
});
n = maxi_size.idx;
if (n < 0) {
n = mini_size.idx;
}
if (options.pictureSelType.match(RegExp("SelMaxi", "gi"))) {
n = mini_size.idx;
}
if (options.pictureSelType.match(RegExp("Autosize", "gi"))) {
}
pictureDeriv = pt[n][0];
last_id = pt[n][0];
jQuery(".switchCheck").each(function (i) {
if (!this.id.match(RegExp("Original", "gi"))) {
if (this.id.match(RegExp("SelMaxi", "gi"))) return false;
last_id = this.id.replace("derivativeChecked", "");
}
if (last_id.match(RegExp(pictureDeriv, "gi"))) return false;
});
options.pictureDeriv = last_id;
return { url: pt[n][1], pictureDeriv: last_id, pictureMap: last_id, width: pt[n][2], height: pt[n][3] };
}
return { imgSrc: "", pictureDeriv: "", width: "", height: "" };
}
//_______________ Get_Maxi ______
/********************
*
********************/
Select_Image = function () {
var pt = options.liste_type;
if (pt.length > 0) {
//===== calcul Image ===
if (typeof imageInfos_id == "undefined") return;
Calcul_Image();
options.theImageMargeZone = Zone_image.marges;
if (Type_Img != 'charlie') {
/*
if (options.pictureSelType != "SelMaxi" && options.pictureSelType != "Autosize") {
options.pictureMap = options.pictureDeriv;
imgSrc = options.liste_type[6];
changeImgSrc(imgSrc, options.pictureDeriv, options.pictureMap, options.pictureSelType);
src = theImg.src;
return;
} else {
IMg = Get_Maxi(Zone_image.image);
}
*/
IMg = Get_Maxi(Zone_image.image);
imgSrc = IMg.url;
if (options.imgSrc.match(RegExp(imgSrc, "gi")))
options.imgSrc = imgSrc;
img_width = IMg.width;
img_height = IMg.height;
Zone_image.image_init = { height: IMg.height,
width: IMg.width,
rapport: IMg.width / IMg.height
};
if (typeof Zone_image.image == "undefined")
Zone_image.image = { height: IMg.height,
width: IMg.width,
rapport: IMg.width / IMg.height
};
} else {
return;
}
Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height;
if (typeof Zone_image.src == "undefined") Zone_image.src = " ";
identique = Zone_image.src.match(RegExp(imgSrc, "gi"));
if (identique) return;
href_path = "javascript:changeImgSrc('" + imgSrc + IMg.pictureDeriv + "', '"+ "', '" + IMg.pictureMap + "', '" + options.pictureSelType + "')";
jQuery(".linkAutosize").attr("href", href_path);
theImg = document.getElementById(theMainImage_id.replace("#", ""));
if ((theImg == null) || theImg.tagName != "IMG") {
imgSrc_i = jQuery(theImg).css("backgroundImage");
imgSrc_j = jQuery(theImg).css("background-image");
return;
} else {
last_id = IMg.pictureDeriv;
changeImgSrc(imgSrc, last_id, IMg.pictureMap, options.pictureSelType);
}
theImg.useMap = "#map" + IMg.pictureMap;
return true;
theImg = document.getElementById(theMainImage_id.replace("#", ""));
if (init_img(theImg)) {
return true;
}
return false;
} else {
return false;
}
}; //_______________ Select_Image ______
/*************************************************
* correction pamoorama
*************************************************/
Set_Pamoorama = function (Format) {
myPamoorama = window.myPamoorama;
if (Type_Img == "pamoorama") {
if (!nopano) {
theMainImage_Id = "#pamoorama";
nopano = false;
Wait_pamoorama();
infos_theMainImage = jQuery(theMainImage_Id).infos();
//theMainImage_Id = "#pamoorama";
}
if (typeof myPamoorama == "undefined") {
return;
}
//=========================================================
if (!nopano) {
//theMainImage_Id = "#pamoorama";
nopano = false;
Wait_pamoorama();
infos_theMainImage = jQuery(theMainImage_Id).infos();
//theMainImage_Id = "#pamoorama";
}
infos_pamoorama_outter = jQuery("#pamoorama_outter").infos({ absolute: true });
infos_pamoorama_inner = jQuery("#pamoorama_inner").infos({ absolute: true });
infos_pamoorama_frame = jQuery("#pamoorama_frame").infos({ absolute: true });
infos_frame = jQuery(myPamoorama.frame).infos({ absolute: true });
//====================================================
marges_w = infos_pamoorama.general.marges.width;
marges_h = infos_pamoorama.general.marges.height;
jQuery("#pamoorama_footer").css({
width: Format.width + "px"
});
infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
marges_h += infos_pamoorama_footer.general.height;
outter_height = Format.height;
Zoom_pano = (Format.height - marges_h) / Zone_image.image_init.height;
new_image = { height: Math.ceil(Zone_image.image_init.height * Zoom_pano),
width: Math.ceil(Zone_image.image_init.width * Zoom_pano)
}
jQuery("#pamoorama_inner").css({
width: new_image.width + "px", height: new_image.height + "px", "background-size": "100%"
});
//---------- test largeur image
new_width = Format.width - (options.marge_right + options.marge_left);
if (new_width > new_image.width) {
new_width = new_image.width;
jQuery("#pamoorama_outter").css({
align: "center",
margin: "0"
});
}
outter_width = new_width;
jQuery("#pamoorama_outter").css({
align: 'center',
margin: 'auto',
width: outter_width + "px",
height: Format.height - marges_h + "px"
});
//============= Mise à l'echelle ==================
window.myPamoorama.options.width = Math.ceil(Format.width);
//==================================================================
new_max_left = new_image.width - outter_width;
if (!window.myPamoorama.outter) return;
window.myPamoorama.outter.scrollTo(new_max_left, 0);
if (typeof window.myPamoorama.autoScrollFx != "undefined") window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0);
window.myPamoorama.ratio = Math.ceil(new_image.width / 200);
window.myPamoorama.imageWidth = new_image.width;
window.myPamoorama.imageHeight = new_image.height;
nf = jQuery("#pamoorama_thumb").height();
jQuery("#pamoorama_thumb img").width(180);
jQuery("#pamoorama_thumb img").height(nf);
jQuery("#pamoorama_thumb").css({
/* position: "absolute", */
left: (Format.width - 215) + "px"
});
jQuery("#pamoorama_thumb img").css({
});
// 200=window.myPamoorama.width
// frame = Zone_image.container.width
nw = (window.myPamoorama.image.width * Format.width) / window.myPamoorama.imageWidth;
jQuery("#pamoorama_frame").width(nw);
} //
} // Set_Pamoorama
/*********************************************************/
Toggle_bp = function () {
options.cl_visible = !options.cl_visible;
Autosize_resize();
Wait_Affichage();
}
//====================================
//
//====================================
Calcul_Image = function () {
/****************************************/
if (typeof imageInfos_id == "undefined") return;
infos_imageInfos = jQuery(imageInfos_id).infos({ absolute: true }); // information
infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true }); // Image
// commentContent
// copyright
pos_top = options.pos_top;
// pos_top = infos_theImage.top;
pos = jQuery(theImage_id).offset();
infos_theImage = jQuery(theImage_id).infos(true); // container
infos_window = jQuery(window).infos(true); // window
w = infos_theImage.general.marges.width
container = {
height: infos_window.height - options.theImageTop,
width: infos_window.width - options.theImageLeft - options.theImageRight
}
marge_left = options.marge_left | 0;
marge_right = options.marge_right | 0;
marge_top = options.marge_top | 0;
marge_bottom = options.marge_bottom | 0;
//==========================================================
if (test_theme("stripped")) {
infos_the_page.margin.left = 20; //taille fleche
infos_the_page.margin.right = 20;
}
if (test_theme("elegant")) {
if (infos_imageInfos.visible == true) {
// marge_right += infos_imageInfos.general.width; ;
} else {
marge_right += 0;
}
marge_right += 1;
marge_left += 1;
} else if (test_theme("stripped")) {
} else if (test_theme("simple")) {
} else if (test_theme("OS")) {
} else if (test_theme("pur")) {
marge_right += 0;
// marge_right += 25;
} else if (test_theme("mont")) {
marge_right += 0;
// marge_right += 25;
} else {
}
retrait_img = {};
//========== Format Image ==============
retrait_img.height = Math.ceil(options.marges_llgbo || 0)
+ Math.ceil(infos_theMainImage.general.marges.height);
retrait_img.height += 2;
//===============================================================
retrait_img.width = Math.ceil(infos_theMainImage.general.marges.width); // borderwidth+padding
retrait_img.width = Math.ceil(infos_theImage.general.marges.width); // borderwidth+padding
retrait_img.width += Math.ceil(options.marges_llgbo || 0);
retrait_img.width += 2;
if (!options.check_desc_v)
marge_bottom = 0;
//================== Limite Format Image =====================
container.height_interne = container.height - marge_top - marge_bottom;
container.width_interne = container.width - marge_left - marge_right;
container.height_interne = Math.max(container.height_interne, Math.ceil(options.mini_height) + retrait_img.height),
container.width_interne = Math.max(container.width_interne, Math.ceil(options.mini_width) + retrait_img.width)
image_max = {
height: (container.height_interne - retrait_img.height),
width: (container.width_interne - retrait_img.width)
}
//=========================
// test débordement
//=========================
height_theMainImage = Math.ceil(image_max.height);
width_theMainImage = Math.ceil(image_max.width);
if (typeof Zone_image.image_init.rapport == "undefined") {
Zone_image.image_init.rapport = options.ratio;
}
if (Type_Img == "charlie") {
} else if (Type_Img == "pamoorama") {
if (height_theMainImage > container.height_interne) {
n = options.pictureSelType;
}
} else {
height_theMainImage = Math.ceil(width_theMainImage / options.ratio);
if (height_theMainImage > container.height_interne) {
image_max.height = container.height_interne;
image_max.width = image_max.height * Zone_image.image_init.rapport;
width_theMainImage = Math.ceil(image_max.width);
height_theMainImage = Math.ceil(image_max.height);
}
if (width_theMainImage > container.width_interne) {
image_max.width = container.width_interne;
image_max.height = image_max.width / Zone_image.image_init.rapport;
width_theMainImage = Math.ceil(image_max.width);
height_theMainImage = Math.ceil(image_max.height);
} else if (width_theMainImage > container.width) {
} else {
}
}
//=================================================================
Zone_image.image = {
width: width_theMainImage,
height: height_theMainImage,
rapport: width_theMainImage / height_theMainImage
};
Zone_image.marges = { width: marge_left + marge_right + retrait_img.width,
height: marge_top + marge_bottom + retrait_img.height
}
Zone_image.src = jQuery(theMainImage_id).attr("src");
}
/*********************************************
* Calcul les dimensions.
*********************************************/
Get_dimensions = function (force, parametres) {
new_img = jQuery(theMainImage_id).infos({ absolute: true });
new_dim = jQuery(theImage_id).infos({ absolute: true });
new_win = jQuery(window).infos({ absolute: true }); // avec ascenseur
options.theImageTop = new_dim.top;
options.theImageLeft = new_dim.left;
options.theImageRight = (new_win.width - new_dim.right);
options.theImageBottom = new_win.height - new_dim.out.bottom;
options.marge_top = Math.ceil(new_img.top - new_dim.top);
options.marge_bottom = Math.ceil(new_dim.out.bottom - new_img.out.bottom);
if (options.theImageBottom < 0) {
options.theImageBottom = 0;
}
options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight;
options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop;
var chk = eval("options." + user_status + "_enabled");
if (chk == "") { return; }
if (Type_Img != "map")
Select_Image();
infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
Zone_image.src = infos_theMainImage.src;
useMap = options.pictureSelType;
/*
if (useMap) {
if (!useMap.match(RegExp("Autosize", "gi"))) {
if (typeof img_height != "undefined") {
jQuery(theImg).height(img_height);
jQuery(theImg).width(img_width);
}
return;
}
}
if (options.imageAutosize) {
return true; //stripped
}
if (typeof options.cl_visible == "undefined") return;
if (!options.cl_visible == true) { return; }
*/
//=================================================================
switch (Type_Img) {
case "map":
if (Set_Map(true)) return false;
break
case "panorama":
if (!theMainImage_id) {
}
infos_theImage = jQuery(theMainImage_id).infos();
infos_the_page = jQuery("#the_page").infos();
img_finale.height = infos_theImage.height;
break
case "img":
break
case "img_autre":
if (!theMainImage_id) {
if (DEBUG_autosize.match("true", gi)) alert("The_MainImage=null");
return;
}
infos_the_page = jQuery("#the_page").infos();
break
case "embed":
//
if (infos_theMainImage.width == 0)
infos_theMainImage = jQuery("#thePicturePage").infos();
if (infos_theMainImage.width == 0)
infos_theMainImage = jQuery("#the_page").infos();
iph1 = jQuery("#theImage div").infos();
break
case "charlie":
break
case "iframe":
Zone_image.image.width = options.theImageWidth;
Zone_image.image.height = options.theImageHeight;
break
case "pamoorama":
Wait_pamoorama();
break
}
//=================================================
if (Zone_image.image.height < options.mini_height2) {
Zone_image.image.height = parseInt(options.mini_height2);
Zone_image.image.width = Math.ceil(Zone_image.image.height * Zone_image.image_init.rapport);
}
if (Zone_image.image.width < options.mini_width2) {
Zone_image.image.width = parseInt(options.mini_width2);
Zone_image.image.height = Math.ceil(Zone_image.image.width / Zone_image.image_init.rapport);
}
//==================================================
// ImageWidthidth largeur à atteindre
// Calcul du rapport d'agrandissement
echelle_max = parseFloat(options.echelle_max, '3');
if (Zone_image.zoom > echelle_max) {
Zone_image.zoom = echelle_max;
Zone_image.image.width = parseInt(Zone_image.image_init.width * Zone_image.zoom);
if (Zone_image.image_init.rapport > 0)
Zone_image.image.height = parseInt(Zone_image.image_init.width / Zone_image.image_init.rapport);
}
if (Type_Img != "pamoorama") {
mxi = Math.ceil(Zone_image.image.height + Zone_image.marges.height);
Zone_image.container.height = Math.max(Zone_image.container.height, mxi);
}
img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
return true;
}
//________________ Get_dimensions ___________________
/*****************************
* init_gen
*****************************/
init_gen = function (e) {
theImg = document.getElementById(theMainImage_id.replace("#", ""));
//==================================================
marges_llgbo = 0;
options.marges_llgbo = 0;
if (jQuery(llgbo_id).length > 0) {
infos_llgbo = jQuery(llgbo_id).infos(true);
if (infos_llgbo.visible == true) {
if (infos_llgbo.height > 0) {
infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
infos_llgboframe31 = jQuery(llgbo_id + " div:first").infos();
//=============================================
ll2 = infos_llgboframe1.width; // llgboframe1
ll1 = infos_llgboframe31.general.width; // llgboframe31
options.marges_llgbo = (ll1 - ll2);
infos_llgboh2 = jQuery("#llgboh2").infos();
}
}
marges_llgbo = options.marges_llgbo;
}
//========= Récupération des informations =============
options.marge_top = 0;
pAll = jQuery(llgbo_id).absoluteAll({ absolute: true });
infos_llgbo.top = pAll.Top;
infos_llgbo.bottom = pAll.Bottom;
pAll = jQuery(theMainImage_id).absoluteAll({ absolute: true });
pos_top = pAll.Top; ;
pos_bottom = pAll.Bottom; ;
if (infos_llgbo.top > 0) {
pos_top = infos_llgbo.top;
options.marge_top = infos_theMainImage.top - infos_theImage.top;
} else
pos_top = infos_theImageAndInfos.top;
options.pos_top = pos_top;
options.marge_left = infos_theImage.general.marges.left + Math.ceil(options.marge_gauche);
options.marge_right = infos_theImage.general.marges.right + Math.ceil(options.marge_droite);
options.marge_top += infos_theImage.general.marges.top + infos_content.general.marges.top + Math.ceil(options.marge_haute);
options.marge_bottom = Math.ceil(options.marge_basse); // +infos_content.general.marges.bottom; ;
if (options.pictureDeriv == null)
options.first = true;
else
options.first = false;
//=================== Gestion liste photos size ============================
us = 0;
if (!options.theMainImageWidth) options.theMainImageWidth = options.scaledWidth;
if (!options.theMainImageHeight) options.theMainImageHeight = options.scaledHeight;
if (options.first) {
if (options.pictureDeriv) {
pictureSelType = options.pictureSelType;
options.pictureMap = options.pictureDeriv;
} else {
IMg = Get_Maxi(Zone_image.image);
options.pictureDeriv = IMg.pictureDeriv;
imgSrc = IMg.url;
width = IMg.width;
height = IMg.height;
options.pictureDeriv = IMg.pictureDeriv;
options.pictureMap = IMg.pictureMap;
}
}
if (pictureSelType_user != options.pictureSelType) {
/*
user_status = options.user_status;
pictureSelType_user = eval("options." + user_status + "_type"); //limite taille
*/
pictureDeriv_user = options.pictureDeriv;
options.pictureDeriv_user = pictureDeriv_user;
pictureSelType = options.pictureSelType;
}
//=================== 2==================================
href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "SelMaxi" + "')";
spans = jQuery("#derivativeCheckedSelMaxi").next();
spans.attr("href", href_path);
spans.attr("name", "SelMaxi");
spans = spans.find("span");
spans.attr("name", "SelMaxi");
spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")");
//==========================================================
href_path = "javascript:changeImgSrc('" + options.imgSrc + "', '" + options.pictureDeriv + "', '" + options.pictureDeriv + "', '" + "Autosize" + "')";
spans = jQuery("#derivativeCheckedAutosize").next();
spans.attr("href", href_path);
spans.attr("name", "Autosize");
spans = spans.find("span");
spans.attr("name", "Autosize");
spans.text("(" + options.theMainImageWidth + " x " + options.theMainImageHeight + ")");
//==========================================================
if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
spans.addClass("linkAutosize");
spans.find("span").addClass("auto_details");
}
pictureDeriv = options.pictureDeriv;
Autosize_resize(true, options);
Autosize_resize(true, options);
};
//_______________________ init_gen _______________________
/*********************************************
* DEBUG ....
*********************************************/
/*
if (DEBUG_autosize.match("true",gi)) {
for (var i = 0; i < 10; i++) {
jQuery('#adddebugs').click();
}
jQuery(jQuery('.debug').get(i - 1)).click();
}
*/
// Custom Event, ON to turn on a debug.
jQuery('.debug').live('ON', function (e) {
nu_img = jQuery(this).text();
jQuery('.debug').trigger('OFF');
jQuery(this).addClass('debugOn');
});
// On Click = debugs On
jQuery('.debug').live('click', function (e) {
i = jQuery(this).text();
jQuery(this).trigger('ON');
});
// Custom Event, Turn off a debug
jQuery('.debug').live('OFF', function (e) {
jQuery(this).removeClass('debugOn');
});
// on Double Click, remove the debug from the DOM
jQuery('.debug').live('dblclick', function () {
jQuery(this).fadeOut(function () { jQuery(this).remove() });
});
// Add another debug to the DOM
jQuery('#adddebugs').click(function () {
i = jQuery('.debug').length;
jQuery('' + i + '
')
.addClass('debug')
.appendTo('#debugsContainer');
});
if (DEBUG_autosize.match("mouse", "gi")) {
var mouseLocation = new Point(-500, -500);
function Point(x, y) {
this.x = x; this.y = y;
}
register_position();
function register_position() {
mouse_x = 0;
mouse_y = 0;
// document.onmousemove = position;
}
function position(evt) {
if (!evt) evt = window.event;
mouseLocation.x = evt.clientX;
mouseLocation.y = evt.clientY;
}
jQuery("div,a,img").mousemove(function (evt) {
if (!evt) evt = window.event;
mouseLocation.x = evt.clientX;
mouseLocation.y = evt.clientY;
Context = jQuery(this).context.nodeName;
obj_id = "#" + this.id.toString();
infos_g = jQuery(obj_id).infos(true);
infos_g.top = jQuery(obj_id).absoluteTop();
wg = jQuery("body").width() - infos_g.right;
affiche_debug({
Debug1: Debug_info(1, "x:" + mouseLocation.x
+ " y: " + mouseLocation.y
+ " id: " + obj_id
+ " top: " + infos_g.top,
+" Node: " + Context
, "->")
,
Debug2: Debug_info(2, "W:" + infos_g.general.width
+ " H: " + infos_g.general.height
+ " right: " + (wg)
+ " left: " + infos_g.left
+ " Node: " + Context
, "->")
});
});
}
//=======================================================================================
Debug_info = function (index, infos, Nom_str) {
if (typeof infos == "undefined") return;
width_g = Math.ceil(jQuery("body").width() / 5) - 10;
if (typeof infos.height != "undefined") {
message = " -- > Info : " + Nom_str + " " + infos.id + "\n" +
"Info nodeName: " + infos.nodeName + "\n" +
"Info width: " + infos.width + "\n" +
"Info height: " + infos.height + "\n" +
"Info top: " + infos.top + "\n" +
"Info left: " + infos.left + "\n" +
"Info position: " + infos.position + "\n";
myDebug = { id: "Debug" + index, texte: message,
css: {
color: "black",
opacity: "1",
position: "absolute",
height: infos.height || pos_top - 30 + "px",
width: infos.width || width_g + "px",
left: infos.left || 0 + "px",
border: "solid 1px green",
top: infos.top + "px"
}
}
return myDebug;
} else {
if (typeof old_messages == "undefined") {
old_messages = new Array();
}
if (infos != "" && infos != "undefined") {
nc0 = old_messages[index] || "";
if (typeof nc0 != "undefined") {
nc0 = nc0.toString().split("
");
if (nc0.length > 4) nc0.shift();
old_messages[index] = nc0.join("
");
}
old_messages[index] += "" + Nom_str + "->" + infos + "
";
message = old_messages[index];
colors = Array('black', 'white', 'white', 'white', 'white', 'white', 'red');
myDebug = { id: "Debug" + index, texte: message,
css: { display: "block",
color: colors[index - 1],
opacity: "1",
position: "absolute",
align: "left",
height: 80 + "px",
width: width_g + "px",
left: ((index - 1) * width_g) + "px",
border: "solid 1px green",
top: 0 + "px"
}
}
return myDebug;
}
}
} //Debug_info
//====================================================
affiche_debug = function (aff_infos) {
jQuery(jQuery("[id ^='Debug']")).each(function (i) {
if (aff_infos[this.id]) {
if (aff_infos[this.id].css) {
jQuery("#" + this.id).css(aff_infos[this.id].css);
jQuery("#" + this.id).html(aff_infos[this.id].texte);
}
}
});
return;
}
//___________ affiche_debug ____
//====================================================
function Debug_pos() {
return;
if (DEBUG_autosize.match("true", gi)) {
jQuery("[id ^='Debug']").show();
/*
Debug2 background-color:yellow
Debug3 background-color:blue
Debug4 background-color:green
Debug5 background-color:red
*/
affiche_debug({
Debug5: Debug_info(5, infos_theMainImage, "infos_theMainImage")
});
}
} // Debug_pos
//==========================================================
}); // ready
jQuery("#derivativeSwitchBox a").click(function (e) {
k1 = 0;
});