/*
By André Rinas, www.andrerinas.de
Available for use under the MIT License
1.14.0
*/
!function(N,Y,j,t){"use strict";N.fn.simpleLightbox=function(p){p=N.extend({sourceAttr:"href",overlay:!0,spinner:!0,nav:!0,navText:["‹","›"],captions:!0,captionDelay:0,captionSelector:"img",captionType:"attr",captionsData:"title",captionPosition:"bottom",captionClass:"",close:!0,closeText:"×",swipeClose:!0,showCounter:!0,fileExt:"png|jpg|jpeg|gif",animationSlide:!0,animationSpeed:250,preloading:!0,enableKeyboard:!0,loop:!0,rel:!1,docClose:!0,swipeTolerance:50,className:"simple-lightbox",widthRatio:.8,heightRatio:.9,scaleImageToRatio:!1,disableRightClick:!1,disableScroll:!0,alertError:!0,alertErrorMessage:"Image not found, next image will be loaded",additionalHtml:!1,history:!0,throttleInterval:0},p),Y.navigator.pointerEnabled||Y.navigator.msPointerEnabled;var d,t,r=0,l=0,h=N(),n=function(){var t=j.body||j.documentElement;return""===(t=t.style).WebkitTransition?"-webkit-":""===t.MozTransition?"-moz-":""===t.OTransition?"-o-":""===t.transition&&""},g=!1,u=[],f=p.rel&&!1!==p.rel?(t=p.rel,N(this).filter(function(){return N(this).attr("rel")===t})):this,m=(n=n(),0),v=!1!==n,i="pushState"in history,x=!1,a=Y.location,c=function(){return a.hash.substring(1)},b=c(),y=function(){c();var t="pid="+(I+1),e=a.href.split("#")[0]+"#"+t;i?history[x?"replaceState":"pushState"]("",j.title,e):x?a.replace(e):a.hash=t,x=!0},w=function(e,i){var n;return function(){var t=arguments;n||(e.apply(this,t),n=!0,setTimeout(function(){return n=!1},i))}},T="simplelb",e=N("
").addClass("sl-overlay"),o=N("
").addClass("sl-close").html(p.closeText),E=N("").addClass("sl-spinner").html("
"),C=N("
").addClass("sl-navigation").html('
'+p.navText[0]+' '+p.navText[1]+" "),s=N("
").addClass("sl-counter").html('
/
'),S=!1,I=0,k=N("
").addClass("sl-caption "+p.captionClass+" pos-"+p.captionPosition),q=N("
").addClass("sl-image"),D=N("
").addClass("sl-wrapper").addClass(p.className),M=function(t){t.trigger(N.Event("show.simplelightbox")),p.disableScroll&&(m=X("hide")),D.appendTo("body"),q.appendTo(D),p.overlay&&e.appendTo(N("body")),S=!0,I=f.index(t),h=N("
").hide().attr("src",t.attr(p.sourceAttr)),-1==u.indexOf(t.attr(p.sourceAttr))&&u.push(t.attr(p.sourceAttr)),q.html("").attr("style",""),h.appendTo(q),P(),e.fadeIn("fast"),N(".sl-close").fadeIn("fast"),E.show(),C.fadeIn("fast"),N(".sl-wrapper .sl-counter .sl-current").text(I+1),s.fadeIn("fast"),R(),p.preloading&&z(),setTimeout(function(){t.trigger(N.Event("shown.simplelightbox"))},p.animationSpeed)},R=function(s){if(h.length){var r=new Image,l=N(Y).width()*p.widthRatio,c=N(Y).height()*p.heightRatio;r.src=h.attr("src"),N(r).on("error",function(t){f.eq(I).trigger(N.Event("error.simplelightbox")),g=!(S=!1),E.hide(),p.alertError&&alert(p.alertErrorMessage),L(1==s||-1==s?s:1)}),r.onload=function(){void 0!==s&&f.eq(I).trigger(N.Event("changed.simplelightbox")).trigger(N.Event((1===s?"nextDone":"prevDone")+".simplelightbox")),p.history&&(x?d=setTimeout(y,800):y()),-1==u.indexOf(h.attr("src"))&&u.push(h.attr("src"));var t=r.width,e=r.height;if(p.scaleImageToRatio||l
=f.length-1&&N(".sl-next").hide(),0").html(p.additionalHtml).addClass("sl-additional-html").appendTo(N(".sl-image"))}}},A=function(t,e){""!==t&&void 0!==t&&p.captions&&k.html(t).css({width:e+"px"}).hide().appendTo(N(".sl-image")).delay(p.captionDelay).fadeIn("fast")},O=function(t,e){var i={};i[n+"transform"]="translateX("+e+")",i[n+"transition"]=n+"transform "+t+"s linear",N(".sl-image").css(i)},P=function(){N(Y).on("resize."+T,R),N(j).on("click."+T+" touchstart."+T,".sl-close",function(t){t.preventDefault(),g&&W()}),p.history&&setTimeout(function(){N(Y).on("hashchange."+T,function(){g&&c()===b&&W()})},40),C.on("click."+T,"button",w(function(t){t.preventDefault(),r=0,L(N(this).hasClass("sl-next")?1:-1)},p.throttleInterval));var e=0,i=0,n=0,a=0,o=!1,s=0;q.on("touchstart."+T+" mousedown."+T,function(t){return!!o||(v&&(s=parseInt(q.css("left"))),o=!0,l=r=0,e=t.originalEvent.pageX||t.originalEvent.touches[0].pageX,n=t.originalEvent.pageY||t.originalEvent.touches[0].pageY,!1)}).on("touchmove."+T+" mousemove."+T+" pointermove MSPointerMove",function(t){if(!o)return!0;t.preventDefault(),i=t.originalEvent.pageX||t.originalEvent.touches[0].pageX,a=t.originalEvent.pageY||t.originalEvent.touches[0].pageY,r=e-i,l=n-a,p.animationSlide&&(v?O(0,-r+"px"):q.css("left",s-r+"px"))}).on("touchend."+T+" mouseup."+T+" touchcancel."+T+" mouseleave."+T+" pointerup pointercancel MSPointerUp MSPointerCancel",function(t){if(o){var e=!(o=!1);p.loop||(0===I&&r<0&&(e=!1),I>=f.length-1&&0p.swipeTolerance&&e?L(0=f.length-1?0:I+1,e=I-1<0?f.length-1:I-1>=f.length-1?0:I-1;N(" ").attr("src",f.eq(t).attr(p.sourceAttr)).on("load",function(){-1==u.indexOf(N(this).attr("src"))&&u.push(N(this).attr("src")),f.eq(I).trigger(N.Event("nextImageLoaded.simplelightbox"))}),N(" ").attr("src",f.eq(e).attr(p.sourceAttr)).on("load",function(){-1==u.indexOf(N(this).attr("src"))&&u.push(N(this).attr("src")),f.eq(I).trigger(N.Event("prevImageLoaded.simplelightbox"))})},L=function(e){f.eq(I).trigger(N.Event("change.simplelightbox")).trigger(N.Event((1===e?"next":"prev")+".simplelightbox"));var t=I+e;if(!(S||(t<0||t>=f.length)&&!1===p.loop)){I=t<0?f.length-1:t>f.length-1?0:t,N(".sl-wrapper .sl-counter .sl-current").text(I+1);var i={opacity:0};p.animationSlide&&(v?O(p.animationSpeed/1e3,-100*e-r+"px"):i.left=parseInt(N(".sl-image").css("left"))+-100*e+"px"),N(".sl-image").animate(i,p.animationSpeed,function(){setTimeout(function(){var t=f.eq(I);h.attr("src",t.attr(p.sourceAttr)),-1==u.indexOf(t.attr(p.sourceAttr))&&E.show(),N(".sl-caption").remove(),R(e),p.preloading&&z()},100)})}},W=function(){if(!S){var t=f.eq(I),e=!1;t.trigger(N.Event("close.simplelightbox")),p.history&&(i?history.pushState("",j.title,a.pathname+a.search):a.hash="",clearTimeout(d)),N(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){p.disableScroll&&X("show"),N(".sl-wrapper, .sl-overlay").remove(),C.off("click","button"),N(j).off("click."+T,".sl-close"),N(Y).off("resize."+T),N(Y).off("hashchange."+T),e||t.trigger(N.Event("closed.simplelightbox")),e=!0}),h=N(),S=g=!1}},X=function(t){var e=0;if("hide"==t){var i=Y.innerWidth;if(!i){var n=j.documentElement.getBoundingClientRect();i=n.right-Math.abs(n.left)}if(j.body.clientWidth