var showtabs; var selectedTab; var interfaceTimerDelay; var isScrollable; var zoomMode; jQuery("document").ready(function(jQuery) { zoomMode=options.defaultZoomSize; // display alt from PWG stuffs actions var stuffs_actions=jQuery(".categoryActions",".stuffs_block .stuffs"); if (stuffs_actions.length != 0) { stuffs_actions.each(function(index) { var images=jQuery(this).find("img"); if (images.length !=0) { images.each(function(index) { var alt_text = (jQuery(this).attr("alt")); jQuery(this).before(alt_text); jQuery(this).parents("li").css("width","auto"); jQuery(this).remove(); }); } }); } // gmaps icon var icon_gmaps=jQuery("#icon_gmaps"); var text_gmaps=jQuery("#text_gmaps"); if ((icon_gmaps.length == 1) && (text_gmaps.length ==1)) { icon_gmaps.text(text_gmaps.text()); icon_gmaps.css("text-align","right"); icon_gmaps.wrapAll('
  • '); } // Tabs var tab_loaded=0; var delay=400; var hfirst; if (jQuery.browser.msie) {hfirst=false;} else {hfirst=true;} var tab_titles=jQuery(".tabTitle"); var tab_blocks=jQuery(".tabBlock"); var tab_name; var tab_start = null; if (options.defaultTab) { if (options.defaultTab != "none") tab_start = options.defaultTab; if (options.defaultTab == "last") tab_start = jQuery.cookie("tabactive"); } if ((tab_titles.length != 0) && (tab_titles.length == tab_blocks.length)) { if (tab_start != null) { tab_blocks.each(function(index) { jQuery(this).css("display","none"); }); tab_loaded=1; jQuery("#tabs").css("height","auto"); tab_titles.each(function(index1) { tab_name = jQuery(this).attr("name"); if (tab_name == tab_start) { jQuery(this).addClass("tabSelected"); jQuery.cookie("tabactive",jQuery(this).attr("name")); var old_selected_tab =-1; tab_blocks.each(function(index2) { if (index1 == index2) { jQuery(this).show(); } }); } }); } tab_titles.each(function(index1) { var tab_title = jQuery(this); tab_title.click(function () { if (tab_loaded==0) { tab_blocks.each(function(index) { jQuery(this).css("display","none"); }); tab_loaded=1; jQuery("#tabs").css("height","auto"); } if (jQuery(this).hasClass("tabSelected")) { var tab_title = jQuery(this); tab_blocks.each(function(index2) { if ((index1 == index2) && (options.animatedTabs)) { jQuery(this).slideUp(delay, function() {tab_title.removeClass("tabSelected");}); } else { jQuery(this).hide(); } }); jQuery.cookie("tabactive",null); } else { jQuery(this).addClass("tabSelected"); jQuery.cookie("tabactive",jQuery(this).attr("name")); var old_selected_tab =-1; tab_titles.each(function(index2) { if ((index1 != index2) && (jQuery(this).hasClass("tabSelected"))) { old_selected_tab=index2; jQuery(this).removeClass("tabSelected"); } }); tab_blocks.each(function(index2) { if (index1 == index2) { if ((old_selected_tab == -1) && (options.animatedTabs)) { jQuery(this).slideDown(delay); } else { jQuery(this).show(); } } }); tab_blocks.each(function(index2) { if (index2 != index1) { jQuery(this).hide(); } }); } }); }); } Init_nav_thumbs(); // Image autosize function inspired from Autosize Plugin (from cljosse) var img_W0=0; var img_H0=0; var img_ratio=0; if (options.imageAutosize) { // Autosize image jQuery(window).resize(function () { var marge_inf_sup = options.imageAutosizeMargin; var Hmin = options.imageAutosizeMinHeight; var ImageContainer; if (options.imageAutosizeTitle) { ImageContainer = jQuery("#theImageAndTitle"); } else { ImageContainer = jQuery("#theImage"); } var Image = jQuery("img","#theImg"); var TitleBox=jQuery("#imageTitleContainer"); if (Image.length != 1) { if (TitleBox.length !=0) TitleBox.css("width","97%"); return; } var marge_inf = ImageContainer.height()-Image.height()+marge_inf_sup; var pos0 = jQuery(Image).offset(); if (!pos0) return; var img_top = Math.round(parseFloat(pos0.top)); var win_height = jQuery(window).height(); var img_H = win_height - img_top - marge_inf; var max_H = img_H; if (img_W0==0){ img_W0=Image.width(); img_H0=Image.height(); img_ratio=img_W0/img_H0; } if (img_W0 == 0) return; if (img_H >= img_H0) img_H=img_H0; if (img_H <= Hmin) img_H=Hmin; var img_W = Math.round(parseFloat(img_H * img_ratio)); var max_W = jQuery("#content").width() - Image.outerWidth() + Image.width(); if (img_W > max_W) { var img_H = Math.round(parseFloat(max_W / img_ratio)); if (img_H <= Hmin) { img_H = Hmin; img_W = Math.round(parseFloat(img_H * img_ratio)); } else { img_W = max_W; } } Image.css("width", img_W + "px"); Image.css("height", img_H+ "px"); jQuery.cookie("stripped_max_width",max_W); jQuery.cookie("stripped_max_height",max_H); // limit img title Container width if (TitleBox.length != 0) { TitleBox.css("min-width",jQuery("#theImg").outerWidth()+"px"); } Calc_nav_thumbs_pos(); return; }); jQuery(window).resize(); } else { var TitleBox=jQuery("#imageTitleContainer"); if (TitleBox.length !=0) TitleBox.css("width","97%"); jQuery(window).resize(function () { Calc_nav_thumbs_pos(); return; }); } Calc_nav_thumbs_pos() }); function Init_nav_thumbs() { var tfade=options.navThumbsFade; var PrevBoxOut = jQuery("#linkPrevOut"); if (PrevBoxOut.length !=0) { var PrevBoxIn=jQuery("#linkPrevIn"); var PrevImgBox=jQuery("#linkPrevIn > .navThumb"); var PrevImg=jQuery("#linkPrevIn > .navThumb > img"); if ((jQuery("#mapPicture").length==0) && (jQuery("#Panorama").length==0) && (jQuery("#pamoorama").length==0)){ PrevBoxIn.mouseenter(function(){PrevImg.stop(true, false).animate({opacity:1},tfade);}); PrevBoxOut.mouseleave(function(){PrevImg.stop(true, false).animate({opacity:0},tfade);}); } else { PrevBoxOut.css("display","none"); } } var NextBoxOut = jQuery("#linkNextOut"); if (NextBoxOut.length !=0) { var NextBoxIn=jQuery("#linkNextIn"); var NextImgBox=jQuery("#linkNextIn > .navThumb"); var NextImg=jQuery("#linkNextIn > .navThumb > img"); if ((jQuery("#mapPicture").length==0) && (jQuery("#Panorama").length==0) && (jQuery("#pamoorama").length==0)){ NextBoxIn.mouseenter(function(){NextImg.stop(true, false).animate({opacity:1},tfade);}); NextBoxOut.mouseleave(function(){NextImg.stop(true, false).animate({opacity:0},tfade);}); } else { NextBoxOut.css("display","none"); } } } function Calc_nav_thumbs_pos() { var Window = jQuery(window); var Content = jQuery("#content"); var ImageBox = jQuery("#theImg"); var PrevImg=jQuery("#linkPrevIn > .navThumb > img"); var window_width = Window.width(); var content_width = Content.width(); var image_width = ImageBox.width(); var PrevBoxOut = jQuery("#linkPrevOut"); if (PrevBoxOut.length !=0) { if (PrevBoxOut.css("display") != "none") { var PrevBoxIn=jQuery("#linkPrevIn"); var PrevImgBox=jQuery("#linkPrevIn > .navThumb"); var PrevImg=jQuery("#linkPrevIn > .navThumb > img"); // height var imgHeight = ImageBox.height()||0; PrevBoxOut.css("height",imgHeight+"px"); var prevImgTopMargin = parseInt( (imgHeight - PrevImgBox.outerHeight()) / 2 ); PrevImgBox.css("margin-top",prevImgTopMargin+"px"); // position var prevbox_pos1= parseInt( ( content_width - image_width + PrevImg.outerWidth()) / 2 ) + 120; var prevbox_pos0= prevbox_pos1 - PrevBoxOut.width(); var left_margin = parseInt( ( window_width - content_width ) / 2 ); if (prevbox_pos0 + left_margin < 0 ) { prevbox_pos0 = - left_margin prevbox_pos1 = prevbox_pos0 + PrevBoxOut.width(); } var prevbox_width = prevbox_pos1 - prevbox_pos0; PrevBoxOut.css("left",prevbox_pos0+"px"); PrevBoxOut.css("width",prevbox_width+"px"); } } var NextBoxOut = jQuery("#linkNextOut"); if (NextBoxOut.length !=0) { if (NextBoxOut.css("display") != "none") { var NextBoxIn=jQuery("#linkNextIn"); var NextImgBox=jQuery("#linkNextIn > .navThumb"); var NextImg=jQuery("#linkNextIn > .navThumb > img"); // height var imgHeight = ImageBox.height()||0; NextBoxOut.css("height",imgHeight+"px"); var nextImgTopMargin = parseInt( (imgHeight - NextImg.outerHeight()) / 2 ); NextImgBox.css("margin-top",nextImgTopMargin+"px"); // position var nextbox_pos1= parseInt( ( content_width - image_width + NextImg.outerWidth()) / 2 ) + 120; var nextbox_pos0= nextbox_pos1 - NextBoxOut.width(); var right_margin = parseInt( ( window_width - content_width ) / 2 ); if (nextbox_pos0 + right_margin < 0 ) { nextbox_pos0 = - right_margin nextbox_pos1 = nextbox_pos0 + NextBoxOut.width(); } var nextbox_width = nextbox_pos1 - nextbox_pos0; NextBoxOut.css("right",nextbox_pos0+"px"); NextBoxOut.css("width",nextbox_width+"px"); } } } // Scripts taken from Gally Theme function openDisplayHigh(url) { jQuery('#theImageHigh').css( { width:jQuery("html").get(0).scrollWidth+"px", height:jQuery("html").get(0).scrollHeight+"px", display:"block" } ); if(jQuery("#theImgHigh").attr('src')=="") { p = new Object(); p.left = ((jQuery(window).width()-jQuery("#theImgHighContainer").attr("clientWidth")-options.paddingContainer*2)/2)+"px"; p.top = ((jQuery(window).height()-jQuery("#theImgHighContainer").attr("clientHeight")-options.paddingContainer*2)/2)+"px"; jQuery('#theImgHighContainer') .css( { left:p.left, top:p.top, padding:options.paddingContainer+"px" } ); jQuery("#theImgHigh") .load( function () { jQuery(document).data("highWidth", jQuery("#theImgHigh").width()); jQuery(document).data("highHeight", jQuery("#theImgHigh").height()); p=calcImgHighPositionAndSize(zoomMode); jQuery('#theImgHighContainer').css("background-image", "none") displayZoomHigh(); jQuery("#theImgHigh").css( {display:"block"} ); } ) .attr('src', url); if(options.highResClickMode=='close') { jQuery("#theImgHigh").bind('click', closeDisplayHigh); } else { // switch zoom jQuery("#theImgHigh").bind('click', switchZoomHigh); } } else { p=calcImgHighPositionAndSize(zoomMode); jQuery('#theImgHighContainer') .css( { left:p.left+"px", top:p.top+"px", width:p.width+"px", height:p.height+"px" } ); } } function calcImgHighPositionAndSize(zoom) { p = new Object(); if(zoom=='full') { p.width = (jQuery("html").get(0).clientWidth-(options.marginContainer+options.paddingContainer)*2); p.height = (jQuery("html").get(0).clientHeight-(options.marginContainer+options.paddingContainer)*2); p.left=options.marginContainer; p.top=options.marginContainer; if(p.width>jQuery(document).data("highWidth")) { p.width = jQuery(document).data("highWidth")-options.paddingContainer*2; p.left = (jQuery("html").get(0).clientWidth-p.width)/2; } if(p.height>jQuery(document).data("highHeight")) { p.height = jQuery(document).data("highHeight")-options.paddingContainer*2; p.top = (jQuery("html").get(0).clientHeight-p.height)/2; } } else { //zoom = 'fit' ratioImg = jQuery(document).data("highWidth") / jQuery(document).data("highHeight"); ratioPage = jQuery("html").get(0).clientWidth / jQuery("html").get(0).clientHeight; if((ratioPage > 1 && (ratioPage > ratioImg)) || (ratioPage < 1 && (ratioPage < ratioImg))) { p.height = (jQuery("html").get(0).clientHeight-(options.marginContainer+options.paddingContainer)*2); p.width = p.height*ratioImg; } else { p.width = (jQuery("html").get(0).clientWidth-(options.marginContainer+options.paddingContainer)*2); p.height = p.width/ratioImg; } p.left = (jQuery("html").get(0).clientWidth-p.width)/2; p.top = (jQuery("html").get(0).clientHeight-p.height)/2; } return(p); } function closeDisplayHigh() { jQuery('#theImageHigh').css('display', 'none'); } function switchZoomHigh() { if(zoomMode=='full') { zoomMode="fit"; } else { zoomMode="full"; } jQuery("#theImgHighZoomButton").toggleClass('full').toggleClass('fit'); displayZoomHigh(); } function displayZoomHigh() { p=calcImgHighPositionAndSize(zoomMode); jQuery('#theImgHighContainer').css( { left:p.left+"px", top:p.top+"px", width:p.width+"px", height:p.height+"px" } ); if(zoomMode=="full") { jQuery("#theImgHigh") .css( { width:jQuery(document).data("highWidth")+"px", height:jQuery(document).data("highHeight")+"px" } ); jQuery('#theImgHighContainer').bind("mousemove", function(event) { deadArea = options.marginContainer*2; mouseX=Math.max(Math.min(event.clientX-this.offsetLeft, this.clientWidth - deadArea), deadArea); mouseY=Math.max(Math.min(event.clientY-this.offsetTop, this.clientHeight - deadArea), deadArea); jQuery("#theImgHigh") .css("left",Math.round((jQuery("#theImgHigh").attr("scrollWidth")-this.clientWidth) * -(mouseX-deadArea)/(this.clientWidth-2*deadArea))+"px") .css("top",Math.round((jQuery("#theImgHigh").attr("scrollHeight")-this.clientHeight) * -(mouseY-deadArea)/(this.clientHeight-2*deadArea))+"px"); } ); } else { jQuery("#theImgHigh") .css( { width:p.width+"px", height:p.height+"px", left:"0px", top:"0px" } ); jQuery('#theImgHighContainer').unbind("mousemove"); } } /** * Cookie plugin * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: */ jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=jQuery.extend({},options);options.expires=-1;} var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;} expires='; expires='+date.toUTCString();} var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i