
/**
 * Required JavaScript for challenge/response spam protection
 */
document.addEventListener('DOMContentLoaded', () =>
{
  [...document.querySelectorAll('[id$="-cr-field"]')].forEach(element =>
  {
    let [expiration,challenge,delay] = atob(element.value).split('|');

    if (delay === undefined) {
      // The CR field has already been submitted by the client, but server side validation may have failed
      return;
    }

    setTimeout(() =>
    {
      element.value = btoa(expiration + '|' + challenge.replace(/[a-z]/gi, char =>
      {
        return String.fromCharCode( char.charCodeAt(0) + ( char.toUpperCase() <= 'M' ? 13 : -13 ) )/* https://stackoverflow.com/a/14553231 */
      }))
    }, 1e3 * delay)
  })
});
/*!
 * Kindler Fotografie Sitepackage v1.0.0 (https://kindler-hosting.de)
 * Copyright 2017-2023 Björn Kindler
 * Licensed under the GPL-2.0-or-later license
 */
console.log("WE LOVE TYPO3");

/*! lazysizes - v5.2.0-beta1 */
!function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}("undefined"!=typeof window?window:{},function(a,b){"use strict";var c,d;if(function(){var b,c={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};d=a.lazySizesConfig||a.lazysizesConfig||{};for(b in c)b in d||(d[b]=c[b])}(),!b||!b.getElementsByClassName)return{init:function(){},cfg:d,noSupport:!0};var e=b.documentElement,f=a.Date,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h],k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=["load","error","lazyincluded","_lazyloaded"],p={},q=Array.prototype.forEach,r=function(a,b){return p[b]||(p[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),p[b].test(a[i]("class")||"")&&p[b]},s=function(a,b){r(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},t=function(a,b){var c;(c=r(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},u=function(a,b,c){var d=c?h:"removeEventListener";c&&u(a,b),o.forEach(function(c){a[d](c,b)})},v=function(a,d,e,f,g){var h=b.createEvent("Event");return e||(e={}),e.instance=c,h.initEvent(d,!f,!g),h.detail=e,a.dispatchEvent(h),h},w=function(b,c){var e;!g&&(e=a.picturefill||d.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),e({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},x=function(a,b){return(getComputedStyle(a,null)||{})[b]},y=function(a,b,c){for(c=c||a.offsetWidth;c<d.minSize&&b&&!a._lazysizesWidth;)c=b.offsetWidth,b=b.parentNode;return c},z=function(){var a,c,d=[],e=[],f=d,g=function(){var b=f;for(f=d.length?e:d,a=!0,c=!1;b.length;)b.shift()();a=!1},h=function(d,e){a&&!e?d.apply(this,arguments):(f.push(d),c||(c=!0,(b.hidden?k:l)(g)))};return h._lsFlush=g,h}(),A=function(a,b){return b?function(){z(a)}:function(){var b=this,c=arguments;z(function(){a.apply(b,c)})}},B=function(a){var b,c=0,e=d.throttleDelay,g=d.ricTimeout,h=function(){b=!1,c=f.now(),a()},i=m&&g>49?function(){m(h,{timeout:g}),g!==d.ricTimeout&&(g=d.ricTimeout)}:A(function(){k(h)},!0);return function(a){var d;(a=!0===a)&&(g=33),b||(b=!0,d=e-(f.now()-c),d<0&&(d=0),a||d<9?i():k(i,d))}},C=function(a){var b,c,d=99,e=function(){b=null,a()},g=function(){var a=f.now()-c;a<d?k(g,d-a):(m||e)(e)};return function(){c=f.now(),b||(b=k(g,d))}},D=function(){var g,m,o,p,y,D,F,G,H,I,J,K,L=/^img$/i,M=/^iframe$/i,N="onscroll"in a&&!/(gle|ing)bot/.test(navigator.userAgent),O=0,P=0,Q=0,R=-1,S=function(a){Q--,(!a||Q<0||!a.target)&&(Q=0)},T=function(a){return null==K&&(K="hidden"==x(b.body,"visibility")),K||!("hidden"==x(a.parentNode,"visibility")&&"hidden"==x(a,"visibility"))},U=function(a,c){var d,f=a,g=T(a);for(G-=c,J+=c,H-=c,I+=c;g&&(f=f.offsetParent)&&f!=b.body&&f!=e;)(g=(x(f,"opacity")||1)>0)&&"visible"!=x(f,"overflow")&&(d=f.getBoundingClientRect(),g=I>d.left&&H<d.right&&J>d.top-1&&G<d.bottom+1);return g},V=function(){var a,f,h,j,k,l,n,o,q,r,s,t,u=c.elements;if((p=d.loadMode)&&Q<8&&(a=u.length)){for(f=0,R++;f<a;f++)if(u[f]&&!u[f]._lazyRace)if(!N||c.prematureUnveil&&c.prematureUnveil(u[f]))ba(u[f]);else if((o=u[f][i]("data-expand"))&&(l=1*o)||(l=P),r||(r=!d.expand||d.expand<1?e.clientHeight>500&&e.clientWidth>500?500:370:d.expand,c._defEx=r,s=r*d.expFactor,t=d.hFac,K=null,P<s&&Q<1&&R>2&&p>2&&!b.hidden?(P=s,R=0):P=p>1&&R>1&&Q<6?r:O),q!==l&&(D=innerWidth+l*t,F=innerHeight+l,n=-1*l,q=l),h=u[f].getBoundingClientRect(),(J=h.bottom)>=n&&(G=h.top)<=F&&(I=h.right)>=n*t&&(H=h.left)<=D&&(J||I||H||G)&&(d.loadHidden||T(u[f]))&&(m&&Q<3&&!o&&(p<3||R<4)||U(u[f],l))){if(ba(u[f]),k=!0,Q>9)break}else!k&&m&&!j&&Q<4&&R<4&&p>2&&(g[0]||d.preloadAfterLoad)&&(g[0]||!o&&(J||I||H||G||"auto"!=u[f][i](d.sizesAttr)))&&(j=g[0]||u[f]);j&&!k&&ba(j)}},W=B(V),X=function(a){var b=a.target;if(b._lazyCache)return void delete b._lazyCache;S(a),s(b,d.loadedClass),t(b,d.loadingClass),u(b,Z),v(b,"lazyloaded")},Y=A(X),Z=function(a){Y({target:a.target})},$=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},_=function(a){var b,c=a[i](d.srcsetAttr);(b=d.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},aa=A(function(a,b,c,e,f){var g,h,j,l,m,p;(m=v(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(c?s(a,d.autosizesClass):a.setAttribute("sizes",e)),h=a[i](d.srcsetAttr),g=a[i](d.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),p=b.firesLoad||"src"in a&&(h||g||l),m={target:a},s(a,d.loadingClass),p&&(clearTimeout(o),o=k(S,2500),u(a,Z,!0)),l&&q.call(j.getElementsByTagName("source"),_),h?a.setAttribute("srcset",h):g&&!l&&(M.test(a.nodeName)?$(a,g):a.src=g),f&&(h||l)&&w(a,{src:g})),a._lazyRace&&delete a._lazyRace,t(a,d.lazyClass),z(function(){var b=a.complete&&a.naturalWidth>1;p&&!b||(b&&s(a,"ls-is-cached"),X(m),a._lazyCache=!0,k(function(){"_lazyCache"in a&&delete a._lazyCache},9)),"lazy"==a.loading&&Q--},!0)}),ba=function(a){if(!a._lazyRace){var b,c=L.test(a.nodeName),e=c&&(a[i](d.sizesAttr)||a[i]("sizes")),f="auto"==e;(!f&&m||!c||!a[i]("src")&&!a.srcset||a.complete||r(a,d.errorClass)||!r(a,d.lazyClass))&&(b=v(a,"lazyunveilread").detail,f&&E.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,Q++,aa(a,b,f,e,c))}},ca=C(function(){d.loadMode=3,W()}),da=function(){3==d.loadMode&&(d.loadMode=2),ca()},ea=function(){if(!m){if(f.now()-y<999)return void k(ea,999);m=!0,d.loadMode=3,W(),j("scroll",da,!0)}};return{_:function(){y=f.now(),c.elements=b.getElementsByClassName(d.lazyClass),g=b.getElementsByClassName(d.lazyClass+" "+d.preloadClass),j("scroll",W,!0),j("resize",W,!0),j("pageshow",function(a){if(a.persisted){var c=b.querySelectorAll("."+d.loadingClass);c.length&&c.forEach&&l(function(){c.forEach(function(a){a.complete&&ba(a)})})}}),a.MutationObserver?new MutationObserver(W).observe(e,{childList:!0,subtree:!0,attributes:!0}):(e[h]("DOMNodeInserted",W,!0),e[h]("DOMAttrModified",W,!0),setInterval(W,999)),j("hashchange",W,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(a){b[h](a,W,!0)}),/d$|^c/.test(b.readyState)?ea():(j("load",ea),b[h]("DOMContentLoaded",W),k(ea,2e4)),c.elements.length?(V(),z._lsFlush()):W()},checkElems:W,unveil:ba,_aLSL:da}}(),E=function(){var a,c=A(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;f<g;f++)e[f].setAttribute("sizes",d);c.detail.dataAttr||w(a,c.detail)}),e=function(a,b,d){var e,f=a.parentNode;f&&(d=y(a,f,d),e=v(a,"lazybeforesizes",{width:d,dataAttr:!!b}),e.defaultPrevented||(d=e.detail.width)&&d!==a._lazysizesWidth&&c(a,f,e,d))},f=function(){var b,c=a.length;if(c)for(b=0;b<c;b++)e(a[b])},g=C(f);return{_:function(){a=b.getElementsByClassName(d.autosizesClass),j("resize",g)},checkElems:g,updateElem:e}}(),F=function(){!F.i&&b.getElementsByClassName&&(F.i=!0,E._(),D._())};return k(function(){d.init&&F()}),c={cfg:d,autoSizer:E,loader:D,init:F,uP:w,aC:s,rC:t,hC:r,fire:v,gW:y,rAF:z}});

/*!
 * imagesLoaded PACKAGED v5.0.0
 * JavaScript is all like "You images are done yet or what?"
 * MIT License
 */
!function(t,e){"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,(function(){function t(){}let e=t.prototype;return e.on=function(t,e){if(!t||!e)return this;let i=this._events=this._events||{},s=i[t]=i[t]||[];return s.includes(e)||s.push(e),this},e.once=function(t,e){if(!t||!e)return this;this.on(t,e);let i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this},e.off=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;let s=i.indexOf(e);return-1!=s&&i.splice(s,1),this},e.emitEvent=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;i=i.slice(0),e=e||[];let s=this._onceEvents&&this._onceEvents[t];for(let n of i){s&&s[n]&&(this.off(t,n),delete s[n]),n.apply(this,e)}return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t})),
/*!
 * imagesLoaded v5.0.0
 * JavaScript is all like "You images are done yet or what?"
 * MIT License
 */
function(t,e){"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,(function(t,e){let i=t.jQuery,s=t.console;function n(t,e,o){if(!(this instanceof n))return new n(t,e,o);let r=t;var h;("string"==typeof t&&(r=document.querySelectorAll(t)),r)?(this.elements=(h=r,Array.isArray(h)?h:"object"==typeof h&&"number"==typeof h.length?[...h]:[h]),this.options={},"function"==typeof e?o=e:Object.assign(this.options,e),o&&this.on("always",o),this.getImages(),i&&(this.jqDeferred=new i.Deferred),setTimeout(this.check.bind(this))):s.error(`Bad element for imagesLoaded ${r||t}`)}n.prototype=Object.create(e.prototype),n.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};const o=[1,9,11];n.prototype.addElementImages=function(t){"IMG"===t.nodeName&&this.addImage(t),!0===this.options.background&&this.addElementBackgroundImages(t);let{nodeType:e}=t;if(!e||!o.includes(e))return;let i=t.querySelectorAll("img");for(let t of i)this.addImage(t);if("string"==typeof this.options.background){let e=t.querySelectorAll(this.options.background);for(let t of e)this.addElementBackgroundImages(t)}};const r=/url\((['"])?(.*?)\1\)/gi;function h(t){this.img=t}function d(t,e){this.url=t,this.element=e,this.img=new Image}return n.prototype.addElementBackgroundImages=function(t){let e=getComputedStyle(t);if(!e)return;let i=r.exec(e.backgroundImage);for(;null!==i;){let s=i&&i[2];s&&this.addBackground(s,t),i=r.exec(e.backgroundImage)}},n.prototype.addImage=function(t){let e=new h(t);this.images.push(e)},n.prototype.addBackground=function(t,e){let i=new d(t,e);this.images.push(i)},n.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length)return void this.complete();let t=(t,e,i)=>{setTimeout((()=>{this.progress(t,e,i)}))};this.images.forEach((function(e){e.once("progress",t),e.check()}))},n.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&s&&s.log(`progress: ${i}`,t,e)},n.prototype.complete=function(){let t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){let t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},h.prototype=Object.create(e.prototype),h.prototype.check=function(){this.getIsImageComplete()?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src)},h.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},h.prototype.confirm=function(t,e){this.isLoaded=t;let{parentNode:i}=this.img,s="PICTURE"===i.nodeName?i:this.img;this.emitEvent("progress",[this,s,e])},h.prototype.handleEvent=function(t){let e="on"+t.type;this[e]&&this[e](t)},h.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},h.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},h.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype=Object.create(h.prototype),d.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},d.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},n.makeJQueryPlugin=function(e){(e=e||t.jQuery)&&(i=e,i.fn.imagesLoaded=function(t,e){return new n(this,t,e).jqDeferred.promise(i(this))})},n.makeJQueryPlugin(),n}));
/*!
 * Isotope PACKAGED v3.0.6
 *
 * Licensed GPLv3 for open source use
 * or Isotope Commercial License for commercial use
 *
 * https://isotope.metafizzy.co
 * Copyright 2010-2018 Metafizzy
 */

!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,s,a){function u(t,e,o){var n,s="$()."+i+'("'+e+'")';return t.each(function(t,u){var h=a.data(u,i);if(!h)return void r(i+" not initialized. Cannot call methods, i.e. "+s);var d=h[e];if(!d||"_"==e.charAt(0))return void r(s+" is not a valid method");var l=d.apply(h,o);n=void 0===n?l:n}),void 0!==n?n:t}function h(t,e){t.each(function(t,o){var n=a.data(o,i);n?(n.option(e),n._init()):(n=new s(o,e),a.data(o,i,n))})}a=a||e||t.jQuery,a&&(s.prototype.option||(s.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=n.call(arguments,1);return u(this,t,e)}return h(this,t),this},o(a))}function o(t){!t||t&&t.bridget||(t.bridget=i)}var n=Array.prototype.slice,s=t.console,r="undefined"==typeof s?function(){}:function(t){s.error(t)};return o(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},o=i[t]=i[t]||[];return o.indexOf(e)==-1&&o.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},o=i[t]=i[t]||{};return o[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var o=i.indexOf(e);return o!=-1&&i.splice(o,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var o=this._onceEvents&&this._onceEvents[t],n=0;n<i.length;n++){var s=i[n],r=o&&o[s];r&&(this.off(t,s),delete o[s]),s.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t}),function(t,e){"function"==typeof define&&define.amd?define("get-size/get-size",e):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=t.indexOf("%")==-1&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<h;e++){var i=u[e];t[i]=0}return t}function o(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function n(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var n=o(e);r=200==Math.round(t(n.width)),s.isBoxSizeOuter=r,i.removeChild(e)}}function s(e){if(n(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var s=o(e);if("none"==s.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==s.boxSizing,l=0;l<h;l++){var f=u[l],c=s[f],m=parseFloat(c);a[f]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,y=a.paddingTop+a.paddingBottom,g=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,I=d&&r,x=t(s.width);x!==!1&&(a.width=x+(I?0:p+_));var S=t(s.height);return S!==!1&&(a.height=S+(I?0:y+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(y+z),a.outerWidth=a.width+g,a.outerHeight=a.height+v,a}}var r,a="undefined"==typeof console?e:function(t){console.error(t)},u=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],h=u.length,d=!1;return s}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var o=e[i],n=o+"MatchesSelector";if(t[n])return n}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e};var o=Array.prototype.slice;i.makeArray=function(t){if(Array.isArray(t))return t;if(null===t||void 0===t)return[];var e="object"==typeof t&&"number"==typeof t.length;return e?o.call(t):[t]},i.removeFrom=function(t,e){var i=t.indexOf(e);i!=-1&&t.splice(i,1)},i.getParent=function(t,i){for(;t.parentNode&&t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,o){t=i.makeArray(t);var n=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!o)return void n.push(t);e(t,o)&&n.push(t);for(var i=t.querySelectorAll(o),s=0;s<i.length;s++)n.push(i[s])}}),n},i.debounceMethod=function(t,e,i){i=i||100;var o=t.prototype[e],n=e+"Timeout";t.prototype[e]=function(){var t=this[n];clearTimeout(t);var e=arguments,s=this;this[n]=setTimeout(function(){o.apply(s,e),delete s[n]},i)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var n=t.console;return i.htmlInit=function(e,o){i.docReady(function(){var s=i.toDashed(o),r="data-"+s,a=document.querySelectorAll("["+r+"]"),u=document.querySelectorAll(".js-"+s),h=i.makeArray(a).concat(i.makeArray(u)),d=r+"-options",l=t.jQuery;h.forEach(function(t){var i,s=t.getAttribute(r)||t.getAttribute(d);try{i=s&&JSON.parse(s)}catch(a){return void(n&&n.error("Error parsing "+r+" on "+t.className+": "+a))}var u=new e(t,i);l&&l.data(t,o,u)})})},i}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";function i(t){for(var e in t)return!1;return e=null,!0}function o(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}function n(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}var s=document.documentElement.style,r="string"==typeof s.transition?"transition":"WebkitTransition",a="string"==typeof s.transform?"transform":"WebkitTransform",u={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[r],h={transform:a,transition:r,transitionDuration:r+"Duration",transitionProperty:r+"Property",transitionDelay:r+"Delay"},d=o.prototype=Object.create(t.prototype);d.constructor=o,d._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},d.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},d.getSize=function(){this.size=e(this.element)},d.css=function(t){var e=this.element.style;for(var i in t){var o=h[i]||i;e[o]=t[i]}},d.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),o=t[e?"left":"right"],n=t[i?"top":"bottom"],s=parseFloat(o),r=parseFloat(n),a=this.layout.size;o.indexOf("%")!=-1&&(s=s/100*a.width),n.indexOf("%")!=-1&&(r=r/100*a.height),s=isNaN(s)?0:s,r=isNaN(r)?0:r,s-=e?a.paddingLeft:a.paddingRight,r-=i?a.paddingTop:a.paddingBottom,this.position.x=s,this.position.y=r},d.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),o=this.layout._getOption("originTop"),n=i?"paddingLeft":"paddingRight",s=i?"left":"right",r=i?"right":"left",a=this.position.x+t[n];e[s]=this.getXValue(a),e[r]="";var u=o?"paddingTop":"paddingBottom",h=o?"top":"bottom",d=o?"bottom":"top",l=this.position.y+t[u];e[h]=this.getYValue(l),e[d]="",this.css(e),this.emitEvent("layout",[this])},d.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&!e?t/this.layout.size.width*100+"%":t+"px"},d.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&e?t/this.layout.size.height*100+"%":t+"px"},d._transitionTo=function(t,e){this.getPosition();var i=this.position.x,o=this.position.y,n=t==this.position.x&&e==this.position.y;if(this.setPosition(t,e),n&&!this.isTransitioning)return void this.layoutPosition();var s=t-i,r=e-o,a={};a.transform=this.getTranslate(s,r),this.transition({to:a,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},d.getTranslate=function(t,e){var i=this.layout._getOption("originLeft"),o=this.layout._getOption("originTop");return t=i?t:-t,e=o?e:-e,"translate3d("+t+"px, "+e+"px, 0)"},d.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},d.moveTo=d._transitionTo,d.setPosition=function(t,e){this.position.x=parseFloat(t),this.position.y=parseFloat(e)},d._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},d.transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t);var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var o=this.element.offsetHeight;o=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var l="opacity,"+n(a);d.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:l,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(u,this,!1)}},d.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},d.onotransitionend=function(t){this.ontransitionend(t)};var f={"-webkit-transform":"transform"};d.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,o=f[t.propertyName]||t.propertyName;if(delete e.ingProperties[o],i(e.ingProperties)&&this.disableTransition(),o in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[o]),o in e.onEnd){var n=e.onEnd[o];n.call(this),delete e.onEnd[o]}this.emitEvent("transitionEnd",[this])}},d.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(u,this,!1),this.isTransitioning=!1},d._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var c={transitionProperty:"",transitionDuration:"",transitionDelay:""};return d.removeTransitionStyles=function(){this.css(c)},d.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},d.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},d.remove=function(){return r&&parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),void this.hide()):void this.removeElem()},d.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("visibleStyle");e[i]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},d.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},d.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},d.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("hiddenStyle");e[i]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},d.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},d.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},o}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(i,o,n,s){return e(t,i,o,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):t.Outlayer=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,t.Outlayer.Item)}(window,function(t,e,i,o,n){"use strict";function s(t,e){var i=o.getQueryElement(t);if(!i)return void(u&&u.error("Bad element for "+this.constructor.namespace+": "+(i||t)));this.element=i,h&&(this.$element=h(this.element)),this.options=o.extend({},this.constructor.defaults),this.option(e);var n=++l;this.element.outlayerGUID=n,f[n]=this,this._create();var s=this._getOption("initLayout");s&&this.layout()}function r(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e}function a(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&&e[1],o=e&&e[2];if(!i.length)return 0;i=parseFloat(i);var n=m[o]||1;return i*n}var u=t.console,h=t.jQuery,d=function(){},l=0,f={};s.namespace="outlayer",s.Item=n,s.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var c=s.prototype;o.extend(c,e.prototype),c.option=function(t){o.extend(this.options,t)},c._getOption=function(t){var e=this.constructor.compatOptions[t];return e&&void 0!==this.options[e]?this.options[e]:this.options[t]},s.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},c._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),o.extend(this.element.style,this.options.containerStyle);var t=this._getOption("resize");t&&this.bindResize()},c.reloadItems=function(){this.items=this._itemize(this.element.children)},c._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,o=[],n=0;n<e.length;n++){var s=e[n],r=new i(s,this);o.push(r)}return o},c._filterFindItemElements=function(t){return o.filterFindElements(t,this.options.itemSelector)},c.getItemElements=function(){return this.items.map(function(t){return t.element})},c.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},c._init=c.layout,c._resetLayout=function(){this.getSize()},c.getSize=function(){this.size=i(this.element)},c._getMeasurement=function(t,e){var o,n=this.options[t];n?("string"==typeof n?o=this.element.querySelector(n):n instanceof HTMLElement&&(o=n),this[t]=o?i(o)[e]:n):this[t]=0},c.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},c._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},c._layoutItems=function(t,e){if(this._emitCompleteOnItems("layout",t),t&&t.length){var i=[];t.forEach(function(t){var o=this._getItemLayoutPosition(t);o.item=t,o.isInstant=e||t.isLayoutInstant,i.push(o)},this),this._processLayoutQueue(i)}},c._getItemLayoutPosition=function(){return{x:0,y:0}},c._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},c.updateStagger=function(){var t=this.options.stagger;return null===t||void 0===t?void(this.stagger=0):(this.stagger=a(t),this.stagger)},c._positionItem=function(t,e,i,o,n){o?t.goTo(e,i):(t.stagger(n*this.stagger),t.moveTo(e,i))},c._postLayout=function(){this.resizeContainer()},c.resizeContainer=function(){var t=this._getOption("resizeContainer");if(t){var e=this._getContainerSize();e&&(this._setContainerMeasure(e.width,!0),this._setContainerMeasure(e.height,!1))}},c._getContainerSize=d,c._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},c._emitCompleteOnItems=function(t,e){function i(){n.dispatchEvent(t+"Complete",null,[e])}function o(){r++,r==s&&i()}var n=this,s=e.length;if(!e||!s)return void i();var r=0;e.forEach(function(e){e.once(t,o)})},c.dispatchEvent=function(t,e,i){var o=e?[e].concat(i):i;if(this.emitEvent(t,o),h)if(this.$element=this.$element||h(this.element),e){var n=h.Event(e);n.type=t,this.$element.trigger(n,i)}else this.$element.trigger(t,i)},c.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},c.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},c.stamp=function(t){t=this._find(t),t&&(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},c.unstamp=function(t){t=this._find(t),t&&t.forEach(function(t){o.removeFrom(this.stamps,t),this.unignore(t)},this)},c._find=function(t){if(t)return"string"==typeof t&&(t=this.element.querySelectorAll(t)),t=o.makeArray(t)},c._manageStamps=function(){this.stamps&&this.stamps.length&&(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},c._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},c._manageStamp=d,c._getElementOffset=function(t){var e=t.getBoundingClientRect(),o=this._boundingRect,n=i(t),s={left:e.left-o.left-n.marginLeft,top:e.top-o.top-n.marginTop,right:o.right-e.right-n.marginRight,bottom:o.bottom-e.bottom-n.marginBottom};return s},c.handleEvent=o.handleEvent,c.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},c.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},c.onresize=function(){this.resize()},o.debounceMethod(s,"onresize",100),c.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},c.needsResizeLayout=function(){var t=i(this.element),e=this.size&&t;return e&&t.innerWidth!==this.size.innerWidth},c.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},c.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},c.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},c.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.reveal()})}},c.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.hide()})}},c.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},c.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},c.getItem=function(t){for(var e=0;e<this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},c.getItems=function(t){t=o.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getItem(t);i&&e.push(i)},this),e},c.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&&e.length&&e.forEach(function(t){t.remove(),o.removeFrom(this.items,t)},this)},c.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete f[e],delete this.element.outlayerGUID,h&&h.removeData(this.element,this.constructor.namespace)},s.data=function(t){t=o.getQueryElement(t);var e=t&&t.outlayerGUID;return e&&f[e]},s.create=function(t,e){var i=r(s);return i.defaults=o.extend({},s.defaults),o.extend(i.defaults,e),i.compatOptions=o.extend({},s.compatOptions),i.namespace=t,i.data=s.data,i.Item=r(n),o.htmlInit(i,t),h&&h.bridget&&h.bridget(t,i),i};var m={ms:1,s:1e3};return s.Item=n,s}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/item",["outlayer/outlayer"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer")):(t.Isotope=t.Isotope||{},t.Isotope.Item=e(t.Outlayer))}(window,function(t){"use strict";function e(){t.Item.apply(this,arguments)}var i=e.prototype=Object.create(t.Item.prototype),o=i._create;i._create=function(){this.id=this.layout.itemGUID++,o.call(this),this.sortData={}},i.updateSortData=function(){if(!this.isIgnored){this.sortData.id=this.id,this.sortData["original-order"]=this.id,this.sortData.random=Math.random();var t=this.layout.options.getSortData,e=this.layout._sorters;for(var i in t){var o=e[i];this.sortData[i]=o(this.element,this)}}};var n=i.destroy;return i.destroy=function(){n.apply(this,arguments),this.css({display:""})},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-mode",["get-size/get-size","outlayer/outlayer"],e):"object"==typeof module&&module.exports?module.exports=e(require("get-size"),require("outlayer")):(t.Isotope=t.Isotope||{},t.Isotope.LayoutMode=e(t.getSize,t.Outlayer))}(window,function(t,e){"use strict";function i(t){this.isotope=t,t&&(this.options=t.options[this.namespace],this.element=t.element,this.items=t.filteredItems,this.size=t.size)}var o=i.prototype,n=["_resetLayout","_getItemLayoutPosition","_manageStamp","_getContainerSize","_getElementOffset","needsResizeLayout","_getOption"];return n.forEach(function(t){o[t]=function(){return e.prototype[t].apply(this.isotope,arguments)}}),o.needsVerticalResizeLayout=function(){var e=t(this.isotope.element),i=this.isotope.size&&e;return i&&e.innerHeight!=this.isotope.size.innerHeight},o._getMeasurement=function(){this.isotope._getMeasurement.apply(this,arguments)},o.getColumnWidth=function(){this.getSegmentSize("column","Width")},o.getRowHeight=function(){this.getSegmentSize("row","Height")},o.getSegmentSize=function(t,e){var i=t+e,o="outer"+e;if(this._getMeasurement(i,o),!this[i]){var n=this.getFirstItemSize();this[i]=n&&n[o]||this.isotope.size["inner"+e]}},o.getFirstItemSize=function(){var e=this.isotope.filteredItems[0];return e&&e.element&&t(e.element)},o.layout=function(){this.isotope.layout.apply(this.isotope,arguments)},o.getSize=function(){this.isotope.getSize(),this.size=this.isotope.size},i.modes={},i.create=function(t,e){function n(){i.apply(this,arguments)}return n.prototype=Object.create(o),n.prototype.constructor=n,e&&(n.options=e),n.prototype.namespace=t,i.modes[t]=n,n},i}),function(t,e){"function"==typeof define&&define.amd?define("masonry-layout/masonry",["outlayer/outlayer","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer"),require("get-size")):t.Masonry=e(t.Outlayer,t.getSize)}(window,function(t,e){var i=t.create("masonry");i.compatOptions.fitWidth="isFitWidth";var o=i.prototype;return o._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns(),this.colYs=[];for(var t=0;t<this.cols;t++)this.colYs.push(0);this.maxY=0,this.horizontalColIndex=0},o.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&e(i).outerWidth||this.containerWidth}var o=this.columnWidth+=this.gutter,n=this.containerWidth+this.gutter,s=n/o,r=o-n%o,a=r&&r<1?"round":"floor";s=Math[a](s),this.cols=Math.max(s,1)},o.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,o=e(i);this.containerWidth=o&&o.innerWidth},o._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&e<1?"round":"ceil",o=Math[i](t.size.outerWidth/this.columnWidth);o=Math.min(o,this.cols);for(var n=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",s=this[n](o,t),r={x:this.columnWidth*s.col,y:s.y},a=s.y+t.size.outerHeight,u=o+s.col,h=s.col;h<u;h++)this.colYs[h]=a;return r},o._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},o._getTopColGroup=function(t){if(t<2)return this.colYs;for(var e=[],i=this.cols+1-t,o=0;o<i;o++)e[o]=this._getColGroupY(o,t);return e},o._getColGroupY=function(t,e){if(e<2)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},o._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,o=t>1&&i+t>this.cols;i=o?0:i;var n=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=n?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},o._manageStamp=function(t){var i=e(t),o=this._getElementOffset(t),n=this._getOption("originLeft"),s=n?o.left:o.right,r=s+i.outerWidth,a=Math.floor(s/this.columnWidth);a=Math.max(0,a);var u=Math.floor(r/this.columnWidth);u-=r%this.columnWidth?0:1,u=Math.min(this.cols-1,u);for(var h=this._getOption("originTop"),d=(h?o.top:o.bottom)+i.outerHeight,l=a;l<=u;l++)this.colYs[l]=Math.max(d,this.colYs[l])},o._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},o._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},o.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/masonry",["../layout-mode","masonry-layout/masonry"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode"),require("masonry-layout")):e(t.Isotope.LayoutMode,t.Masonry)}(window,function(t,e){"use strict";var i=t.create("masonry"),o=i.prototype,n={_getElementOffset:!0,layout:!0,_getMeasurement:!0};for(var s in e.prototype)n[s]||(o[s]=e.prototype[s]);var r=o.measureColumns;o.measureColumns=function(){this.items=this.isotope.filteredItems,r.call(this)};var a=o._getOption;return o._getOption=function(t){return"fitWidth"==t?void 0!==this.options.isFitWidth?this.options.isFitWidth:this.options.fitWidth:a.apply(this.isotope,arguments)},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/fit-rows",["../layout-mode"],e):"object"==typeof exports?module.exports=e(require("../layout-mode")):e(t.Isotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("fitRows"),i=e.prototype;return i._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this._getMeasurement("gutter","outerWidth")},i._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth+this.gutter,i=this.isotope.size.innerWidth+this.gutter;0!==this.x&&e+this.x>i&&(this.x=0,this.y=this.maxY);var o={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=e,o},i._getContainerSize=function(){return{height:this.maxY}},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/vertical",["../layout-mode"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode")):e(t.Isotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("vertical",{horizontalAlignment:0}),i=e.prototype;return i._resetLayout=function(){this.y=0},i._getItemLayoutPosition=function(t){t.getSize();var e=(this.isotope.size.innerWidth-t.size.outerWidth)*this.options.horizontalAlignment,i=this.y;return this.y+=t.size.outerHeight,{x:e,y:i}},i._getContainerSize=function(){return{height:this.y}},e}),function(t,e){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","desandro-matches-selector/matches-selector","fizzy-ui-utils/utils","isotope-layout/js/item","isotope-layout/js/layout-mode","isotope-layout/js/layout-modes/masonry","isotope-layout/js/layout-modes/fit-rows","isotope-layout/js/layout-modes/vertical"],function(i,o,n,s,r,a){return e(t,i,o,n,s,r,a)}):"object"==typeof module&&module.exports?module.exports=e(t,require("outlayer"),require("get-size"),require("desandro-matches-selector"),require("fizzy-ui-utils"),require("isotope-layout/js/item"),require("isotope-layout/js/layout-mode"),require("isotope-layout/js/layout-modes/masonry"),require("isotope-layout/js/layout-modes/fit-rows"),require("isotope-layout/js/layout-modes/vertical")):t.Isotope=e(t,t.Outlayer,t.getSize,t.matchesSelector,t.fizzyUIUtils,t.Isotope.Item,t.Isotope.LayoutMode)}(window,function(t,e,i,o,n,s,r){function a(t,e){return function(i,o){for(var n=0;n<t.length;n++){var s=t[n],r=i.sortData[s],a=o.sortData[s];if(r>a||r<a){var u=void 0!==e[s]?e[s]:e,h=u?1:-1;return(r>a?1:-1)*h}}return 0}}var u=t.jQuery,h=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/g,"")},d=e.create("isotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});d.Item=s,d.LayoutMode=r;var l=d.prototype;l._create=function(){this.itemGUID=0,this._sorters={},this._getSorters(),e.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"];for(var t in r.modes)this._initLayoutMode(t)},l.reloadItems=function(){this.itemGUID=0,e.prototype.reloadItems.call(this)},l._itemize=function(){for(var t=e.prototype._itemize.apply(this,arguments),i=0;i<t.length;i++){var o=t[i];o.id=this.itemGUID++}return this._updateItemsSortData(t),t},l._initLayoutMode=function(t){var e=r.modes[t],i=this.options[t]||{};this.options[t]=e.options?n.extend(e.options,i):i,this.modes[t]=new e(this)},l.layout=function(){return!this._isLayoutInited&&this._getOption("initLayout")?void this.arrange():void this._layout()},l._layout=function(){var t=this._getIsInstant();this._resetLayout(),this._manageStamps(),this.layoutItems(this.filteredItems,t),this._isLayoutInited=!0},l.arrange=function(t){this.option(t),this._getIsInstant();var e=this._filter(this.items);this.filteredItems=e.matches,this._bindArrangeComplete(),this._isInstant?this._noTransition(this._hideReveal,[e]):this._hideReveal(e),this._sort(),this._layout()},l._init=l.arrange,l._hideReveal=function(t){this.reveal(t.needReveal),this.hide(t.needHide)},l._getIsInstant=function(){var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;return this._isInstant=e,e},l._bindArrangeComplete=function(){function t(){e&&i&&o&&n.dispatchEvent("arrangeComplete",null,[n.filteredItems])}var e,i,o,n=this;this.once("layoutComplete",function(){e=!0,t()}),this.once("hideComplete",function(){i=!0,t()}),this.once("revealComplete",function(){o=!0,t()})},l._filter=function(t){var e=this.options.filter;e=e||"*";for(var i=[],o=[],n=[],s=this._getFilterTest(e),r=0;r<t.length;r++){var a=t[r];if(!a.isIgnored){var u=s(a);u&&i.push(a),u&&a.isHidden?o.push(a):u||a.isHidden||n.push(a)}}return{matches:i,needReveal:o,needHide:n}},l._getFilterTest=function(t){return u&&this.options.isJQueryFiltering?function(e){return u(e.element).is(t);
}:"function"==typeof t?function(e){return t(e.element)}:function(e){return o(e.element,t)}},l.updateSortData=function(t){var e;t?(t=n.makeArray(t),e=this.getItems(t)):e=this.items,this._getSorters(),this._updateItemsSortData(e)},l._getSorters=function(){var t=this.options.getSortData;for(var e in t){var i=t[e];this._sorters[e]=f(i)}},l._updateItemsSortData=function(t){for(var e=t&&t.length,i=0;e&&i<e;i++){var o=t[i];o.updateSortData()}};var f=function(){function t(t){if("string"!=typeof t)return t;var i=h(t).split(" "),o=i[0],n=o.match(/^\[(.+)\]$/),s=n&&n[1],r=e(s,o),a=d.sortDataParsers[i[1]];return t=a?function(t){return t&&a(r(t))}:function(t){return t&&r(t)}}function e(t,e){return t?function(e){return e.getAttribute(t)}:function(t){var i=t.querySelector(e);return i&&i.textContent}}return t}();d.sortDataParsers={parseInt:function(t){return parseInt(t,10)},parseFloat:function(t){return parseFloat(t)}},l._sort=function(){if(this.options.sortBy){var t=n.makeArray(this.options.sortBy);this._getIsSameSortBy(t)||(this.sortHistory=t.concat(this.sortHistory));var e=a(this.sortHistory,this.options.sortAscending);this.filteredItems.sort(e)}},l._getIsSameSortBy=function(t){for(var e=0;e<t.length;e++)if(t[e]!=this.sortHistory[e])return!1;return!0},l._mode=function(){var t=this.options.layoutMode,e=this.modes[t];if(!e)throw new Error("No layout mode: "+t);return e.options=this.options[t],e},l._resetLayout=function(){e.prototype._resetLayout.call(this),this._mode()._resetLayout()},l._getItemLayoutPosition=function(t){return this._mode()._getItemLayoutPosition(t)},l._manageStamp=function(t){this._mode()._manageStamp(t)},l._getContainerSize=function(){return this._mode()._getContainerSize()},l.needsResizeLayout=function(){return this._mode().needsResizeLayout()},l.appended=function(t){var e=this.addItems(t);if(e.length){var i=this._filterRevealAdded(e);this.filteredItems=this.filteredItems.concat(i)}},l.prepended=function(t){var e=this._itemize(t);if(e.length){this._resetLayout(),this._manageStamps();var i=this._filterRevealAdded(e);this.layoutItems(this.filteredItems),this.filteredItems=i.concat(this.filteredItems),this.items=e.concat(this.items)}},l._filterRevealAdded=function(t){var e=this._filter(t);return this.hide(e.needHide),this.reveal(e.matches),this.layoutItems(e.matches,!0),e.matches},l.insert=function(t){var e=this.addItems(t);if(e.length){var i,o,n=e.length;for(i=0;i<n;i++)o=e[i],this.element.appendChild(o.element);var s=this._filter(e).matches;for(i=0;i<n;i++)e[i].isLayoutInstant=!0;for(this.arrange(),i=0;i<n;i++)delete e[i].isLayoutInstant;this.reveal(s)}};var c=l.remove;return l.remove=function(t){t=n.makeArray(t);var e=this.getItems(t);c.call(this,t);for(var i=e&&e.length,o=0;i&&o<i;o++){var s=e[o];n.removeFrom(this.filteredItems,s)}},l.shuffle=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.sortData.random=Math.random()}this.options.sortBy="random",this._sort(),this._layout()},l._noTransition=function(t,e){var i=this.options.transitionDuration;this.options.transitionDuration=0;var o=t.apply(this,e);return this.options.transitionDuration=i,o},l.getFilteredItemElements=function(){return this.filteredItems.map(function(t){return t.element})},d});
var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f);
return 0<b.length?c.apply(null,b):c.call()}function n(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},k=!1,h="*";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;return this},api:function(a,c){if(!this.element||!a)return!1;var b=this.element,d=""!==b.id?b.id:null,e=c&&c.constructor&&c.call&&c.apply?null:c,f=c&&c.constructor&&c.call&&c.apply?c:null;f&&n(a,f,d);g(a,e,b);return this},addEvent:function(a,c){if(!this.element)return!1;
var b=this.element,d=""!==b.id?b.id:null;n(a,c,d);"ready"!=a?g("addEventListener",a,b):"ready"==a&&k&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b=""!==c.id?c.id:null;a:{if(b&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&g("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",l,!1):window.attachEvent("onmessage",l);return window.Froogaloop=
window.$f=e}();

/*! lightgallery - v1.8.0 - 2020-08-29
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */
(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
      // AMD. Register as an anonymous module unless amdModuleId is set
      define(['jquery'], function (a0) {
        return (factory(a0));
      });
    } else if (typeof module === 'object' && module.exports) {
      // Node. Does not work with strict CommonJS, but
      // only CommonJS-like environments that support module.exports,
      // like Node.
      module.exports = factory(require('jquery'));
    } else {
      factory(root["jQuery"]);
    }
  }(this, function ($) {
  
  (function() {
      'use strict';
  
      var defaults = {
  
          mode: 'lg-slide',
  
          // Ex : 'ease'
          cssEasing: 'ease',
  
          //'for jquery animation'
          easing: 'linear',
          speed: 600,
          height: '100%',
          width: '100%',
          addClass: '',
          startClass: 'lg-start-zoom',
          backdropDuration: 150,
          hideBarsDelay: 6000,
  
          useLeft: false,
  
          // aria-labelledby attribute fot gallery
          ariaLabelledby: '',
          
          //aria-describedby attribute for gallery
          ariaDescribedby: '',
  
          closable: true,
          loop: true,
          escKey: true,
          keyPress: true,
          controls: true,
          slideEndAnimatoin: true,
          hideControlOnEnd: false,
          mousewheel: true,
  
          getCaptionFromTitleOrAlt: true,
  
          // .lg-item || '.lg-sub-html'
          appendSubHtmlTo: '.lg-sub-html',
  
          subHtmlSelectorRelative: false,
  
          /**
           * @desc number of preload slides
           * will exicute only after the current slide is fully loaded.
           *
           * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th
           * slide will be loaded in the background after the 4th slide is fully loaded..
           * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ...
           *
           */
          preload: 1,
          showAfterLoad: true,
          selector: '',
          selectWithin: '',
          nextHtml: '',
          prevHtml: '',
  
          // 0, 1
          index: false,
  
          iframeMaxWidth: '100%',
  
          download: true,
          counter: true,
          appendCounterTo: '.lg-toolbar',
  
          swipeThreshold: 50,
          enableSwipe: true,
          enableDrag: true,
  
          dynamic: false,
          dynamicEl: [],
          galleryId: 1
      };
  
      function Plugin(element, options) {
  
          // Current lightGallery element
          this.el = element;
  
          // Current jquery element
          this.$el = $(element);
  
          // lightGallery settings
          this.s = $.extend({}, defaults, options);
  
          // When using dynamic mode, ensure dynamicEl is an array
          if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) {
              throw ('When using dynamic mode, you must also define dynamicEl as an Array.');
          }
  
          // lightGallery modules
          this.modules = {};
  
          // false when lightgallery complete first slide;
          this.lGalleryOn = false;
  
          this.lgBusy = false;
  
          // Timeout function for hiding controls;
          this.hideBartimeout = false;
  
          // To determine browser supports for touch events;
          this.isTouch = ('ontouchstart' in document.documentElement);
  
          // Disable hideControlOnEnd if sildeEndAnimation is true
          if (this.s.slideEndAnimatoin) {
              this.s.hideControlOnEnd = false;
          }
  
          // Gallery items
          if (this.s.dynamic) {
              this.$items = this.s.dynamicEl;
          } else {
              if (this.s.selector === 'this') {
                  this.$items = this.$el;
              } else if (this.s.selector !== '') {
                  if (this.s.selectWithin) {
                      this.$items = $(this.s.selectWithin).find(this.s.selector);
                  } else {
                      this.$items = this.$el.find($(this.s.selector));
                  }
              } else {
                  this.$items = this.$el.children();
              }
          }
  
          // .lg-item
          this.$slide = '';
  
          // .lg-outer
          this.$outer = '';
  
          this.init();
  
          return this;
      }
  
      Plugin.prototype.init = function() {
  
          var _this = this;
  
          // s.preload should not be more than $item.length
          if (_this.s.preload > _this.$items.length) {
              _this.s.preload = _this.$items.length;
          }
  
          // if dynamic option is enabled execute immediately
          var _hash = window.location.hash;
          if (_hash.indexOf('lg=' + this.s.galleryId) > 0) {
  
              _this.index = parseInt(_hash.split('&slide=')[1], 10);
  
              $('body').addClass('lg-from-hash');
              if (!$('body').hasClass('lg-on')) {
                  setTimeout(function() {
                      _this.build(_this.index);
                  });
  
                  $('body').addClass('lg-on');
              }
          }
  
          if (_this.s.dynamic) {
  
              _this.$el.trigger('onBeforeOpen.lg');
  
              _this.index = _this.s.index || 0;
  
              // prevent accidental double execution
              if (!$('body').hasClass('lg-on')) {
                  setTimeout(function() {
                      _this.build(_this.index);
                      $('body').addClass('lg-on');
                  });
              }
          } else {
  
              // Using different namespace for click because click event should not unbind if selector is same object('this')
              _this.$items.on('click.lgcustom', function(event) {
  
                  // For IE8
                  try {
                      event.preventDefault();
                      event.preventDefault();
                  } catch (er) {
                      event.returnValue = false;
                  }
  
                  _this.$el.trigger('onBeforeOpen.lg');
  
                  _this.index = _this.s.index || _this.$items.index(this);
  
                  // prevent accidental double execution
                  if (!$('body').hasClass('lg-on')) {
                      _this.build(_this.index);
                      $('body').addClass('lg-on');
                  }
              });
          }
  
      };
  
      Plugin.prototype.build = function(index) {
  
          var _this = this;
  
          _this.structure();
  
          // module constructor
          $.each($.fn.lightGallery.modules, function(key) {
              _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el);
          });
  
          // initiate slide function
          _this.slide(index, false, false, false);
  
          if (_this.s.keyPress) {
              _this.keyPress();
          }
  
          if (_this.$items.length > 1) {
  
              _this.arrow();
  
              setTimeout(function() {
                  _this.enableDrag();
                  _this.enableSwipe();
              }, 50);
  
              if (_this.s.mousewheel) {
                  _this.mousewheel();
              }
          } else {
              _this.$slide.on('click.lg', function() {
                  _this.$el.trigger('onSlideClick.lg');
              });
          }
  
          _this.counter();
  
          _this.closeGallery();
  
          _this.$el.trigger('onAfterOpen.lg');
  
          // Hide controllers if mouse doesn't move for some period
          _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() {
  
              _this.$outer.removeClass('lg-hide-items');
  
              clearTimeout(_this.hideBartimeout);
  
              // Timeout will be cleared on each slide movement also
              _this.hideBartimeout = setTimeout(function() {
                  _this.$outer.addClass('lg-hide-items');
              }, _this.s.hideBarsDelay);
  
          });
  
          _this.$outer.trigger('mousemove.lg');
  
      };
  
      Plugin.prototype.structure = function() {
          var list = '';
          var controls = '';
          var i = 0;
          var subHtmlCont = '';
          var template;
          var _this = this;
  
          $('body').append('<div class="lg-backdrop"></div>');
          $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms');
  
          // Create gallery items
          for (i = 0; i < this.$items.length; i++) {
              list += '<div class="lg-item"></div>';
          }
  
          // Create controlls
          if (this.s.controls && this.$items.length > 1) {
              controls = '<div class="lg-actions">' +
                  '<button type="button" aria-label="Previous slide" class="lg-prev lg-icon">' + this.s.prevHtml + '</button>' +
                  '<button type="button" aria-label="Next slide" class="lg-next lg-icon">' + this.s.nextHtml + '</button>' +
                  '</div>';
          }
  
          if (this.s.appendSubHtmlTo === '.lg-sub-html') {
              subHtmlCont = '<div role="status" aria-live="polite" class="lg-sub-html"></div>';
          }
  
          var ariaLabelledby = this.s.ariaLabelledby ?
              'aria-labelledby="' + this.s.ariaLabelledby + '"' : '';
          var ariaDescribedby = this.s.ariaDescribedby ?
              'aria-describedby="' + this.s.ariaDescribedby + '"' : '';
  
          template = '<div tabindex="-1" aria-modal="true" ' + ariaLabelledby + ' ' + ariaDescribedby + ' role="dialog" class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' +
              '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' +
              '<div class="lg-inner">' + list + '</div>' +
              '<div class="lg-toolbar lg-group">' +
              '<button type="button" aria-label="Close gallery" class="lg-close lg-icon"></button>' +
              '</div>' +
              controls +
              subHtmlCont +
              '</div>' +
              '</div>';
  
          $('body').append(template);
          this.$outer = $('.lg-outer');
          this.$outer.focus();
          this.$slide = this.$outer.find('.lg-item');
  
          if (this.s.useLeft) {
              this.$outer.addClass('lg-use-left');
  
              // Set mode lg-slide if use left is true;
              this.s.mode = 'lg-slide';
          } else {
              this.$outer.addClass('lg-use-css3');
          }
  
          // For fixed height gallery
          _this.setTop();
          $(window).on('resize.lg orientationchange.lg', function() {
              setTimeout(function() {
                  _this.setTop();
              }, 100);
          });
  
          // add class lg-current to remove initial transition
          this.$slide.eq(this.index).addClass('lg-current');
  
          // add Class for css support and transition mode
          if (this.doCss()) {
              this.$outer.addClass('lg-css3');
          } else {
              this.$outer.addClass('lg-css');
  
              // Set speed 0 because no animation will happen if browser doesn't support css3
              this.s.speed = 0;
          }
  
          this.$outer.addClass(this.s.mode);
  
          if (this.s.enableDrag && this.$items.length > 1) {
              this.$outer.addClass('lg-grab');
          }
  
          if (this.s.showAfterLoad) {
              this.$outer.addClass('lg-show-after-load');
          }
  
          if (this.doCss()) {
              var $inner = this.$outer.find('.lg-inner');
              $inner.css('transition-timing-function', this.s.cssEasing);
              $inner.css('transition-duration', this.s.speed + 'ms');
          }
  
          setTimeout(function() {
              $('.lg-backdrop').addClass('in');
          });
  
          setTimeout(function() {
              _this.$outer.addClass('lg-visible');
          }, this.s.backdropDuration);
  
          if (this.s.download) {
              this.$outer.find('.lg-toolbar').append('<a id="lg-download" aria-label="Download" target="_blank" download class="lg-download lg-icon"></a>');
          }
  
          // Store the current scroll top value to scroll back after closing the gallery..
          this.prevScrollTop = $(window).scrollTop();
  
      };
  
      // For fixed height gallery
      Plugin.prototype.setTop = function() {
          if (this.s.height !== '100%') {
              var wH = $(window).height();
              var top = (wH - parseInt(this.s.height, 10)) / 2;
              var $lGallery = this.$outer.find('.lg');
              if (wH >= parseInt(this.s.height, 10)) {
                  $lGallery.css('top', top + 'px');
              } else {
                  $lGallery.css('top', '0px');
              }
          }
      };
  
      // Find css3 support
      Plugin.prototype.doCss = function() {
          // check for css animation support
          var support = function() {
              var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
              var root = document.documentElement;
              var i = 0;
              for (i = 0; i < transition.length; i++) {
                  if (transition[i] in root.style) {
                      return true;
                  }
              }
          };
  
          if (support()) {
              return true;
          }
  
          return false;
      };
  
      /**
       *  @desc Check the given src is video
       *  @param {String} src
       *  @return {Object} video type
       *  Ex:{ youtube  :  ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
       */
      Plugin.prototype.isVideo = function(src, index) {
  
          var html;
          if (this.s.dynamic) {
              html = this.s.dynamicEl[index].html;
          } else {
              html = this.$items.eq(index).attr('data-html');
          }
  
          if (!src) {
              if (html) {
                  return {
                      html5: true
                  };
              } else {
                  console.error('lightGallery :- data-src is not provided on slide item ' + (index + 1) + '. Please make sure the selector property is properly configured. More info - http://sachinchoolur.github.io/lightGallery/demos/html-markup.html');
                  return false;
              }
          }
  
          var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i);
          var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);
          var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i);
          var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);
  
          if (youtube) {
              return {
                  youtube: youtube
              };
          } else if (vimeo) {
              return {
                  vimeo: vimeo
              };
          } else if (dailymotion) {
              return {
                  dailymotion: dailymotion
              };
          } else if (vk) {
              return {
                  vk: vk
              };
          }
      };
  
      /**
       *  @desc Create image counter
       *  Ex: 1/10
       */
      Plugin.prototype.counter = function() {
          if (this.s.counter) {
              $(this.s.appendCounterTo).append('<div id="lg-counter" role="status" aria-live="polite"><span id="lg-counter-current">' + (parseInt(this.index, 10) + 1) + '</span> / <span id="lg-counter-all">' + this.$items.length + '</span></div>');
          }
      };
  
      /**
       *  @desc add sub-html into the slide
       *  @param {Number} index - index of the slide
       */
      Plugin.prototype.addHtml = function(index) {
          var subHtml = null;
          var subHtmlUrl;
          var $currentEle;
          if (this.s.dynamic) {
              if (this.s.dynamicEl[index].subHtmlUrl) {
                  subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl;
              } else {
                  subHtml = this.s.dynamicEl[index].subHtml;
              }
          } else {
              $currentEle = this.$items.eq(index);
              if ($currentEle.attr('data-sub-html-url')) {
                  subHtmlUrl = $currentEle.attr('data-sub-html-url');
              } else {
                  subHtml = $currentEle.attr('data-sub-html');
                  if (this.s.getCaptionFromTitleOrAlt && !subHtml) {
                      subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt');
                  }
              }
          }
  
          if (!subHtmlUrl) {
              if (typeof subHtml !== 'undefined' && subHtml !== null) {
  
                  // get first letter of subhtml
                  // if first letter starts with . or # get the html form the jQuery object
                  var fL = subHtml.substring(0, 1);
                  if (fL === '.' || fL === '#') {
                      if (this.s.subHtmlSelectorRelative && !this.s.dynamic) {
                          subHtml = $currentEle.find(subHtml).html();
                      } else {
                          subHtml = $(subHtml).html();
                      }
                  }
              } else {
                  subHtml = '';
              }
          }
  
          if (this.s.appendSubHtmlTo === '.lg-sub-html') {
  
              if (subHtmlUrl) {
                  this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl);
              } else {
                  this.$outer.find(this.s.appendSubHtmlTo).html(subHtml);
              }
  
          } else {
  
              if (subHtmlUrl) {
                  this.$slide.eq(index).load(subHtmlUrl);
              } else {
                  this.$slide.eq(index).append(subHtml);
              }
          }
  
          // Add lg-empty-html class if title doesn't exist
          if (typeof subHtml !== 'undefined' && subHtml !== null) {
              if (subHtml === '') {
                  this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html');
              } else {
                  this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html');
              }
          }
  
          this.$el.trigger('onAfterAppendSubHtml.lg', [index]);
      };
  
      /**
       *  @desc Preload slides
       *  @param {Number} index - index of the slide
       */
      Plugin.prototype.preload = function(index) {
          var i = 1;
          var j = 1;
          for (i = 1; i <= this.s.preload; i++) {
              if (i >= this.$items.length - index) {
                  break;
              }
  
              this.loadContent(index + i, false, 0);
          }
  
          for (j = 1; j <= this.s.preload; j++) {
              if (index - j < 0) {
                  break;
              }
  
              this.loadContent(index - j, false, 0);
          }
      };
  
      /**
       *  @desc Load slide content into slide.
       *  @param {Number} index - index of the slide.
       *  @param {Boolean} rec - if true call loadcontent() function again.
       *  @param {Boolean} delay - delay for adding complete class. it is 0 except first time.
       */
      Plugin.prototype.loadContent = function(index, rec, delay) {
  
          var _this = this;
          var _hasPoster = false;
          var _$img;
          var _src;
          var _poster;
          var _srcset;
          var _sizes;
          var _html;
          var _alt;
          var getResponsiveSrc = function(srcItms) {
              var rsWidth = [];
              var rsSrc = [];
              for (var i = 0; i < srcItms.length; i++) {
                  var __src = srcItms[i].split(' ');
  
                  // Manage empty space
                  if (__src[0] === '') {
                      __src.splice(0, 1);
                  }
  
                  rsSrc.push(__src[0]);
                  rsWidth.push(__src[1]);
              }
  
              var wWidth = $(window).width();
              for (var j = 0; j < rsWidth.length; j++) {
                  if (parseInt(rsWidth[j], 10) > wWidth) {
                      _src = rsSrc[j];
                      break;
                  }
              }
          };
  
          if (_this.s.dynamic) {
  
              if (_this.s.dynamicEl[index].poster) {
                  _hasPoster = true;
                  _poster = _this.s.dynamicEl[index].poster;
              }
  
              _html = _this.s.dynamicEl[index].html;
              _src = _this.s.dynamicEl[index].src;
              _alt = _this.s.dynamicEl[index].alt;
  
              if (_this.s.dynamicEl[index].responsive) {
                  var srcDyItms = _this.s.dynamicEl[index].responsive.split(',');
                  getResponsiveSrc(srcDyItms);
              }
  
              _srcset = _this.s.dynamicEl[index].srcset;
              _sizes = _this.s.dynamicEl[index].sizes;
  
          } else {
              var $currentEle = _this.$items.eq(index);
              if ($currentEle.attr('data-poster')) {
                  _hasPoster = true;
                  _poster = $currentEle.attr('data-poster');
              }
  
              _html = $currentEle.attr('data-html');
              _src = $currentEle.attr('href') || $currentEle.attr('data-src');
              _alt = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt');
  
              if ($currentEle.attr('data-responsive')) {
                  var srcItms = $currentEle.attr('data-responsive').split(',');
                  getResponsiveSrc(srcItms);
              }
  
              _srcset = $currentEle.attr('data-srcset');
              _sizes = $currentEle.attr('data-sizes');
  
          }
  
          //if (_src || _srcset || _sizes || _poster) {
  
          var iframe = false;
          if (_this.s.dynamic) {
              if (_this.s.dynamicEl[index].iframe) {
                  iframe = true;
              }
          } else {
              if (_this.$items.eq(index).attr('data-iframe') === 'true') {
                  iframe = true;
              }
          }
  
          var _isVideo = _this.isVideo(_src, index);
          if (!_this.$slide.eq(index).hasClass('lg-loaded')) {
              if (iframe) {
                  _this.$slide.eq(index).prepend('<div class="lg-video-cont lg-has-iframe" style="max-width:' + _this.s.iframeMaxWidth + '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + _src + '"  allowfullscreen="true"></iframe></div></div>');
              } else if (_hasPoster) {
                  var videoClass = '';
                  if (_isVideo && _isVideo.youtube) {
                      videoClass = 'lg-has-youtube';
                  } else if (_isVideo && _isVideo.vimeo) {
                      videoClass = 'lg-has-vimeo';
                  } else {
                      videoClass = 'lg-has-html5';
                  }
  
                  _this.$slide.eq(index).prepend('<div class="lg-video-cont ' + videoClass + ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + _poster + '" /></div></div>');
  
              } else if (_isVideo) {
                  _this.$slide.eq(index).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>');
                  _this.$el.trigger('hasVideo.lg', [index, _src, _html]);
              } else {
                  _alt = _alt ? 'alt="' + _alt + '"' : '';
                  _this.$slide.eq(index).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" ' + _alt + ' src="' + _src + '" /></div>');
              }
  
              _this.$el.trigger('onAferAppendSlide.lg', [index]);
  
              _$img = _this.$slide.eq(index).find('.lg-object');
              if (_sizes) {
                  _$img.attr('sizes', _sizes);
              }
  
              if (_srcset) {
                  _$img.attr('srcset', _srcset);
                  try {
                      picturefill({
                          elements: [_$img[0]]
                      });
                  } catch (e) {
                      console.warn('lightGallery :- If you want srcset to be supported for older browser please include picturefil version 2 javascript library in your document.');
                  }
              }
  
              if (this.s.appendSubHtmlTo !== '.lg-sub-html') {
                  _this.addHtml(index);
              }
  
              _this.$slide.eq(index).addClass('lg-loaded');
          }
  
          _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
  
              // For first time add some delay for displaying the start animation.
              var _speed = 0;
  
              // Do not change the delay value because it is required for zoom plugin.
              // If gallery opened from direct url (hash) speed value should be 0
              if (delay && !$('body').hasClass('lg-from-hash')) {
                  _speed = delay;
              }
  
              setTimeout(function() {
                  _this.$slide.eq(index).addClass('lg-complete');
                  _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]);
              }, _speed);
  
          });
  
          // @todo check load state for html5 videos
          if (_isVideo && _isVideo.html5 && !_hasPoster) {
              _this.$slide.eq(index).addClass('lg-complete');
          }
  
          if (rec === true) {
              if (!_this.$slide.eq(index).hasClass('lg-complete')) {
                  _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
                      _this.preload(index);
                  });
              } else {
                  _this.preload(index);
              }
          }
  
          //}
      };
  
      /**
      *   @desc slide function for lightgallery
          ** Slide() gets call on start
          ** ** Set lg.on true once slide() function gets called.
          ** Call loadContent() on slide() function inside setTimeout
          ** ** On first slide we do not want any animation like slide of fade
          ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately
          ** ** Else loadContent() should wait for the transition to complete.
          ** ** So set timeout s.speed + 50
      <=> ** loadContent() will load slide content in to the particular slide
          ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function.
          ** ** preload will execute only when the previous slide is fully loaded (images iframe)
          ** ** avoid simultaneous image load
      <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value
          ** loadContent()  <====> Preload();
  
      *   @param {Number} index - index of the slide
      *   @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
      *   @param {Boolean} fromThumb - true if slide function called via thumbnail click
      *   @param {String} direction - Direction of the slide(next/prev)
      */
      Plugin.prototype.slide = function(index, fromTouch, fromThumb, direction) {
  
          var _prevIndex = this.$outer.find('.lg-current').index();
          var _this = this;
  
          // Prevent if multiple call
          // Required for hsh plugin
          if (_this.lGalleryOn && (_prevIndex === index)) {
              return;
          }
  
          var _length = this.$slide.length;
          var _time = _this.lGalleryOn ? this.s.speed : 0;
  
          if (!_this.lgBusy) {
  
              if (this.s.download) {
                  var _src;
                  if (_this.s.dynamic) {
                      _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src);
                  } else {
                      _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'));
  
                  }
  
                  if (_src) {
                      $('#lg-download').attr('href', _src);
                      _this.$outer.removeClass('lg-hide-download');
                  } else {
                      _this.$outer.addClass('lg-hide-download');
                  }
              }
  
              this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
  
              _this.lgBusy = true;
  
              clearTimeout(_this.hideBartimeout);
  
              // Add title if this.s.appendSubHtmlTo === lg-sub-html
              if (this.s.appendSubHtmlTo === '.lg-sub-html') {
  
                  // wait for slide animation to complete
                  setTimeout(function() {
                      _this.addHtml(index);
                  }, _time);
              }
  
              this.arrowDisable(index);
  
              if (!direction) {
                  if (index < _prevIndex) {
                      direction = 'prev';
                  } else if (index > _prevIndex) {
                      direction = 'next';
                  }
              }
  
              if (!fromTouch) {
  
                  // remove all transitions
                  _this.$outer.addClass('lg-no-trans');
  
                  this.$slide.removeClass('lg-prev-slide lg-next-slide');
  
                  if (direction === 'prev') {
  
                      //prevslide
                      this.$slide.eq(index).addClass('lg-prev-slide');
                      this.$slide.eq(_prevIndex).addClass('lg-next-slide');
                  } else {
  
                      // next slide
                      this.$slide.eq(index).addClass('lg-next-slide');
                      this.$slide.eq(_prevIndex).addClass('lg-prev-slide');
                  }
  
                  // give 50 ms for browser to add/remove class
                  setTimeout(function() {
                      _this.$slide.removeClass('lg-current');
  
                      //_this.$slide.eq(_prevIndex).removeClass('lg-current');
                      _this.$slide.eq(index).addClass('lg-current');
  
                      // reset all transitions
                      _this.$outer.removeClass('lg-no-trans');
                  }, 50);
              } else {
  
                  this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide');
                  var touchPrev;
                  var touchNext;
                  if (_length > 2) {
                      touchPrev = index - 1;
                      touchNext = index + 1;
  
                      if ((index === 0) && (_prevIndex === _length - 1)) {
  
                          // next slide
                          touchNext = 0;
                          touchPrev = _length - 1;
                      } else if ((index === _length - 1) && (_prevIndex === 0)) {
  
                          // prev slide
                          touchNext = 0;
                          touchPrev = _length - 1;
                      }
  
                  } else {
                      touchPrev = 0;
                      touchNext = 1;
                  }
  
                  if (direction === 'prev') {
                      _this.$slide.eq(touchNext).addClass('lg-next-slide');
                  } else {
                      _this.$slide.eq(touchPrev).addClass('lg-prev-slide');
                  }
  
                  _this.$slide.eq(index).addClass('lg-current');
              }
  
              if (_this.lGalleryOn) {
                  setTimeout(function() {
                      _this.loadContent(index, true, 0);
                  }, this.s.speed + 50);
  
                  setTimeout(function() {
                      _this.lgBusy = false;
                      _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
                  }, this.s.speed);
  
              } else {
                  _this.loadContent(index, true, _this.s.backdropDuration);
  
                  _this.lgBusy = false;
                  _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
              }
  
              _this.lGalleryOn = true;
  
              if (this.s.counter) {
                  $('#lg-counter-current').text(index + 1);
              }
  
          }
          _this.index = index;
  
      };
  
      /**
       *  @desc Go to next slide
       *  @param {Boolean} fromTouch - true if slide function called via touch event
       */
      Plugin.prototype.goToNextSlide = function(fromTouch) {
          var _this = this;
          var _loop = _this.s.loop;
          if (fromTouch && _this.$slide.length < 3) {
              _loop = false;
          }
  
          if (!_this.lgBusy) {
              if ((_this.index + 1) < _this.$slide.length) {
                  _this.index++;
                  _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
                  _this.slide(_this.index, fromTouch, false, 'next');
              } else {
                  if (_loop) {
                      _this.index = 0;
                      _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
                      _this.slide(_this.index, fromTouch, false, 'next');
                  } else if (_this.s.slideEndAnimatoin && !fromTouch) {
                      _this.$outer.addClass('lg-right-end');
                      setTimeout(function() {
                          _this.$outer.removeClass('lg-right-end');
                      }, 400);
                  }
              }
          }
      };
  
      /**
       *  @desc Go to previous slide
       *  @param {Boolean} fromTouch - true if slide function called via touch event
       */
      Plugin.prototype.goToPrevSlide = function(fromTouch) {
          var _this = this;
          var _loop = _this.s.loop;
          if (fromTouch && _this.$slide.length < 3) {
              _loop = false;
          }
  
          if (!_this.lgBusy) {
              if (_this.index > 0) {
                  _this.index--;
                  _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
                  _this.slide(_this.index, fromTouch, false, 'prev');
              } else {
                  if (_loop) {
                      _this.index = _this.$items.length - 1;
                      _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
                      _this.slide(_this.index, fromTouch, false, 'prev');
                  } else if (_this.s.slideEndAnimatoin && !fromTouch) {
                      _this.$outer.addClass('lg-left-end');
                      setTimeout(function() {
                          _this.$outer.removeClass('lg-left-end');
                      }, 400);
                  }
              }
          }
      };
  
      Plugin.prototype.keyPress = function() {
          var _this = this;
          if (this.$items.length > 1) {
              $(window).on('keyup.lg', function(e) {
                  if (_this.$items.length > 1) {
                      if (e.keyCode === 37) {
                          e.preventDefault();
                          _this.goToPrevSlide();
                      }
  
                      if (e.keyCode === 39) {
                          e.preventDefault();
                          _this.goToNextSlide();
                      }
                  }
              });
          }
  
          $(window).on('keydown.lg', function(e) {
              if (_this.s.escKey === true && e.keyCode === 27) {
                  e.preventDefault();
                  if (!_this.$outer.hasClass('lg-thumb-open')) {
                      _this.destroy();
                  } else {
                      _this.$outer.removeClass('lg-thumb-open');
                  }
              }
          });
      };
  
      Plugin.prototype.arrow = function() {
          var _this = this;
          this.$outer.find('.lg-prev').on('click.lg', function() {
              _this.goToPrevSlide();
          });
  
          this.$outer.find('.lg-next').on('click.lg', function() {
              _this.goToNextSlide();
          });
      };
  
      Plugin.prototype.arrowDisable = function(index) {
  
          // Disable arrows if s.hideControlOnEnd is true
          if (!this.s.loop && this.s.hideControlOnEnd) {
              if ((index + 1) < this.$slide.length) {
                  this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled');
              } else {
                  this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled');
              }
  
              if (index > 0) {
                  this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled');
              } else {
                  this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled');
              }
          }
      };
  
      Plugin.prototype.setTranslate = function($el, xValue, yValue) {
          // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
          if (this.s.useLeft) {
              $el.css('left', xValue);
          } else {
              $el.css({
                  transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)'
              });
          }
      };
  
      Plugin.prototype.touchMove = function(startCoords, endCoords) {
  
          var distance = endCoords - startCoords;
  
          if (Math.abs(distance) > 15) {
              // reset opacity and transition duration
              this.$outer.addClass('lg-dragging');
  
              // move current slide
              this.setTranslate(this.$slide.eq(this.index), distance, 0);
  
              // move next and prev slide with current slide
              this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0);
              this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0);
          }
      };
  
      Plugin.prototype.touchEnd = function(distance) {
          var _this = this;
  
          // keep slide animation for any mode while dragg/swipe
          if (_this.s.mode !== 'lg-slide') {
              _this.$outer.addClass('lg-slide');
          }
  
          this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0');
  
          // set transition duration
          setTimeout(function() {
              _this.$outer.removeClass('lg-dragging');
              if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
                  _this.goToNextSlide(true);
              } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
                  _this.goToPrevSlide(true);
              } else if (Math.abs(distance) < 5) {
  
                  // Trigger click if distance is less than 5 pix
                  _this.$el.trigger('onSlideClick.lg');
              }
  
              _this.$slide.removeAttr('style');
          });
  
          // remove slide class once drag/swipe is completed if mode is not slide
          setTimeout(function() {
              if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') {
                  _this.$outer.removeClass('lg-slide');
              }
          }, _this.s.speed + 100);
  
      };
  
      Plugin.prototype.enableSwipe = function() {
          var _this = this;
          var startCoords = 0;
          var endCoords = 0;
          var isMoved = false;
  
          if (_this.s.enableSwipe && _this.doCss()) {
  
              _this.$slide.on('touchstart.lg', function(e) {
                  if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) {
                      e.preventDefault();
                      _this.manageSwipeClass();
                      startCoords = e.originalEvent.targetTouches[0].pageX;
                  }
              });
  
              _this.$slide.on('touchmove.lg', function(e) {
                  if (!_this.$outer.hasClass('lg-zoomed')) {
                      e.preventDefault();
                      endCoords = e.originalEvent.targetTouches[0].pageX;
                      _this.touchMove(startCoords, endCoords);
                      isMoved = true;
                  }
              });
  
              _this.$slide.on('touchend.lg', function() {
                  if (!_this.$outer.hasClass('lg-zoomed')) {
                      if (isMoved) {
                          isMoved = false;
                          _this.touchEnd(endCoords - startCoords);
                      } else {
                          _this.$el.trigger('onSlideClick.lg');
                      }
                  }
              });
          }
  
      };
  
      Plugin.prototype.enableDrag = function() {
          var _this = this;
          var startCoords = 0;
          var endCoords = 0;
          var isDraging = false;
          var isMoved = false;
          if (_this.s.enableDrag && _this.doCss()) {
              _this.$slide.on('mousedown.lg', function(e) {
                  if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy && !$(e.target).text().trim()) {
                      e.preventDefault();
                      _this.manageSwipeClass();
                      startCoords = e.pageX;
                      isDraging = true;
  
                      // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
                      _this.$outer.scrollLeft += 1;
                      _this.$outer.scrollLeft -= 1;
  
                      // *
  
                      _this.$outer.removeClass('lg-grab').addClass('lg-grabbing');
  
                      _this.$el.trigger('onDragstart.lg');
                  }
              });
  
              $(window).on('mousemove.lg', function(e) {
                  if (isDraging) {
                      isMoved = true;
                      endCoords = e.pageX;
                      _this.touchMove(startCoords, endCoords);
                      _this.$el.trigger('onDragmove.lg');
                  }
              });
  
              $(window).on('mouseup.lg', function(e) {
                  if (isMoved) {
                      isMoved = false;
                      _this.touchEnd(endCoords - startCoords);
                      _this.$el.trigger('onDragend.lg');
                  } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
                      _this.$el.trigger('onSlideClick.lg');
                  }
  
                  // Prevent execution on click
                  if (isDraging) {
                      isDraging = false;
                      _this.$outer.removeClass('lg-grabbing').addClass('lg-grab');
                  }
              });
  
          }
      };
  
      Plugin.prototype.manageSwipeClass = function() {
          var _touchNext = this.index + 1;
          var _touchPrev = this.index - 1;
          if (this.s.loop && this.$slide.length > 2) {
              if (this.index === 0) {
                  _touchPrev = this.$slide.length - 1;
              } else if (this.index === this.$slide.length - 1) {
                  _touchNext = 0;
              }
          }
  
          this.$slide.removeClass('lg-next-slide lg-prev-slide');
          if (_touchPrev > -1) {
              this.$slide.eq(_touchPrev).addClass('lg-prev-slide');
          }
  
          this.$slide.eq(_touchNext).addClass('lg-next-slide');
      };
  
      Plugin.prototype.mousewheel = function() {
          var _this = this;
          _this.$outer.on('mousewheel.lg', function(e) {
  
              if (!e.deltaY) {
                  return;
              }
  
              if (e.deltaY > 0) {
                  _this.goToPrevSlide();
              } else {
                  _this.goToNextSlide();
              }
  
              e.preventDefault();
          });
  
      };
  
      Plugin.prototype.closeGallery = function() {
  
          var _this = this;
          var mousedown = false;
          this.$outer.find('.lg-close').on('click.lg', function() {
              _this.destroy();
          });
  
          if (_this.s.closable) {
  
              // If you drag the slide and release outside gallery gets close on chrome
              // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
              _this.$outer.on('mousedown.lg', function(e) {
  
                  if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) {
                      mousedown = true;
                  } else {
                      mousedown = false;
                  }
  
              });
  
              _this.$outer.on('mousemove.lg', function() {
                  mousedown = false;
              });
  
              _this.$outer.on('mouseup.lg', function(e) {
  
                  if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) {
                      if (!_this.$outer.hasClass('lg-dragging')) {
                          _this.destroy();
                      }
                  }
  
              });
  
          }
  
      };
  
      Plugin.prototype.destroy = function(d) {
  
          var _this = this;
  
          if (!d) {
              _this.$el.trigger('onBeforeClose.lg');
              $(window).scrollTop(_this.prevScrollTop);
          }
  
  
          /**
           * if d is false or undefined destroy will only close the gallery
           * plugins instance remains with the element
           *
           * if d is true destroy will completely remove the plugin
           */
  
          if (d) {
              if (!_this.s.dynamic) {
                  // only when not using dynamic mode is $items a jquery collection
                  this.$items.off('click.lg click.lgcustom');
              }
  
              $.removeData(_this.el, 'lightGallery');
          }
  
          // Unbind all events added by lightGallery
          this.$el.off('.lg.tm');
  
          // destroy all lightGallery modules
          $.each($.fn.lightGallery.modules, function(key) {
              if (_this.modules[key]) {
                  _this.modules[key].destroy();
              }
          });
  
          this.lGalleryOn = false;
  
          clearTimeout(_this.hideBartimeout);
          this.hideBartimeout = false;
          $(window).off('.lg');
          $('body').removeClass('lg-on lg-from-hash');
  
          if (_this.$outer) {
              _this.$outer.removeClass('lg-visible');
          }
  
          $('.lg-backdrop').removeClass('in');
  
          setTimeout(function() {
              if (_this.$outer) {
                  _this.$outer.remove();
              }
  
              $('.lg-backdrop').remove();
  
              if (!d) {
                  _this.$el.trigger('onCloseAfter.lg');
              }
              _this.$el.focus();
  
          }, _this.s.backdropDuration + 50);
      };
  
      $.fn.lightGallery = function(options) {
          return this.each(function() {
              if (!$.data(this, 'lightGallery')) {
                  $.data(this, 'lightGallery', new Plugin(this, options));
              } else {
                  try {
                      $(this).data('lightGallery').init();
                  } catch (err) {
                      console.error('lightGallery has not initiated properly');
                  }
              }
          });
      };
  
      $.fn.lightGallery.modules = {};
  
  })();
  
  
  }));
  
/*! lg-rotate - v1.2.1-beta.0 - 2020-10-05
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module unless amdModuleId is set
    define(['jquery'], function (a0) {
      return (factory(a0));
    });
  } else if (typeof module === 'object' && module.exports) {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory(require('jquery'));
  } else {
    factory(root["jQuery"]);
  }
}(this, function ($) {

(function () {
    'use strict';

    var defaults = {
        rotate: true,
        rotateLeft: true,
        rotateRight: true,
        flipHorizontal: true,
        flipVertical: true,
    };

    var Rotate = function (element) {
        this.core = $(element).data('lightGallery');

        this.core.s = $.extend({}, defaults, this.core.s);

        if (this.core.s.rotate && this.core.doCss()) {
            this.init();
        }

        return this;
    };

    Rotate.prototype.buildTemplates = function () {
        var rotateIcons = '';
        if (this.core.s.flipVertical) {
            rotateIcons += '<button aria-label="Flip vertical" class="lg-flip-ver lg-icon"></button>';
        }
        if (this.core.s.flipHorizontal) {
            rotateIcons += '<button aria-label="flip horizontal" class="lg-flip-hor lg-icon"></button>';
        }
        if (this.core.s.rotateLeft) {
            rotateIcons += '<button aria-label="Rotate left" class="lg-rotate-left lg-icon"></button>';
        }
        if (this.core.s.rotateRight) {
            rotateIcons += '<button aria-label="Rotate right" class="lg-rotate-right lg-icon"></button>';
        }
        this.core.$outer.find('.lg-toolbar').append(rotateIcons);
    };

    Rotate.prototype.init = function () {
        var _this = this;
        this.buildTemplates();

        // Save rotate config for each item to persist its rotate, flip values
        // even after navigating to diferent slides
        this.rotateValuesList = {};


        // event triggered after appending slide content
        this.core.$el.on('onAferAppendSlide.lg.tm.rotate', function (event, index) {
            // Get the current element
            var $imageWrap = _this.core.$slide.eq(index).find('.lg-img-wrap');
            $imageWrap.wrap('<div class="lg-img-rotate"></div>');
        });

        this.core.$outer
            .find('.lg-rotate-left')
            .on('click.lg', this.rotateLeft.bind(this));

        this.core.$outer
            .find('.lg-rotate-right')
            .on('click.lg', this.rotateRight.bind(this));
        this.core.$outer
            .find('.lg-flip-hor')
            .on('click.lg', this.flipHorizontal.bind(this));

        this.core.$outer
            .find('.lg-flip-ver')
            .on('click.lg', this.flipVertical.bind(this));

        // Reset rotate on slide change
        this.core.$el.on('onBeforeSlide.lg.tm.rotate', function (event, prevIndex, index) {
            if (!_this.rotateValuesList[index]) {
                _this.rotateValuesList[index] = {
                    rotate: 0,
                    flipHorizontal: 1,
                    flipVertical: 1,
                };
            }
        });
    };

    Rotate.prototype.applyStyles = function () {
        var $image = this.core.$slide.eq(this.core.index).find('.lg-img-rotate');
        $image.css(
            'transform',
            'rotate(' + this.rotateValuesList[this.core.index].rotate + 'deg)' +
            ' scale3d(' + this.rotateValuesList[this.core.index].flipHorizontal +
            ', ' + this.rotateValuesList[this.core.index].flipVertical + ', 1)'
        );
    };

    Rotate.prototype.getCurrentRotation = function (el) {
        if (!el) {
            return 0;
        }
        var st = window.getComputedStyle(el, null);
        var tm = st.getPropertyValue('-webkit-transform') ||
            st.getPropertyValue('-moz-transform') ||
            st.getPropertyValue('-ms-transform') ||
            st.getPropertyValue('-o-transform') ||
            st.getPropertyValue('transform') ||
            'none';
        if (tm !== 'none') {
            var values = tm.split('(')[1].split(')')[0].split(',');
            if (values) {
                var angle = Math.round(Math.atan2(values[1], values[0]) * (180 / Math.PI));
                return (angle < 0 ? angle + 360 : angle);
            }
        }
        return 0;
    };

    Rotate.prototype.rotateLeft = function () {
        this.rotateValuesList[this.core.index].rotate -= 90;
        this.applyStyles();
    };

    Rotate.prototype.rotateRight = function () {
        this.rotateValuesList[this.core.index].rotate += 90;
        this.applyStyles();
    };

    Rotate.prototype.flipHorizontal = function () {
        var $image = this.core.$slide.eq(this.core.index).find('.lg-img-rotate')[0];
        var currentRotation = this.getCurrentRotation($image);
        var rotateAxis = 'flipHorizontal';
        if (currentRotation === 90 || currentRotation === 270) {
            rotateAxis = 'flipVertical';
        }
        this.rotateValuesList[this.core.index][rotateAxis] *= -1;
        this.applyStyles();
    };

    Rotate.prototype.flipVertical = function () {
        var $image = this.core.$slide.eq(this.core.index).find('.lg-img-rotate')[0];
        var currentRotation = this.getCurrentRotation($image);
        var rotateAxis = 'flipVertical';
        if (currentRotation === 90 || currentRotation === 270) {
            rotateAxis = 'flipHorizontal';
        }
        this.rotateValuesList[this.core.index][rotateAxis] *= -1;
        this.applyStyles();
    };

    Rotate.prototype.destroy = function () {
        // Unbind all events added by lightGallery rotate plugin
        this.core.$el.off('.lg.tm.rotate');
        this.rotateValuesList = {};
    };

    $.fn.lightGallery.modules.rotate = Rotate;
})();


}));

/*! lg-pager - v1.0.2 - 2017-01-22
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2017 Sachin N; Licensed GPLv3 */

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module unless amdModuleId is set
    define(['jquery'], function (a0) {
      return (factory(a0));
    });
  } else if (typeof exports === 'object') {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory(require('jquery'));
  } else {
    factory(jQuery);
  }
}(this, function ($) {

(function() {

    'use strict';

    var defaults = {
        pager: false
    };

    var Pager = function(element) {

        this.core = $(element).data('lightGallery');

        this.$el = $(element);
        this.core.s = $.extend({}, defaults, this.core.s);
        if (this.core.s.pager && this.core.$items.length > 1) {
            this.init();
        }

        return this;
    };

    Pager.prototype.init = function() {
        var _this = this;
        var pagerList = '';
        var $pagerCont;
        var $pagerOuter;
        var timeout;

        _this.core.$outer.find('.lg').append('<div class="lg-pager-outer"></div>');

        if (_this.core.s.dynamic) {
            for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
                pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.s.dynamicEl[i].thumb + '" /></div></span>';
            }
        } else {
            _this.core.$items.each(function() {

                if (!_this.core.s.exThumbImage) {
                    pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).find('img').attr('src') + '" /></div></span>';
                } else {
                    pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).attr(_this.core.s.exThumbImage) + '" /></div></span>';
                }

            });
        }

        $pagerOuter = _this.core.$outer.find('.lg-pager-outer');

        $pagerOuter.html(pagerList);

        $pagerCont = _this.core.$outer.find('.lg-pager-cont');
        $pagerCont.on('click.lg touchend.lg', function() {
            var _$this = $(this);
            _this.core.index = _$this.index();
            _this.core.slide(_this.core.index, false, true, false);
        });

        $pagerOuter.on('mouseover.lg', function() {
            clearTimeout(timeout);
            $pagerOuter.addClass('lg-pager-hover');
        });

        $pagerOuter.on('mouseout.lg', function() {
            timeout = setTimeout(function() {
                $pagerOuter.removeClass('lg-pager-hover');
            });
        });

        _this.core.$el.on('onBeforeSlide.lg.tm', function(e, prevIndex, index) {
            $pagerCont.removeClass('lg-pager-active');
            $pagerCont.eq(index).addClass('lg-pager-active');
        });

    };

    Pager.prototype.destroy = function() {

    };

    $.fn.lightGallery.modules.pager = Pager;

})();


}));

/*! lg-thumbnail - v1.2.0 - 2020-05-03
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */

(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
      // AMD. Register as an anonymous module unless amdModuleId is set
      define(['jquery'], function (a0) {
        return (factory(a0));
      });
    } else if (typeof module === 'object' && module.exports) {
      // Node. Does not work with strict CommonJS, but
      // only CommonJS-like environments that support module.exports,
      // like Node.
      module.exports = factory(require('jquery'));
    } else {
      factory(root["jQuery"]);
    }
  }(this, function ($) {
  
  (function() {
  
      'use strict';
  
      var defaults = {
          thumbnail: true,
  
          animateThumb: true,
          currentPagerPosition: 'middle',
  
          thumbWidth: 100,
          thumbHeight: '80px',
          thumbContHeight: 100,
          thumbMargin: 5,
  
          exThumbImage: 'data-src',
          showThumbByDefault: true,
          toogleThumb: true,
          pullCaptionUp: true,
  
          enableThumbDrag: true,
          enableThumbSwipe: true,
          swipeThreshold: 50,
  
          loadYoutubeThumbnail: true,
          youtubeThumbSize: 1,
  
          loadVimeoThumbnail: true,
          vimeoThumbSize: 'thumbnail_small',
  
          loadDailymotionThumbnail: true
      };
  
      var Thumbnail = function(element) {
  
          // get lightGallery core plugin data
          this.core = $(element).data('lightGallery');
  
          // extend module default settings with lightGallery core settings
          this.core.s = $.extend({}, defaults, this.core.s);
  
          this.$el = $(element);
          this.$thumbOuter = null;
          this.thumbOuterWidth = 0;
          this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
          this.thumbIndex = this.core.index;
  
          if (this.core.s.animateThumb) {
              this.core.s.thumbHeight = '100%';
          }
  
          // Thumbnail animation value
          this.left = 0;
  
          this.init();
  
          return this;
      };
  
      Thumbnail.prototype.init = function() {
          var _this = this;
          if (this.core.s.thumbnail && this.core.$items.length > 1) {
              if (this.core.s.showThumbByDefault) {
                  setTimeout(function(){
                      _this.core.$outer.addClass('lg-thumb-open');
                  }, 700);
              }
  
              if (this.core.s.pullCaptionUp) {
                  this.core.$outer.addClass('lg-pull-caption-up');
              }
  
              this.build();
              if (this.core.s.animateThumb && this.core.doCss()) {
                  if (this.core.s.enableThumbDrag) {
                      this.enableThumbDrag();
                  }
  
                  if (this.core.s.enableThumbSwipe) {
                      this.enableThumbSwipe();
                  }
  
                  this.thumbClickable = false;
              } else {
                  this.thumbClickable = true;
              }
  
              this.toogle();
              this.thumbkeyPress();
          }
      };
  
      Thumbnail.prototype.build = function() {
          var _this = this;
          var thumbList = '';
          var vimeoErrorThumbSize = '';
          var $thumb;
          var html = '<div class="lg-thumb-outer">' +
              '<div class="lg-thumb lg-group">' +
              '</div>' +
              '</div>';
  
          switch (this.core.s.vimeoThumbSize) {
              case 'thumbnail_large':
                  vimeoErrorThumbSize = '640';
                  break;
              case 'thumbnail_medium':
                  vimeoErrorThumbSize = '200x150';
                  break;
              case 'thumbnail_small':
                  vimeoErrorThumbSize = '100x75';
          }
  
          _this.core.$outer.addClass('lg-has-thumb');
  
          _this.core.$outer.find('.lg').append(html);
  
          _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
          _this.thumbOuterWidth = _this.$thumbOuter.width();
  
          if (_this.core.s.animateThumb) {
              _this.core.$outer.find('.lg-thumb').css({
                  width: _this.thumbTotalWidth + 'px',
                  position: 'relative'
              });
          }
  
          if (this.core.s.animateThumb) {
              _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px');
          }
  
          function getThumb(src, thumb, index) {
              var isVideo = _this.core.isVideo(src, index) || {};
              var thumbImg;
              var vimeoId = '';
  
              if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
                  if (isVideo.youtube) {
                      if (_this.core.s.loadYoutubeThumbnail) {
                          thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg';
                      } else {
                          thumbImg = thumb;
                      }
                  } else if (isVideo.vimeo) {
                      if (_this.core.s.loadVimeoThumbnail) {
                          thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
                          vimeoId = isVideo.vimeo[1];
                      } else {
                          thumbImg = thumb;
                      }
                  } else if (isVideo.dailymotion) {
                      if (_this.core.s.loadDailymotionThumbnail) {
                          thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
                      } else {
                          thumbImg = thumb;
                      }
                  }
              } else {
                  thumbImg = thumb;
              }
  
              thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; height: ' + _this.core.s.thumbHeight + '; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
              vimeoId = '';
          }
  
          if (_this.core.s.dynamic) {
              for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
                  getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
              }
          } else {
              _this.core.$items.each(function(i) {
              getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
              });
          }
  
          _this.core.$outer.find('.lg-thumb').html(thumbList);
  
          $thumb = _this.core.$outer.find('.lg-thumb-item');
  
          // Load vimeo thumbnails
          $thumb.each(function() {
              var $this = $(this);
              var vimeoVideoId = $this.attr('data-vimeo-id');
  
              if (vimeoVideoId) {
                  $.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
                      format: 'json'
                  }, function(data) {
                      $this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
                  });
              }
          });
  
          // manage active class for thumbnail
          $thumb.eq(_this.core.index).addClass('active');
          _this.core.$el.on('onBeforeSlide.lg.tm', function() {
              $thumb.removeClass('active');
              $thumb.eq(_this.core.index).addClass('active');
          });
  
          $thumb.on('click.lg touchend.lg', function() {
              var _$this = $(this);
              setTimeout(function() {
  
                  // In IE9 and bellow touch does not support
                  // Go to slide if browser does not support css transitions
                  if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) {
                      _this.core.index = _$this.index();
                      _this.core.slide(_this.core.index, false, true, false);
                  }
              }, 50);
          });
  
          _this.core.$el.on('onBeforeSlide.lg.tm', function() {
              _this.animateThumb(_this.core.index);
          });
  
          $(window).on('resize.lg.thumb orientationchange.lg.thumb', function() {
              setTimeout(function() {
                  _this.animateThumb(_this.core.index);
                  _this.thumbOuterWidth = _this.$thumbOuter.width();
              }, 200);
          });
  
      };
  
      Thumbnail.prototype.setTranslate = function(value) {
          // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
          this.core.$outer.find('.lg-thumb').css({
              transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
          });
      };
  
      Thumbnail.prototype.animateThumb = function(index) {
          var $thumb = this.core.$outer.find('.lg-thumb');
          if (this.core.s.animateThumb) {
              var position;
              switch (this.core.s.currentPagerPosition) {
                  case 'left':
                      position = 0;
                      break;
                  case 'middle':
                      position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2);
                      break;
                  case 'right':
                      position = this.thumbOuterWidth - this.core.s.thumbWidth;
              }
              this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position;
              if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) {
                  this.left = this.thumbTotalWidth - this.thumbOuterWidth;
              }
  
              if (this.left < 0) {
                  this.left = 0;
              }
  
              if (this.core.lGalleryOn) {
                  if (!$thumb.hasClass('on')) {
                      this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms');
                  }
  
                  if (!this.core.doCss()) {
                      $thumb.animate({
                          left: -this.left + 'px'
                      }, this.core.s.speed);
                  }
              } else {
                  if (!this.core.doCss()) {
                      $thumb.css('left', -this.left + 'px');
                  }
              }
  
              this.setTranslate(this.left);
  
          }
      };
  
      // Enable thumbnail dragging and swiping
      Thumbnail.prototype.enableThumbDrag = function() {
  
          var _this = this;
          var startCoords = 0;
          var endCoords = 0;
          var isDraging = false;
          var isMoved = false;
          var tempLeft = 0;
  
          _this.$thumbOuter.addClass('lg-grab');
  
          _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) {
              if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
                  // execute only on .lg-object
                  e.preventDefault();
                  startCoords = e.pageX;
                  isDraging = true;
  
                  // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
                  _this.core.$outer.scrollLeft += 1;
                  _this.core.$outer.scrollLeft -= 1;
  
                  // *
                  _this.thumbClickable = false;
                  _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
              }
          });
  
          $(window).on('mousemove.lg.thumb', function(e) {
              if (isDraging) {
                  tempLeft = _this.left;
                  isMoved = true;
                  endCoords = e.pageX;
  
                  _this.$thumbOuter.addClass('lg-dragging');
  
                  tempLeft = tempLeft - (endCoords - startCoords);
  
                  if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
                      tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
                  }
  
                  if (tempLeft < 0) {
                      tempLeft = 0;
                  }
  
                  // move current slide
                  _this.setTranslate(tempLeft);
  
              }
          });
  
          $(window).on('mouseup.lg.thumb', function() {
              if (isMoved) {
                  isMoved = false;
                  _this.$thumbOuter.removeClass('lg-dragging');
  
                  _this.left = tempLeft;
  
                  if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
                      _this.thumbClickable = true;
                  }
  
              } else {
                  _this.thumbClickable = true;
              }
  
              if (isDraging) {
                  isDraging = false;
                  _this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
              }
          });
  
      };
  
      Thumbnail.prototype.enableThumbSwipe = function() {
          var _this = this;
          var startCoords = 0;
          var endCoords = 0;
          var isMoved = false;
          var tempLeft = 0;
  
          _this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) {
              if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
                  e.preventDefault();
                  startCoords = e.originalEvent.targetTouches[0].pageX;
                  _this.thumbClickable = false;
              }
          });
  
          _this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) {
              if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
                  e.preventDefault();
                  endCoords = e.originalEvent.targetTouches[0].pageX;
                  isMoved = true;
  
                  _this.$thumbOuter.addClass('lg-dragging');
  
                  tempLeft = _this.left;
  
                  tempLeft = tempLeft - (endCoords - startCoords);
  
                  if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
                      tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
                  }
  
                  if (tempLeft < 0) {
                      tempLeft = 0;
                  }
  
                  // move current slide
                  _this.setTranslate(tempLeft);
  
              }
          });
  
          _this.core.$outer.find('.lg-thumb').on('touchend.lg', function() {
              if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
  
                  if (isMoved) {
                      isMoved = false;
                      _this.$thumbOuter.removeClass('lg-dragging');
                      if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
                          _this.thumbClickable = true;
                      }
  
                      _this.left = tempLeft;
                  } else {
                      _this.thumbClickable = true;
                  }
              } else {
                  _this.thumbClickable = true;
              }
          });
  
      };
  
      Thumbnail.prototype.toogle = function() {
          var _this = this;
          if (_this.core.s.toogleThumb) {
              _this.core.$outer.addClass('lg-can-toggle');
              _this.$thumbOuter.append('<button aria-label="Toggle thumbnails" class="lg-toogle-thumb lg-icon"></button>');
              _this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function() {
                  _this.core.$outer.toggleClass('lg-thumb-open');
              });
          }
      };
  
      Thumbnail.prototype.thumbkeyPress = function() {
          var _this = this;
          $(window).on('keydown.lg.thumb', function(e) {
              if (e.keyCode === 38) {
                  e.preventDefault();
                  _this.core.$outer.addClass('lg-thumb-open');
              } else if (e.keyCode === 40) {
                  e.preventDefault();
                  _this.core.$outer.removeClass('lg-thumb-open');
              }
          });
      };
  
      Thumbnail.prototype.destroy = function() {
          if (this.core.s.thumbnail && this.core.$items.length > 1) {
              $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
              this.$thumbOuter.remove();
              this.core.$outer.removeClass('lg-has-thumb');
          }
      };
  
      $.fn.lightGallery.modules.Thumbnail = Thumbnail;
  
  })();
  
  }));
  
/*! lg-fullscreen - v1.2.0 - 2020-05-03
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module unless amdModuleId is set
    define(['jquery'], function (a0) {
      return (factory(a0));
    });
  } else if (typeof module === 'object' && module.exports) {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory(require('jquery'));
  } else {
    factory(root["jQuery"]);
  }
}(this, function ($) {

(function() {

    'use strict';

    var defaults = {
        fullScreen: true
    };

    function isFullScreen() {
        return (
            document.fullscreenElement ||
            document.mozFullScreenElement ||
            document.webkitFullscreenElement ||
            document.msFullscreenElement
        );
    }

    var Fullscreen = function(element) {

        // get lightGallery core plugin data
        this.core = $(element).data('lightGallery');

        this.$el = $(element);

        // extend module defalut settings with lightGallery core settings
        this.core.s = $.extend({}, defaults, this.core.s);

        this.init();

        return this;
    };

    Fullscreen.prototype.init = function() {
        var fullScreen = '';
        if (this.core.s.fullScreen) {

            // check for fullscreen browser support
            if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled &&
                !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
                return;
            } else {
                fullScreen = '<button aria-label="Toggle fullscreen" class="lg-fullscreen lg-icon"></button>';
                this.core.$outer.find('.lg-toolbar').append(fullScreen);
                this.fullScreen();
            }
        }
    };

    Fullscreen.prototype.requestFullscreen = function() {
        var el = document.documentElement;
        if (el.requestFullscreen) {
            el.requestFullscreen();
        } else if (el.msRequestFullscreen) {
            el.msRequestFullscreen();
        } else if (el.mozRequestFullScreen) {
            el.mozRequestFullScreen();
        } else if (el.webkitRequestFullscreen) {
            el.webkitRequestFullscreen();
        }
    };

    Fullscreen.prototype.exitFullscreen = function() {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitExitFullscreen) {
            document.webkitExitFullscreen();
        }
    };

    // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
    Fullscreen.prototype.fullScreen = function() {
        var _this = this;

        $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() {
            _this.core.$outer.toggleClass('lg-fullscreen-on');
        });

        this.core.$outer.find('.lg-fullscreen').on('click.lg', function() {
            if (isFullScreen()) {
                _this.exitFullscreen();
            } else {
                _this.requestFullscreen();
            }
        });

    };

    Fullscreen.prototype.destroy = function() {

        // exit from fullscreen if activated
        if(isFullScreen()) {
            this.exitFullscreen();
        }

        $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg');
    };

    $.fn.lightGallery.modules.fullscreen = Fullscreen;

})();

}));

/*! lg-video - v1.3.0 - 2020-05-03
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module unless amdModuleId is set
    define(['jquery'], function (a0) {
      return (factory(a0));
    });
  } else if (typeof module === 'object' && module.exports) {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory(require('jquery'));
  } else {
    factory(root["jQuery"]);
  }
}(this, function ($) {

(function() {
    
        'use strict';

        var defaults = {
            videoMaxWidth: '855px',

            autoplayFirstVideo: true,

            youtubePlayerParams: false,
            vimeoPlayerParams: false,
            dailymotionPlayerParams: false,
            vkPlayerParams: false,

            videojs: false,
            videojsOptions: {}
        };

        var Video = function(element) {

            this.core = $(element).data('lightGallery');

            this.$el = $(element);
            this.core.s = $.extend({}, defaults, this.core.s);
            this.videoLoaded = false;

            this.init();

            return this;
        };

        Video.prototype.init = function() {
            var _this = this;

            // Event triggered when video url found without poster
            _this.core.$el.on('hasVideo.lg.tm', onHasVideo.bind(this));

            // Set max width for video
            _this.core.$el.on('onAferAppendSlide.lg.tm', onAferAppendSlide.bind(this));

            if (_this.core.doCss() && (_this.core.$items.length > 1) && (_this.core.s.enableSwipe || _this.core.s.enableDrag)) {
                _this.core.$el.on('onSlideClick.lg.tm', function() {
                    var $el = _this.core.$slide.eq(_this.core.index);
                    _this.loadVideoOnclick($el);
                });
            } else {

                // For IE 9 and bellow
                _this.core.$slide.on('click.lg', function() {
                    _this.loadVideoOnclick($(this));
                });
            }

            _this.core.$el.on('onBeforeSlide.lg.tm', onBeforeSlide.bind(this));

            _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) {
                _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing');
            });
            
            if (_this.core.s.autoplayFirstVideo) {
                _this.core.$el.on('onAferAppendSlide.lg.tm', function (e, index) {
                    if (!_this.core.lGalleryOn) {
                        var $el = _this.core.$slide.eq(index);
                        setTimeout(function () {
                            _this.loadVideoOnclick($el);
                        }, 100);
                    }
                });
            }
        };

        Video.prototype.loadVideo = function(src, addClass, noPoster, index, html) {
            var _this = this;
            var video = '';
            var autoplay = 1;
            var a = '';
            var isVideo = this.core.isVideo(src, index) || {};
            var videoTitle;

            if (_this.core.s.dynamic) {
                videoTitle = _this.core.s.dynamicEl[_this.core.index].title;
            } else {
                videoTitle = _this.core.$items.eq(_this.core.index).attr('title') || _this.core.$items.eq(_this.core.index).find('img').first().attr('alt');
            }

            videoTitle = videoTitle ? 'title="' + videoTitle + '"' : '';

            // Enable autoplay based on setting for first video if poster doesn't exist
            if (noPoster) {
                if (this.videoLoaded) {
                    autoplay = 0;
                } else {
                    autoplay = this.core.s.autoplayFirstVideo ? 1 : 0;
                }
            }

            if (isVideo.youtube) {

                a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1';
                if (this.core.s.youtubePlayerParams) {
                    a = a + '&' + $.param(this.core.s.youtubePlayerParams);
                }

                video = '<iframe class="lg-video-object lg-youtube ' + addClass + '" ' + videoTitle + ' width="560" height="315" src="//www.youtube.com/embed/' + isVideo.youtube[1] + a + '" frameborder="0" allowfullscreen></iframe>';

            } else if (isVideo.vimeo) {

                a = '?autoplay=' + autoplay + '&api=1';
                if (this.core.s.vimeoPlayerParams) {
                    a = a + '&' + $.param(this.core.s.vimeoPlayerParams);
                }

                video = '<iframe class="lg-video-object lg-vimeo ' + addClass + '" ' + videoTitle + ' width="560" height="315"  src="//player.vimeo.com/video/' + isVideo.vimeo[1] + a + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';

            } else if (isVideo.dailymotion) {

                a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
                if (this.core.s.dailymotionPlayerParams) {
                    a = a + '&' + $.param(this.core.s.dailymotionPlayerParams);
                }

                video = '<iframe class="lg-video-object lg-dailymotion ' + addClass + '" ' + videoTitle + ' width="560" height="315" src="//www.dailymotion.com/embed/video/' + isVideo.dailymotion[1] + a + '" frameborder="0" allowfullscreen></iframe>';

            } else if (isVideo.html5) {
                var fL = html.substring(0, 1);
                if (fL === '.' || fL === '#') {
                    html = $(html).html();
                }

                video = html;

            } else if (isVideo.vk) {

                a = '&autoplay=' + autoplay;
                if (this.core.s.vkPlayerParams) {
                    a = a + '&' + $.param(this.core.s.vkPlayerParams);
                }

                video = '<iframe class="lg-video-object lg-vk ' + addClass + '" ' + videoTitle + ' width="560" height="315" src="//vk.com/video_ext.php?' + isVideo.vk[1] + a + '" frameborder="0" allowfullscreen></iframe>';

            }

            return video;
        };

        Video.prototype.loadVideoOnclick = function($el){

            var _this = this;
            // check slide has poster
            if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) {

                // check already video element present
                if (!$el.hasClass('lg-has-video')) {

                    $el.addClass('lg-video-playing lg-has-video');

                    var _src;
                    var _html;
                    var _loadVideo = function(_src, _html) {

                        $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html));

                        if (_html) {
                            if (_this.core.s.videojs) {
                                try {
                                    videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
                                        this.play();
                                    });
                                } catch (e) {
                                    console.error('Make sure you have included videojs');
                                }
                            } else {
                                _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play();
                            }
                        }

                    };

                    if (_this.core.s.dynamic) {

                        _src = _this.core.s.dynamicEl[_this.core.index].src;
                        _html = _this.core.s.dynamicEl[_this.core.index].html;

                        _loadVideo(_src, _html);

                    } else {

                        _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src');
                        _html = _this.core.$items.eq(_this.core.index).attr('data-html');

                        _loadVideo(_src, _html);

                    }

                    var $tempImg = $el.find('.lg-object');
                    $el.find('.lg-video').append($tempImg);

                    // @todo loading icon for html5 videos also
                    // for showing the loading indicator while loading video
                    if (!$el.find('.lg-video-object').hasClass('lg-html5')) {
                        $el.removeClass('lg-complete');
                        $el.find('.lg-video-object').on('load.lg error.lg', function() {
                            $el.addClass('lg-complete');
                        });
                    }

                } else {

                    var youtubePlayer = $el.find('.lg-youtube').get(0);
                    var vimeoPlayer = $el.find('.lg-vimeo').get(0);
                    var dailymotionPlayer = $el.find('.lg-dailymotion').get(0);
                    var html5Player = $el.find('.lg-html5').get(0);
                    if (youtubePlayer) {
                        youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
                    } else if (vimeoPlayer) {
                        try {
                            $f(vimeoPlayer).api('play');
                        } catch (e) {
                            console.error('Make sure you have included froogaloop2 js');
                        }
                    } else if (dailymotionPlayer) {
                        dailymotionPlayer.contentWindow.postMessage('play', '*');

                    } else if (html5Player) {
                        if (_this.core.s.videojs) {
                            try {
                                videojs(html5Player).play();
                            } catch (e) {
                                console.error('Make sure you have included videojs');
                            }
                        } else {
                            html5Player.play();
                        }
                    }

                    $el.addClass('lg-video-playing');

                }
            }
        };

        Video.prototype.destroy = function() {
            this.videoLoaded = false;
        };

        function onHasVideo(event, index, src, html) {
            /*jshint validthis:true */
            var _this = this;
            _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html));
            if (html) {
                if (_this.core.s.videojs) {
                    try {
                        videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
                            if (!_this.videoLoaded && _this.core.s.autoplayFirstVideo) {
                                this.play();
                            }
                        });
                    } catch (e) {
                        console.error('Make sure you have included videojs');
                    }
                } else {
                    if(!_this.videoLoaded && _this.core.s.autoplayFirstVideo) {
                        _this.core.$slide.eq(index).find('.lg-html5').get(0).play();
                    }
                }
            }
        }

        function onAferAppendSlide(event, index) {
            /*jshint validthis:true */
            var $videoCont = this.core.$slide.eq(index).find('.lg-video-cont');
            if (!$videoCont.hasClass('lg-has-iframe')) {
                $videoCont.css('max-width', this.core.s.videoMaxWidth);
                this.videoLoaded = true;
            }
        }

        function onBeforeSlide(event, prevIndex, index) {
            /*jshint validthis:true */
            var _this = this;

            var $videoSlide = _this.core.$slide.eq(prevIndex);
            var youtubePlayer = $videoSlide.find('.lg-youtube').get(0);
            var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0);
            var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0);
            var vkPlayer = $videoSlide.find('.lg-vk').get(0);
            var html5Player = $videoSlide.find('.lg-html5').get(0);
            if (youtubePlayer) {
                youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
            } else if (vimeoPlayer) {
                try {
                    $f(vimeoPlayer).api('pause');
                } catch (e) {
                    console.error('Make sure you have included froogaloop2 js');
                }
            } else if (dailymotionPlayer) {
                dailymotionPlayer.contentWindow.postMessage('pause', '*');

            } else if (html5Player) {
                if (_this.core.s.videojs) {
                    try {
                        videojs(html5Player).pause();
                    } catch (e) {
                        console.error('Make sure you have included videojs');
                    }
                } else {
                    html5Player.pause();
                }
            } if (vkPlayer) {
                $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay'));
            }

            var _src;
            if (_this.core.s.dynamic) {
                _src = _this.core.s.dynamicEl[index].src;
            } else {
                _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src');

            }

            var _isVideo = _this.core.isVideo(_src, index) || {};
            if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) {
                _this.core.$outer.addClass('lg-hide-download');
            }

        }

        $.fn.lightGallery.modules.video = Video;

    })();


}));

/*! lg-autoplay - v1.2.0 - 2020-05-03
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module unless amdModuleId is set
    define(['jquery'], function (a0) {
      return (factory(a0));
    });
  } else if (typeof module === 'object' && module.exports) {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory(require('jquery'));
  } else {
    factory(root["jQuery"]);
  }
}(this, function ($) {


(function() {

    'use strict';

    var defaults = {
        autoplay: false,
        pause: 5000,
        progressBar: true,
        fourceAutoplay: false,
        autoplayControls: true,
        appendAutoplayControlsTo: '.lg-toolbar'
    };

    /**
     * Creates the autoplay plugin.
     * @param {object} element - lightGallery element
     */
    var Autoplay = function(element) {

        this.core = $(element).data('lightGallery');

        this.$el = $(element);

        // Execute only if items are above 1
        if (this.core.$items.length < 2) {
            return false;
        }

        this.core.s = $.extend({}, defaults, this.core.s);
        this.interval = false;

        // Identify if slide happened from autoplay
        this.fromAuto = true;

        // Identify if autoplay canceled from touch/drag
        this.canceledOnTouch = false;

        // save fourceautoplay value
        this.fourceAutoplayTemp = this.core.s.fourceAutoplay;

        // do not allow progress bar if browser does not support css3 transitions
        if (!this.core.doCss()) {
            this.core.s.progressBar = false;
        }

        this.init();

        return this;
    };

    Autoplay.prototype.init = function() {
        var _this = this;

        // append autoplay controls
        if (_this.core.s.autoplayControls) {
            _this.controls();
        }

        // Create progress bar
        if (_this.core.s.progressBar) {
            _this.core.$outer.find('.lg').append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>');
        }

        // set progress
        _this.progress();

        // Start autoplay
        if (_this.core.s.autoplay) {
            _this.$el.one('onSlideItemLoad.lg.tm', function() {
                _this.startlAuto();
            });
        }

        // cancel interval on touchstart and dragstart
        _this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function() {
            if (_this.interval) {
                _this.cancelAuto();
                _this.canceledOnTouch = true;
            }
        });

        // restore autoplay if autoplay canceled from touchstart / dragstart
        _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function() {
            if (!_this.interval && _this.canceledOnTouch) {
                _this.startlAuto();
                _this.canceledOnTouch = false;
            }
        });

    };

    Autoplay.prototype.progress = function() {

        var _this = this;
        var _$progressBar;
        var _$progress;

        _this.$el.on('onBeforeSlide.lg.tm', function() {

            // start progress bar animation
            if (_this.core.s.progressBar && _this.fromAuto) {
                _$progressBar = _this.core.$outer.find('.lg-progress-bar');
                _$progress = _this.core.$outer.find('.lg-progress');
                if (_this.interval) {
                    _$progress.removeAttr('style');
                    _$progressBar.removeClass('lg-start');
                    setTimeout(function() {
                        _$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
                        _$progressBar.addClass('lg-start');
                    }, 20);
                }
            }

            // Remove setinterval if slide is triggered manually and fourceautoplay is false
            if (!_this.fromAuto && !_this.core.s.fourceAutoplay) {
                _this.cancelAuto();
            }

            _this.fromAuto = false;

        });
    };

    // Manage autoplay via play/stop buttons
    Autoplay.prototype.controls = function() {
        var _this = this;
        var _html = '<button aria-label="Toggle autoplay" class="lg-autoplay-button lg-icon"></button>';

        // Append autoplay controls
        $(this.core.s.appendAutoplayControlsTo).append(_html);

        _this.core.$outer.find('.lg-autoplay-button').on('click.lg', function() {
            if ($(_this.core.$outer).hasClass('lg-show-autoplay')) {
                _this.cancelAuto();
                _this.core.s.fourceAutoplay = false;
            } else {
                if (!_this.interval) {
                    _this.startlAuto();
                    _this.core.s.fourceAutoplay = _this.fourceAutoplayTemp;
                }
            }
        });
    };

    // Autostart gallery
    Autoplay.prototype.startlAuto = function() {
        var _this = this;

        _this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
        _this.core.$outer.addClass('lg-show-autoplay');
        _this.core.$outer.find('.lg-progress-bar').addClass('lg-start');

        _this.interval = setInterval(function() {
            if (_this.core.index + 1 < _this.core.$items.length) {
                _this.core.index++;
            } else {
                _this.core.index = 0;
            }

            _this.fromAuto = true;
            _this.core.slide(_this.core.index, false, false, 'next');
        }, _this.core.s.speed + _this.core.s.pause);
    };

    // cancel Autostart
    Autoplay.prototype.cancelAuto = function() {
        clearInterval(this.interval);
        this.interval = false;
        this.core.$outer.find('.lg-progress').removeAttr('style');
        this.core.$outer.removeClass('lg-show-autoplay');
        this.core.$outer.find('.lg-progress-bar').removeClass('lg-start');
    };

    Autoplay.prototype.destroy = function() {

        this.cancelAuto();
        this.core.$outer.find('.lg-progress-bar').remove();
    };

    $.fn.lightGallery.modules.autoplay = Autoplay;

})();


}));

/*! lg-hash - v1.0.4 - 2017-12-20
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2017 Sachin N; Licensed GPLv3 */

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module unless amdModuleId is set
    define(['jquery'], function (a0) {
      return (factory(a0));
    });
  } else if (typeof exports === 'object') {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory(require('jquery'));
  } else {
    factory(jQuery);
  }
}(this, function ($) {

(function() {

    'use strict';

    var defaults = {
        hash: true
    };

    var Hash = function(element) {

        this.core = $(element).data('lightGallery');

        this.core.s = $.extend({}, defaults, this.core.s);

        if (this.core.s.hash) {
            this.oldHash = window.location.hash;
            this.init();
        }

        return this;
    };

    Hash.prototype.init = function() {
        var _this = this;
        var _hash;

        // Change hash value on after each slide transition
        _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) {
            if (history.replaceState) {
                history.replaceState(null, null, window.location.pathname + window.location.search + '#lg=' + _this.core.s.galleryId + '&slide=' + index);
            } else {
                window.location.hash = 'lg=' + _this.core.s.galleryId + '&slide=' + index;
            }
        });

        // Listen hash change and change the slide according to slide value
        $(window).on('hashchange.lg.hash', function() {
            _hash = window.location.hash;
            var _idx = parseInt(_hash.split('&slide=')[1], 10);

            // it galleryId doesn't exist in the url close the gallery
            if ((_hash.indexOf('lg=' + _this.core.s.galleryId) > -1)) {
                _this.core.slide(_idx, false, false);
            } else if (_this.core.lGalleryOn) {
                _this.core.destroy();
            }

        });
    };

    Hash.prototype.destroy = function() {

        if (!this.core.s.hash) {
            return;
        }

        // Reset to old hash value
        if (this.oldHash && this.oldHash.indexOf('lg=' + this.core.s.galleryId) < 0) {
            if (history.replaceState) {
                history.replaceState(null, null, this.oldHash);
            } else {
                window.location.hash = this.oldHash;
            }
        } else {
            if (history.replaceState) {
                history.replaceState(null, document.title, window.location.pathname + window.location.search);
            } else {
                window.location.hash = '';
            }
        }

        this.core.$el.off('.lg.hash');

    };

    $.fn.lightGallery.modules.hash = Hash;

})();


}));

/*! lg-share - v1.1.0 - 2020-05-03
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module unless amdModuleId is set
    define(['jquery'], function (a0) {
      return (factory(a0));
    });
  } else if (typeof module === 'object' && module.exports) {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory(require('jquery'));
  } else {
    factory(root["jQuery"]);
  }
}(this, function ($) {

(function() {

    'use strict';

    var defaults = {
        share: true,
        facebook: true,
        facebookDropdownText: 'Facebook',
        twitter: true,
        twitterDropdownText: 'Twitter',
        googlePlus: true,
        googlePlusDropdownText: 'GooglePlus',
        pinterest: true,
        pinterestDropdownText: 'Pinterest'
    };

    var Share = function(element) {

        this.core = $(element).data('lightGallery');

        this.core.s = $.extend({}, defaults, this.core.s);
        if (this.core.s.share) {
            this.init();
        }

        return this;
    };

    Share.prototype.init = function() {
        var _this = this;

        var shareHtml = '<button aria-label="Share" id="lg-share" class="lg-icon" aria-haspopup="true" aria-expanded="false">' +
            '<ul class="lg-dropdown" style="position: absolute;">';
        shareHtml += _this.core.s.facebook ? '<li><a id="lg-share-facebook" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.facebookDropdownText + '</span></a></li>' : '';
        shareHtml += _this.core.s.twitter ? '<li><a id="lg-share-twitter" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.twitterDropdownText + '</span></a></li>' : '';
        shareHtml += _this.core.s.googlePlus ? '<li><a id="lg-share-googleplus" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.googlePlusDropdownText + '</span></a></li>' : '';
        shareHtml += _this.core.s.pinterest ? '<li><a id="lg-share-pinterest" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.pinterestDropdownText + '</span></a></li>' : '';
        shareHtml += '</ul></button>';

        this.core.$outer.find('.lg-toolbar').append(shareHtml);
        this.core.$outer.find('.lg').append('<div id="lg-dropdown-overlay"></div>');
        $('#lg-share').on('click.lg', function(){
            _this.core.$outer.toggleClass('lg-dropdown-active');
            var ariaExpanded = $('#lg-share').attr('aria-expanded');
            $('#lg-share').attr('aria-expanded', ariaExpanded === 'true' ? false: true);
        });

        $('#lg-dropdown-overlay').on('click.lg', function(){
            _this.core.$outer.removeClass('lg-dropdown-active');
            $('#lg-share').attr('aria-expanded', false);
        });

        _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) {

            setTimeout(function() {

                $('#lg-share-facebook').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + (encodeURIComponent(_this.getSahreProps(index, 'facebookShareUrl') || window.location.href)));

                $('#lg-share-twitter').attr('href', 'https://twitter.com/intent/tweet?text=' + _this.getSahreProps(index, 'tweetText') + '&url=' + (encodeURIComponent(_this.getSahreProps(index, 'twitterShareUrl') || window.location.href)));

                $('#lg-share-googleplus').attr('href', 'https://plus.google.com/share?url=' + (encodeURIComponent(_this.getSahreProps(index, 'googleplusShareUrl') || window.location.href)));

                $('#lg-share-pinterest').attr('href', 'http://www.pinterest.com/pin/create/button/?url=' + (encodeURIComponent(_this.getSahreProps(index, 'pinterestShareUrl') || window.location.href)) + '&media=' + encodeURIComponent(_this.getSahreProps(index, 'src')) + '&description=' + _this.getSahreProps(index, 'pinterestText'));

            }, 100);
        });
    };

    Share.prototype.getSahreProps = function(index, prop){
        var shareProp = '';
        if(this.core.s.dynamic) {
            shareProp = this.core.s.dynamicEl[index][prop];
        } else {
            var _href = this.core.$items.eq(index).attr('href');
            var _prop = this.core.$items.eq(index).data(prop);
            shareProp = prop === 'src' ? _href || _prop : _prop;
        }
        return shareProp;
    };

    Share.prototype.destroy = function() {

    };

    $.fn.lightGallery.modules.share = Share;

})();



}));

/*! lg-zoom - v1.3.0-beta.0 - October-05-2020
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module unless amdModuleId is set
    define(['jquery'], function (a0) {
      return (factory(a0));
    });
  } else if (typeof module === 'object' && module.exports) {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory(require('jquery'));
  } else {
    factory(root["jQuery"]);
  }
}(this, function ($) {

(function() {

    'use strict';

    var getUseLeft = function() {
        var useLeft = false;
        var isChrome = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
        if (isChrome && parseInt(isChrome[2], 10) < 54) {
            useLeft = true;
        }

        return useLeft;
    };

    var defaults = {
        scale: 1,
        zoom: true,
        actualSize: true,
        enableZoomAfter: 300,
        useLeftForZoom: getUseLeft()
    };

    var Zoom = function(element) {

        this.core = $(element).data('lightGallery');

        this.core.s = $.extend({}, defaults, this.core.s);

        if (this.core.s.zoom && this.core.doCss()) {
            this.init();

            // Store the zoomable timeout value just to clear it while closing
            this.zoomabletimeout = false;

            // Set the initial value center
            this.pageX = $(window).width() / 2;
            this.pageY = ($(window).height() / 2) + $(window).scrollTop();
        }

        return this;
    };

    Zoom.prototype.init = function() {

        var _this = this;
        var zoomIcons = '<button type="button" aria-label="Zoom in" id="lg-zoom-in" class="lg-icon"></button><button type="button" aria-label="Zoom out" id="lg-zoom-out" class="lg-icon"></button>';

        if (_this.core.s.actualSize) {
            zoomIcons += '<button type="button" aria-label="Actual size" id="lg-actual-size" class="lg-icon"></button>';
        }

        if (_this.core.s.useLeftForZoom) {
            _this.core.$outer.addClass('lg-use-left-for-zoom');
        } else {
            _this.core.$outer.addClass('lg-use-transition-for-zoom');
        }

        this.core.$outer.find('.lg-toolbar').append(zoomIcons);

        // Add zoomable class
        _this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {

            // delay will be 0 except first time
            var _speed = _this.core.s.enableZoomAfter + delay;

            // set _speed value 0 if gallery opened from direct url and if it is first slide
            if ($('body').hasClass('lg-from-hash') && delay) {

                // will execute only once
                _speed = 0;
            } else {

                // Remove lg-from-hash to enable starting animation.
                $('body').removeClass('lg-from-hash');
            }

            _this.zoomabletimeout = setTimeout(function() {
                _this.core.$slide.eq(index).addClass('lg-zoomable');
            }, _speed + 30);
        });

        var scale = 1;
        /**
         * @desc Image zoom
         * Translate the wrap and scale the image to get better user experience
         *
         * @param {String} scaleVal - Zoom decrement/increment value
         */
        var zoom = function(scaleVal) {

            var $image = _this.core.$outer.find('.lg-current .lg-image');
            var _x;
            var _y;

            // Find offset manually to avoid issue after zoom
            var offsetX = ($(window).width() - $image.prop('offsetWidth')) / 2;
            var offsetY = (($(window).height() - $image.prop('offsetHeight')) / 2) + $(window).scrollTop();

            _x = _this.pageX - offsetX;
            _y = _this.pageY - offsetY;

            var x = (scaleVal - 1) * (_x);
            var y = (scaleVal - 1) * (_y);

            $image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);

            if (_this.core.s.useLeftForZoom) {
                $image.parent().css({
                    left: -x + 'px',
                    top: -y + 'px'
                }).attr('data-x', x).attr('data-y', y);
            } else {
                $image.parent().css('transform', 'translate3d(-' + x + 'px, -' + y + 'px, 0)').attr('data-x', x).attr('data-y', y);
            }
        };

        var callScale = function() {
            if (scale > 1) {
                _this.core.$outer.addClass('lg-zoomed');
            } else {
                _this.resetZoom();
            }

            if (scale < 1) {
                scale = 1;
            }

            zoom(scale);
        };

        var actualSize = function(event, $image, index, fromIcon) {
            var w = $image.prop('offsetWidth');
            var nw;
            if (_this.core.s.dynamic) {
                nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
            } else {
                nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w;
            }

            var _scale;

            if (_this.core.$outer.hasClass('lg-zoomed')) {
                scale = 1;
            } else {
                if (nw > w) {
                    _scale = nw / w;
                    scale = _scale || 2;
                }
            }

            if (fromIcon) {
                _this.pageX = $(window).width() / 2;
                _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
            } else {
                _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX;
                _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY;
            }

            callScale();
            setTimeout(function() {
                _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
            }, 10);
        };

        var tapped = false;

        // event triggered after appending slide content
        _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) {

            // Get the current element
            var $image = _this.core.$slide.eq(index).find('.lg-image');

            $image.on('dblclick', function(event) {
                actualSize(event, $image, index);
            });

            $image.on('touchstart', function(event) {
                if (!tapped) {
                    tapped = setTimeout(function() {
                        tapped = null;
                    }, 300);
                } else {
                    clearTimeout(tapped);
                    tapped = null;
                    actualSize(event, $image, index);
                }

                event.preventDefault();
            });

        });

        // Update zoom on resize and orientationchange
        $(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() {
            _this.pageX = $(window).width() / 2;
            _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
            zoom(scale);
        });

        $('#lg-zoom-out').on('click.lg', function() {
            if (_this.core.$outer.find('.lg-current .lg-image').length) {
                scale -= _this.core.s.scale;
                callScale();
            }
        });

        $('#lg-zoom-in').on('click.lg', function() {
            if (_this.core.$outer.find('.lg-current .lg-image').length) {
                scale += _this.core.s.scale;
                callScale();
            }
        });

        $('#lg-actual-size').on('click.lg', function(event) {
            actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true);
        });

        // Reset zoom on slide change
        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
            scale = 1;
            _this.resetZoom();
        });

        // Drag option after zoom
        _this.zoomDrag();

        _this.zoomSwipe();

    };

    /**
     * 
     * @param {Element} el 
     * @return matrix(cos(X), sin(X), -sin(X), cos(X), 0, 0);
     * Get the current transform value
     */
    Zoom.prototype.getCurrentTransform = function (el) {
        if (!el) {
            return 0;
        }
        var st = window.getComputedStyle(el, null);
        var tm = st.getPropertyValue('-webkit-transform') ||
            st.getPropertyValue('-moz-transform') ||
            st.getPropertyValue('-ms-transform') ||
            st.getPropertyValue('-o-transform') ||
            st.getPropertyValue('transform') ||
            'none';
        if (tm !== 'none') {
            return tm.split('(')[1].split(')')[0].split(',');
        }
        return 0;
    };

    Zoom.prototype.getCurrentRotation = function (el) {
        if (!el) {
            return 0;
        }
        var values = this.getCurrentTransform(el);
        if (values) {
            return Math.round(Math.atan2(values[1], values[0]) * (180 / Math.PI));
            // If you want rotate in 360
            //return (angle < 0 ? angle + 360 : angle);
        }
        return 0;
    };

    Zoom.prototype.getModifier = function (rotateValue, axis, el) {
        var originalRotate = rotateValue;
        rotateValue = Math.abs(rotateValue);
        var transformValues = this.getCurrentTransform(el);
        if (!transformValues) {
            return 1;
        }
        var modifier = 1;
        if (axis === 'X') {
            var flipHorizontalValue = Math.sign(parseFloat(transformValues[0]));
            if (rotateValue === 0 || rotateValue === 180) {
                modifier = 1;
            } else if (rotateValue === 90) {
                if ((originalRotate === -90 && flipHorizontalValue === 1) || (originalRotate === 90 && flipHorizontalValue === -1)) {
                    modifier = -1;
                } else {
                    modifier = 1;
                }
            }
            modifier = modifier * flipHorizontalValue;
        } else {
            var flipVerticalValue = Math.sign(parseFloat(transformValues[3]));
            if (rotateValue === 0 || rotateValue === 180) {
                modifier = 1;
            } else if (rotateValue === 90) {
                var sinX = parseFloat(transformValues[1]);
                var sinMinusX = parseFloat(transformValues[2]);
                modifier = Math.sign(sinX * sinMinusX * originalRotate * flipVerticalValue);
            }
            modifier = modifier * flipVerticalValue;
        }
        return modifier;
    };

    Zoom.prototype.getImageSize = function ($image, rotateValue, axis) {
        var imageSizes = {
            y: 'offsetHeight',
            x: 'offsetWidth'
        };
        if (rotateValue === 90) {
            // Swap axis 
            if (axis === 'x') {
                axis = 'y';
            } else {
                axis = 'x';
            }
        }
        return $image.prop(imageSizes[axis]);
    };

    Zoom.prototype.getDragCords = function (e, rotateValue) {
        if (rotateValue === 90) {
            return {
                x: e.pageY,
                y: e.pageX
            };
        } else {
            return {
                x: e.pageX,
                y: e.pageY
            };
        }
    };
    Zoom.prototype.getSwipeCords = function (e, rotateValue) {
        var x = e.originalEvent.targetTouches[0].pageX;
        var y = e.originalEvent.targetTouches[0].pageY;
        if (rotateValue === 90) {
            return {
                x: y,
                y: x
            };
        } else {
            return {
                x: x,
                y: y
            };
        }
    };

    Zoom.prototype.getPossibleDragCords = function ($image, rotateValue) {

        var minY = (this.core.$outer.find('.lg').height() - this.getImageSize($image, rotateValue, 'y')) / 2;
        var maxY = Math.abs((this.getImageSize($image, rotateValue, 'y') * Math.abs($image.attr('data-scale'))) - this.core.$outer.find('.lg').height() + minY);
        var minX = (this.core.$outer.find('.lg').width() - this.getImageSize($image, rotateValue, 'x')) / 2;
        var maxX = Math.abs((this.getImageSize($image, rotateValue, 'x') * Math.abs($image.attr('data-scale'))) - this.core.$outer.find('.lg').width() + minX);
        if (rotateValue === 90) {
            return {
                minY: minX,
                maxY: maxX,
                minX: minY,
                maxX: maxY,
            };
        } else {
            return {
                minY: minY,
                maxY: maxY,
                minX: minX,
                maxX: maxX,
            };
        }
    };

    Zoom.prototype.getDragAllowedAxises = function ($image, rotateValue) {
        var allowY = this.getImageSize($image, rotateValue, 'y') * $image.attr('data-scale') > this.core.$outer.find('.lg').height();
        var allowX = this.getImageSize($image, rotateValue, 'x') * $image.attr('data-scale') > this.core.$outer.find('.lg').width();
        if (rotateValue === 90) {
            return {
                allowX: allowY,
                allowY: allowX
            };
        } else {
            return {
                allowX: allowX,
                allowY: allowY
            };
        }
    };

    // Reset zoom effect
    Zoom.prototype.resetZoom = function() {
        this.core.$outer.removeClass('lg-zoomed');
        this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
        this.core.$slide.find('.lg-image').removeAttr('style data-scale');

        // Reset pagx pagy values to center
        this.pageX = $(window).width() / 2;
        this.pageY = ($(window).height() / 2) + $(window).scrollTop();
    };

    Zoom.prototype.zoomSwipe = function() {
        var _this = this;
        var startCoords = {};
        var endCoords = {};
        var isMoved = false;

        // Allow x direction drag
        var allowX = false;

        // Allow Y direction drag
        var allowY = false;

        var rotateValue = 0;
        var rotateEl;

        _this.core.$slide.on('touchstart.lg', function(e) {

            if (_this.core.$outer.hasClass('lg-zoomed')) {
                var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');

                rotateEl = _this.core.$slide.eq(_this.core.index).find('.lg-img-rotate')[0];
                rotateValue = _this.getCurrentRotation(rotateEl);    

                var dragAllowedAxises = _this.getDragAllowedAxises($image, Math.abs(rotateValue));
                allowY = dragAllowedAxises.allowY;
                allowX = dragAllowedAxises.allowX;
    
                if ((allowX || allowY)) {
                    e.preventDefault();
                    startCoords = _this.getSwipeCords(e, Math.abs(rotateValue));
                }
            }

        });

        _this.core.$slide.on('touchmove.lg', function(e) {

            if (_this.core.$outer.hasClass('lg-zoomed')) {

                var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
                var distanceX;
                var distanceY;

                e.preventDefault();
                isMoved = true;

                endCoords = _this.getSwipeCords(e, Math.abs(rotateValue));

                // reset opacity and transition duration
                _this.core.$outer.addClass('lg-zoom-dragging');

                if (allowY) {
                    distanceY = (-Math.abs(_$el.attr('data-y'))) + ((endCoords.y - startCoords.y) * _this.getModifier(rotateValue, 'Y', rotateEl));
                } else {
                    distanceY = -Math.abs(_$el.attr('data-y'));
                }

                if (allowX) {
                    distanceX = (-Math.abs(_$el.attr('data-x'))) + ((endCoords.x - startCoords.x) * _this.getModifier(rotateValue, 'X', rotateEl));

                } else {
                    distanceX = -Math.abs(_$el.attr('data-x'));
                }

                if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {

                    if (_this.core.s.useLeftForZoom) {
                        _$el.css({
                            left: distanceX + 'px',
                            top: distanceY + 'px'
                        });
                    } else {
                        _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
                    }
                }

            }

        });

        _this.core.$slide.on('touchend.lg', function() {
            if (_this.core.$outer.hasClass('lg-zoomed')) {
                if (isMoved) {
                    isMoved = false;
                    _this.core.$outer.removeClass('lg-zoom-dragging');
                    _this.touchendZoom(startCoords, endCoords, allowX, allowY, rotateValue);

                }
            }
        });

    };

    Zoom.prototype.zoomDrag = function() {

        var _this = this;
        var startCoords = {};
        var endCoords = {};
        var isDraging = false;
        var isMoved = false;

        // Allow x direction drag
        var allowX = false;

        // Allow Y direction drag
        var allowY = false;

        var rotateValue = 0;
        var rotateEl;
        
        _this.core.$slide.on('mousedown.lg.zoom', function(e) {
            rotateEl = _this.core.$slide.eq(_this.core.index).find('.lg-img-rotate')[0];
            rotateValue = _this.getCurrentRotation(rotateEl);
            // execute only on .lg-object
            var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
            var dragAllowedAxises = _this.getDragAllowedAxises($image, Math.abs(rotateValue));
            allowY = dragAllowedAxises.allowY;
            allowX = dragAllowedAxises.allowX;

            if (_this.core.$outer.hasClass('lg-zoomed')) {
                if ($(e.target).hasClass('lg-object') && (allowX || allowY)) {
                    e.preventDefault();
                    startCoords = _this.getDragCords(e, Math.abs(rotateValue));

                    isDraging = true;

                    // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
                    _this.core.$outer.scrollLeft += 1;
                    _this.core.$outer.scrollLeft -= 1;

                    _this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing');
                }
            }
        });

        $(window).on('mousemove.lg.zoom', function(e) {
            if (isDraging) {
                var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
                var distanceX;
                var distanceY;

                isMoved = true;
                endCoords = _this.getDragCords(e, Math.abs(rotateValue));

                // reset opacity and transition duration
                _this.core.$outer.addClass('lg-zoom-dragging');

                if (allowY) {
                    distanceY = (-Math.abs(_$el.attr('data-y'))) + ((endCoords.y - startCoords.y) * _this.getModifier(rotateValue, 'Y', rotateEl));
                } else {
                    distanceY = -Math.abs(_$el.attr('data-y'));
                }
                
                if (allowX) {
                    distanceX = (-Math.abs(_$el.attr('data-x'))) + ((endCoords.x - startCoords.x) * _this.getModifier(rotateValue, 'X', rotateEl));
                } else {
                    distanceX = -Math.abs(_$el.attr('data-x'));
                }

                if (_this.core.s.useLeftForZoom) {
                    _$el.css({
                        left: distanceX + 'px',
                        top: distanceY + 'px'
                    });
                } else {
                    _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
                }
            }
        });

        $(window).on('mouseup.lg.zoom', function(e) {

            if (isDraging) {
                isDraging = false;
                _this.core.$outer.removeClass('lg-zoom-dragging');

                // Fix for chrome mouse move on click
                if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
                    endCoords = _this.getDragCords(e, Math.abs(rotateValue));
                    _this.touchendZoom(startCoords, endCoords, allowX, allowY, rotateValue);

                }

                isMoved = false;
            }

            _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');

        });
    };

    Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY, rotateValue) {

        var _this = this;
        var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
        var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
        var rotateEl = _this.core.$slide.eq(_this.core.index).find('.lg-img-rotate')[0];
        var distanceX = (-Math.abs(_$el.attr('data-x'))) + ((endCoords.x - startCoords.x) * _this.getModifier(rotateValue, 'X', rotateEl));
        var distanceY = (-Math.abs(_$el.attr('data-y'))) + ((endCoords.y - startCoords.y) * _this.getModifier(rotateValue, 'Y', rotateEl));
        var possibleDragCords = _this.getPossibleDragCords($image, Math.abs(rotateValue));
        if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
            if (allowY) {
                if (distanceY <= -possibleDragCords.maxY) {
                    distanceY = -possibleDragCords.maxY;
                } else if (distanceY >= -possibleDragCords.minY) {
                    distanceY = -possibleDragCords.minY;
                }
            }

            if (allowX) {
                if (distanceX <= -possibleDragCords.maxX) {
                    distanceX = -possibleDragCords.maxX;
                } else if (distanceX >= -possibleDragCords.minX) {
                    distanceX = -possibleDragCords.minX;
                }
            }

            if (allowY) {
                _$el.attr('data-y', Math.abs(distanceY));
            } else {
                distanceY = -Math.abs(_$el.attr('data-y'));
            }

            if (allowX) {
                _$el.attr('data-x', Math.abs(distanceX));
            } else {
                distanceX = -Math.abs(_$el.attr('data-x'));
            }

            if (_this.core.s.useLeftForZoom) {
                _$el.css({
                    left: distanceX + 'px',
                    top: distanceY + 'px'
                });
            } else {
                _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
            }

        }
    };

    Zoom.prototype.destroy = function() {

        var _this = this;

        // Unbind all events added by lightGallery zoom plugin
        _this.core.$el.off('.lg.zoom');
        $(window).off('.lg.zoom');
        _this.core.$slide.off('.lg.zoom');
        _this.core.$el.off('.lg.tm.zoom');
        _this.resetZoom();
        clearTimeout(_this.zoomabletimeout);
        _this.zoomabletimeout = false;
    };

    $.fn.lightGallery.modules.zoom = Zoom;

})();


}));

!function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};(e=function(){var e=0;return function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(t),appendDots:i(t),arrows:!0,asNavFor:null,prevArrow:'<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',nextArrow:'<button class="slick-next" aria-label="Next" type="button">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('<button type="button" />').text(t+1)},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",edgeFriction:.35,fade:!1,focusOnSelect:!1,focusOnChange:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rows:1,rtl:!1,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1e3},n.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:!1,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,swiping:!1,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},i.extend(n,n.initials),n.activeBreakpoint=null,n.animType=null,n.animProp=null,n.breakpoints=[],n.breakpointSettings=[],n.cssTransitions=!1,n.focussed=!1,n.interrupted=!1,n.hidden="hidden",n.paused=!0,n.positionProp=null,n.respondTo=null,n.rowCount=1,n.shouldClick=!0,n.$slider=i(t),n.$slidesCache=null,n.transformType=null,n.transitionType=null,n.visibilityChange="visibilitychange",n.windowWidth=0,n.windowTimer=null,s=i(t).data("slick")||{},n.options=i.extend({},n.defaults,o,s),n.currentSlide=n.options.initialSlide,n.originalSettings=n.options,void 0!==document.mozHidden?(n.hidden="mozHidden",n.visibilityChange="mozvisibilitychange"):void 0!==document.webkitHidden&&(n.hidden="webkitHidden",n.visibilityChange="webkitvisibilitychange"),n.autoPlay=i.proxy(n.autoPlay,n),n.autoPlayClear=i.proxy(n.autoPlayClear,n),n.autoPlayIterator=i.proxy(n.autoPlayIterator,n),n.changeSlide=i.proxy(n.changeSlide,n),n.clickHandler=i.proxy(n.clickHandler,n),n.selectHandler=i.proxy(n.selectHandler,n),n.setPosition=i.proxy(n.setPosition,n),n.swipeHandler=i.proxy(n.swipeHandler,n),n.dragHandler=i.proxy(n.dragHandler,n),n.keyHandler=i.proxy(n.keyHandler,n),n.instanceUid=e++,n.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,n.registerBreakpoints(),n.init(!0)}}()).prototype.activateADA=function(){this.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})},e.prototype.addSlide=e.prototype.slickAdd=function(e,t,o){var s=this;if("boolean"==typeof t)o=t,t=null;else if(t<0||t>=s.slideCount)return!1;s.unload(),"number"==typeof t?0===t&&0===s.$slides.length?i(e).appendTo(s.$slideTrack):o?i(e).insertBefore(s.$slides.eq(t)):i(e).insertAfter(s.$slides.eq(t)):!0===o?i(e).prependTo(s.$slideTrack):i(e).appendTo(s.$slideTrack),s.$slides=s.$slideTrack.children(this.options.slide),s.$slideTrack.children(this.options.slide).detach(),s.$slideTrack.append(s.$slides),s.$slides.each(function(e,t){i(t).attr("data-slick-index",e)}),s.$slidesCache=s.$slides,s.reinit()},e.prototype.animateHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.animate({height:e},i.options.speed)}},e.prototype.animateSlide=function(e,t){var o={},s=this;s.animateHeight(),!0===s.options.rtl&&!1===s.options.vertical&&(e=-e),!1===s.transformsEnabled?!1===s.options.vertical?s.$slideTrack.animate({left:e},s.options.speed,s.options.easing,t):s.$slideTrack.animate({top:e},s.options.speed,s.options.easing,t):!1===s.cssTransitions?(!0===s.options.rtl&&(s.currentLeft=-s.currentLeft),i({animStart:s.currentLeft}).animate({animStart:e},{duration:s.options.speed,easing:s.options.easing,step:function(i){i=Math.ceil(i),!1===s.options.vertical?(o[s.animType]="translate("+i+"px, 0px)",s.$slideTrack.css(o)):(o[s.animType]="translate(0px,"+i+"px)",s.$slideTrack.css(o))},complete:function(){t&&t.call()}})):(s.applyTransition(),e=Math.ceil(e),!1===s.options.vertical?o[s.animType]="translate3d("+e+"px, 0px, 0px)":o[s.animType]="translate3d(0px,"+e+"px, 0px)",s.$slideTrack.css(o),t&&setTimeout(function(){s.disableTransition(),t.call()},s.options.speed))},e.prototype.getNavTarget=function(){var e=this,t=e.options.asNavFor;return t&&null!==t&&(t=i(t).not(e.$slider)),t},e.prototype.asNavFor=function(e){var t=this.getNavTarget();null!==t&&"object"==typeof t&&t.each(function(){var t=i(this).slick("getSlick");t.unslicked||t.slideHandler(e,!0)})},e.prototype.applyTransition=function(i){var e=this,t={};!1===e.options.fade?t[e.transitionType]=e.transformType+" "+e.options.speed+"ms "+e.options.cssEase:t[e.transitionType]="opacity "+e.options.speed+"ms "+e.options.cssEase,!1===e.options.fade?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.autoPlay=function(){var i=this;i.autoPlayClear(),i.slideCount>i.options.slidesToShow&&(i.autoPlayTimer=setInterval(i.autoPlayIterator,i.options.autoplaySpeed))},e.prototype.autoPlayClear=function(){var i=this;i.autoPlayTimer&&clearInterval(i.autoPlayTimer)},e.prototype.autoPlayIterator=function(){var i=this,e=i.currentSlide+i.options.slidesToScroll;i.paused||i.interrupted||i.focussed||(!1===i.options.infinite&&(1===i.direction&&i.currentSlide+1===i.slideCount-1?i.direction=0:0===i.direction&&(e=i.currentSlide-i.options.slidesToScroll,i.currentSlide-1==0&&(i.direction=1))),i.slideHandler(e))},e.prototype.buildArrows=function(){var e=this;!0===e.options.arrows&&(e.$prevArrow=i(e.options.prevArrow).addClass("slick-arrow"),e.$nextArrow=i(e.options.nextArrow).addClass("slick-arrow"),e.slideCount>e.options.slidesToShow?(e.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.prependTo(e.options.appendArrows),e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.appendTo(e.options.appendArrows),!0!==e.options.infinite&&e.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true")):e.$prevArrow.add(e.$nextArrow).addClass("slick-hidden").attr({"aria-disabled":"true",tabindex:"-1"}))},e.prototype.buildDots=function(){var e,t,o=this;if(!0===o.options.dots){for(o.$slider.addClass("slick-dotted"),t=i("<ul />").addClass(o.options.dotsClass),e=0;e<=o.getDotCount();e+=1)t.append(i("<li />").append(o.options.customPaging.call(this,o,e)));o.$dots=t.appendTo(o.options.appendDots),o.$dots.find("li").first().addClass("slick-active")}},e.prototype.buildOut=function(){var e=this;e.$slides=e.$slider.children(e.options.slide+":not(.slick-cloned)").addClass("slick-slide"),e.slideCount=e.$slides.length,e.$slides.each(function(e,t){i(t).attr("data-slick-index",e).data("originalStyling",i(t).attr("style")||"")}),e.$slider.addClass("slick-slider"),e.$slideTrack=0===e.slideCount?i('<div class="slick-track"/>').appendTo(e.$slider):e.$slides.wrapAll('<div class="slick-track"/>').parent(),e.$list=e.$slideTrack.wrap('<div class="slick-list"/>').parent(),e.$slideTrack.css("opacity",0),!0!==e.options.centerMode&&!0!==e.options.swipeToSlide||(e.options.slidesToScroll=1),i("img[data-lazy]",e.$slider).not("[src]").addClass("slick-loading"),e.setupInfinite(),e.buildArrows(),e.buildDots(),e.updateDots(),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),!0===e.options.draggable&&e.$list.addClass("draggable")},e.prototype.buildRows=function(){var i,e,t,o,s,n,r,l=this;if(o=document.createDocumentFragment(),n=l.$slider.children(),l.options.rows>1){for(r=l.options.slidesPerRow*l.options.rows,s=Math.ceil(n.length/r),i=0;i<s;i++){var d=document.createElement("div");for(e=0;e<l.options.rows;e++){var a=document.createElement("div");for(t=0;t<l.options.slidesPerRow;t++){var c=i*r+(e*l.options.slidesPerRow+t);n.get(c)&&a.appendChild(n.get(c))}d.appendChild(a)}o.appendChild(d)}l.$slider.empty().append(o),l.$slider.children().children().children().css({width:100/l.options.slidesPerRow+"%",display:"inline-block"})}},e.prototype.checkResponsive=function(e,t){var o,s,n,r=this,l=!1,d=r.$slider.width(),a=window.innerWidth||i(window).width();if("window"===r.respondTo?n=a:"slider"===r.respondTo?n=d:"min"===r.respondTo&&(n=Math.min(a,d)),r.options.responsive&&r.options.responsive.length&&null!==r.options.responsive){s=null;for(o in r.breakpoints)r.breakpoints.hasOwnProperty(o)&&(!1===r.originalSettings.mobileFirst?n<r.breakpoints[o]&&(s=r.breakpoints[o]):n>r.breakpoints[o]&&(s=r.breakpoints[o]));null!==s?null!==r.activeBreakpoint?(s!==r.activeBreakpoint||t)&&(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):null!==r.activeBreakpoint&&(r.activeBreakpoint=null,r.options=r.originalSettings,!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e),l=s),e||!1===l||r.$slider.trigger("breakpoint",[r,l])}},e.prototype.changeSlide=function(e,t){var o,s,n,r=this,l=i(e.currentTarget);switch(l.is("a")&&e.preventDefault(),l.is("li")||(l=l.closest("li")),n=r.slideCount%r.options.slidesToScroll!=0,o=n?0:(r.slideCount-r.currentSlide)%r.options.slidesToScroll,e.data.message){case"previous":s=0===o?r.options.slidesToScroll:r.options.slidesToShow-o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide-s,!1,t);break;case"next":s=0===o?r.options.slidesToScroll:o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide+s,!1,t);break;case"index":var d=0===e.data.index?0:e.data.index||l.index()*r.options.slidesToScroll;r.slideHandler(r.checkNavigable(d),!1,t),l.children().trigger("focus");break;default:return}},e.prototype.checkNavigable=function(i){var e,t;if(e=this.getNavigableIndexes(),t=0,i>e[e.length-1])i=e[e.length-1];else for(var o in e){if(i<e[o]){i=t;break}t=e[o]}return i},e.prototype.cleanUpEvents=function(){var e=this;e.options.dots&&null!==e.$dots&&(i("li",e.$dots).off("click.slick",e.changeSlide).off("mouseenter.slick",i.proxy(e.interrupt,e,!0)).off("mouseleave.slick",i.proxy(e.interrupt,e,!1)),!0===e.options.accessibility&&e.$dots.off("keydown.slick",e.keyHandler)),e.$slider.off("focus.slick blur.slick"),!0===e.options.arrows&&e.slideCount>e.options.slidesToShow&&(e.$prevArrow&&e.$prevArrow.off("click.slick",e.changeSlide),e.$nextArrow&&e.$nextArrow.off("click.slick",e.changeSlide),!0===e.options.accessibility&&(e.$prevArrow&&e.$prevArrow.off("keydown.slick",e.keyHandler),e.$nextArrow&&e.$nextArrow.off("keydown.slick",e.keyHandler))),e.$list.off("touchstart.slick mousedown.slick",e.swipeHandler),e.$list.off("touchmove.slick mousemove.slick",e.swipeHandler),e.$list.off("touchend.slick mouseup.slick",e.swipeHandler),e.$list.off("touchcancel.slick mouseleave.slick",e.swipeHandler),e.$list.off("click.slick",e.clickHandler),i(document).off(e.visibilityChange,e.visibility),e.cleanUpSlideEvents(),!0===e.options.accessibility&&e.$list.off("keydown.slick",e.keyHandler),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().off("click.slick",e.selectHandler),i(window).off("orientationchange.slick.slick-"+e.instanceUid,e.orientationChange),i(window).off("resize.slick.slick-"+e.instanceUid,e.resize),i("[draggable!=true]",e.$slideTrack).off("dragstart",e.preventDefault),i(window).off("load.slick.slick-"+e.instanceUid,e.setPosition)},e.prototype.cleanUpSlideEvents=function(){var e=this;e.$list.off("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.off("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.cleanUpRows=function(){var i,e=this;e.options.rows>1&&((i=e.$slides.children().children()).removeAttr("style"),e.$slider.empty().append(i))},e.prototype.clickHandler=function(i){!1===this.shouldClick&&(i.stopImmediatePropagation(),i.stopPropagation(),i.preventDefault())},e.prototype.destroy=function(e){var t=this;t.autoPlayClear(),t.touchObject={},t.cleanUpEvents(),i(".slick-cloned",t.$slider).detach(),t.$dots&&t.$dots.remove(),t.$prevArrow&&t.$prevArrow.length&&(t.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.prevArrow)&&t.$prevArrow.remove()),t.$nextArrow&&t.$nextArrow.length&&(t.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.nextArrow)&&t.$nextArrow.remove()),t.$slides&&(t.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function(){i(this).attr("style",i(this).data("originalStyling"))}),t.$slideTrack.children(this.options.slide).detach(),t.$slideTrack.detach(),t.$list.detach(),t.$slider.append(t.$slides)),t.cleanUpRows(),t.$slider.removeClass("slick-slider"),t.$slider.removeClass("slick-initialized"),t.$slider.removeClass("slick-dotted"),t.unslicked=!0,e||t.$slider.trigger("destroy",[t])},e.prototype.disableTransition=function(i){var e=this,t={};t[e.transitionType]="",!1===e.options.fade?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.fadeSlide=function(i,e){var t=this;!1===t.cssTransitions?(t.$slides.eq(i).css({zIndex:t.options.zIndex}),t.$slides.eq(i).animate({opacity:1},t.options.speed,t.options.easing,e)):(t.applyTransition(i),t.$slides.eq(i).css({opacity:1,zIndex:t.options.zIndex}),e&&setTimeout(function(){t.disableTransition(i),e.call()},t.options.speed))},e.prototype.fadeSlideOut=function(i){var e=this;!1===e.cssTransitions?e.$slides.eq(i).animate({opacity:0,zIndex:e.options.zIndex-2},e.options.speed,e.options.easing):(e.applyTransition(i),e.$slides.eq(i).css({opacity:0,zIndex:e.options.zIndex-2}))},e.prototype.filterSlides=e.prototype.slickFilter=function(i){var e=this;null!==i&&(e.$slidesCache=e.$slides,e.unload(),e.$slideTrack.children(this.options.slide).detach(),e.$slidesCache.filter(i).appendTo(e.$slideTrack),e.reinit())},e.prototype.focusHandler=function(){var e=this;e.$slider.off("focus.slick blur.slick").on("focus.slick blur.slick","*",function(t){t.stopImmediatePropagation();var o=i(this);setTimeout(function(){e.options.pauseOnFocus&&(e.focussed=o.is(":focus"),e.autoPlay())},0)})},e.prototype.getCurrent=e.prototype.slickCurrentSlide=function(){return this.currentSlide},e.prototype.getDotCount=function(){var i=this,e=0,t=0,o=0;if(!0===i.options.infinite)if(i.slideCount<=i.options.slidesToShow)++o;else for(;e<i.slideCount;)++o,e=t+i.options.slidesToScroll,t+=i.options.slidesToScroll<=i.options.slidesToShow?i.options.slidesToScroll:i.options.slidesToShow;else if(!0===i.options.centerMode)o=i.slideCount;else if(i.options.asNavFor)for(;e<i.slideCount;)++o,e=t+i.options.slidesToScroll,t+=i.options.slidesToScroll<=i.options.slidesToShow?i.options.slidesToScroll:i.options.slidesToShow;else o=1+Math.ceil((i.slideCount-i.options.slidesToShow)/i.options.slidesToScroll);return o-1},e.prototype.getLeft=function(i){var e,t,o,s,n=this,r=0;return n.slideOffset=0,t=n.$slides.first().outerHeight(!0),!0===n.options.infinite?(n.slideCount>n.options.slidesToShow&&(n.slideOffset=n.slideWidth*n.options.slidesToShow*-1,s=-1,!0===n.options.vertical&&!0===n.options.centerMode&&(2===n.options.slidesToShow?s=-1.5:1===n.options.slidesToShow&&(s=-2)),r=t*n.options.slidesToShow*s),n.slideCount%n.options.slidesToScroll!=0&&i+n.options.slidesToScroll>n.slideCount&&n.slideCount>n.options.slidesToShow&&(i>n.slideCount?(n.slideOffset=(n.options.slidesToShow-(i-n.slideCount))*n.slideWidth*-1,r=(n.options.slidesToShow-(i-n.slideCount))*t*-1):(n.slideOffset=n.slideCount%n.options.slidesToScroll*n.slideWidth*-1,r=n.slideCount%n.options.slidesToScroll*t*-1))):i+n.options.slidesToShow>n.slideCount&&(n.slideOffset=(i+n.options.slidesToShow-n.slideCount)*n.slideWidth,r=(i+n.options.slidesToShow-n.slideCount)*t),n.slideCount<=n.options.slidesToShow&&(n.slideOffset=0,r=0),!0===n.options.centerMode&&n.slideCount<=n.options.slidesToShow?n.slideOffset=n.slideWidth*Math.floor(n.options.slidesToShow)/2-n.slideWidth*n.slideCount/2:!0===n.options.centerMode&&!0===n.options.infinite?n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)-n.slideWidth:!0===n.options.centerMode&&(n.slideOffset=0,n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)),e=!1===n.options.vertical?i*n.slideWidth*-1+n.slideOffset:i*t*-1+r,!0===n.options.variableWidth&&(o=n.slideCount<=n.options.slidesToShow||!1===n.options.infinite?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow),e=!0===n.options.rtl?o[0]?-1*(n.$slideTrack.width()-o[0].offsetLeft-o.width()):0:o[0]?-1*o[0].offsetLeft:0,!0===n.options.centerMode&&(o=n.slideCount<=n.options.slidesToShow||!1===n.options.infinite?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow+1),e=!0===n.options.rtl?o[0]?-1*(n.$slideTrack.width()-o[0].offsetLeft-o.width()):0:o[0]?-1*o[0].offsetLeft:0,e+=(n.$list.width()-o.outerWidth())/2)),e},e.prototype.getOption=e.prototype.slickGetOption=function(i){return this.options[i]},e.prototype.getNavigableIndexes=function(){var i,e=this,t=0,o=0,s=[];for(!1===e.options.infinite?i=e.slideCount:(t=-1*e.options.slidesToScroll,o=-1*e.options.slidesToScroll,i=2*e.slideCount);t<i;)s.push(t),t=o+e.options.slidesToScroll,o+=e.options.slidesToScroll<=e.options.slidesToShow?e.options.slidesToScroll:e.options.slidesToShow;return s},e.prototype.getSlick=function(){return this},e.prototype.getSlideCount=function(){var e,t,o=this;return t=!0===o.options.centerMode?o.slideWidth*Math.floor(o.options.slidesToShow/2):0,!0===o.options.swipeToSlide?(o.$slideTrack.find(".slick-slide").each(function(s,n){if(n.offsetLeft-t+i(n).outerWidth()/2>-1*o.swipeLeft)return e=n,!1}),Math.abs(i(e).attr("data-slick-index")-o.currentSlide)||1):o.options.slidesToScroll},e.prototype.goTo=e.prototype.slickGoTo=function(i,e){this.changeSlide({data:{message:"index",index:parseInt(i)}},e)},e.prototype.init=function(e){var t=this;i(t.$slider).hasClass("slick-initialized")||(i(t.$slider).addClass("slick-initialized"),t.buildRows(),t.buildOut(),t.setProps(),t.startLoad(),t.loadSlider(),t.initializeEvents(),t.updateArrows(),t.updateDots(),t.checkResponsive(!0),t.focusHandler()),e&&t.$slider.trigger("init",[t]),!0===t.options.accessibility&&t.initADA(),t.options.autoplay&&(t.paused=!1,t.autoPlay())},e.prototype.initADA=function(){var e=this,t=Math.ceil(e.slideCount/e.options.slidesToShow),o=e.getNavigableIndexes().filter(function(i){return i>=0&&i<e.slideCount});e.$slides.add(e.$slideTrack.find(".slick-cloned")).attr({"aria-hidden":"true",tabindex:"-1"}).find("a, input, button, select").attr({tabindex:"-1"}),null!==e.$dots&&(e.$slides.not(e.$slideTrack.find(".slick-cloned")).each(function(t){var s=o.indexOf(t);i(this).attr({role:"tabpanel",id:"slick-slide"+e.instanceUid+t,tabindex:-1}),-1!==s&&i(this).attr({"aria-describedby":"slick-slide-control"+e.instanceUid+s})}),e.$dots.attr("role","tablist").find("li").each(function(s){var n=o[s];i(this).attr({role:"presentation"}),i(this).find("button").first().attr({role:"tab",id:"slick-slide-control"+e.instanceUid+s,"aria-controls":"slick-slide"+e.instanceUid+n,"aria-label":s+1+" of "+t,"aria-selected":null,tabindex:"-1"})}).eq(e.currentSlide).find("button").attr({"aria-selected":"true",tabindex:"0"}).end());for(var s=e.currentSlide,n=s+e.options.slidesToShow;s<n;s++)e.$slides.eq(s).attr("tabindex",0);e.activateADA()},e.prototype.initArrowEvents=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.off("click.slick").on("click.slick",{message:"previous"},i.changeSlide),i.$nextArrow.off("click.slick").on("click.slick",{message:"next"},i.changeSlide),!0===i.options.accessibility&&(i.$prevArrow.on("keydown.slick",i.keyHandler),i.$nextArrow.on("keydown.slick",i.keyHandler)))},e.prototype.initDotEvents=function(){var e=this;!0===e.options.dots&&(i("li",e.$dots).on("click.slick",{message:"index"},e.changeSlide),!0===e.options.accessibility&&e.$dots.on("keydown.slick",e.keyHandler)),!0===e.options.dots&&!0===e.options.pauseOnDotsHover&&i("li",e.$dots).on("mouseenter.slick",i.proxy(e.interrupt,e,!0)).on("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.initSlideEvents=function(){var e=this;e.options.pauseOnHover&&(e.$list.on("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.on("mouseleave.slick",i.proxy(e.interrupt,e,!1)))},e.prototype.initializeEvents=function(){var e=this;e.initArrowEvents(),e.initDotEvents(),e.initSlideEvents(),e.$list.on("touchstart.slick mousedown.slick",{action:"start"},e.swipeHandler),e.$list.on("touchmove.slick mousemove.slick",{action:"move"},e.swipeHandler),e.$list.on("touchend.slick mouseup.slick",{action:"end"},e.swipeHandler),e.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},e.swipeHandler),e.$list.on("click.slick",e.clickHandler),i(document).on(e.visibilityChange,i.proxy(e.visibility,e)),!0===e.options.accessibility&&e.$list.on("keydown.slick",e.keyHandler),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),i(window).on("orientationchange.slick.slick-"+e.instanceUid,i.proxy(e.orientationChange,e)),i(window).on("resize.slick.slick-"+e.instanceUid,i.proxy(e.resize,e)),i("[draggable!=true]",e.$slideTrack).on("dragstart",e.preventDefault),i(window).on("load.slick.slick-"+e.instanceUid,e.setPosition),i(e.setPosition)},e.prototype.initUI=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.show(),i.$nextArrow.show()),!0===i.options.dots&&i.slideCount>i.options.slidesToShow&&i.$dots.show()},e.prototype.keyHandler=function(i){var e=this;i.target.tagName.match("TEXTAREA|INPUT|SELECT")||(37===i.keyCode&&!0===e.options.accessibility?e.changeSlide({data:{message:!0===e.options.rtl?"next":"previous"}}):39===i.keyCode&&!0===e.options.accessibility&&e.changeSlide({data:{message:!0===e.options.rtl?"previous":"next"}}))},e.prototype.lazyLoad=function(){function e(e){i("img[data-lazy]",e).each(function(){var e=i(this),t=i(this).attr("data-lazy"),o=i(this).attr("data-srcset"),s=i(this).attr("data-sizes")||n.$slider.attr("data-sizes"),r=document.createElement("img");r.onload=function(){e.animate({opacity:0},100,function(){o&&(e.attr("srcset",o),s&&e.attr("sizes",s)),e.attr("src",t).animate({opacity:1},200,function(){e.removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading")}),n.$slider.trigger("lazyLoaded",[n,e,t])})},r.onerror=function(){e.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),n.$slider.trigger("lazyLoadError",[n,e,t])},r.src=t})}var t,o,s,n=this;if(!0===n.options.centerMode?!0===n.options.infinite?s=(o=n.currentSlide+(n.options.slidesToShow/2+1))+n.options.slidesToShow+2:(o=Math.max(0,n.currentSlide-(n.options.slidesToShow/2+1)),s=n.options.slidesToShow/2+1+2+n.currentSlide):(o=n.options.infinite?n.options.slidesToShow+n.currentSlide:n.currentSlide,s=Math.ceil(o+n.options.slidesToShow),!0===n.options.fade&&(o>0&&o--,s<=n.slideCount&&s++)),t=n.$slider.find(".slick-slide").slice(o,s),"anticipated"===n.options.lazyLoad)for(var r=o-1,l=s,d=n.$slider.find(".slick-slide"),a=0;a<n.options.slidesToScroll;a++)r<0&&(r=n.slideCount-1),t=(t=t.add(d.eq(r))).add(d.eq(l)),r--,l++;e(t),n.slideCount<=n.options.slidesToShow?e(n.$slider.find(".slick-slide")):n.currentSlide>=n.slideCount-n.options.slidesToShow?e(n.$slider.find(".slick-cloned").slice(0,n.options.slidesToShow)):0===n.currentSlide&&e(n.$slider.find(".slick-cloned").slice(-1*n.options.slidesToShow))},e.prototype.loadSlider=function(){var i=this;i.setPosition(),i.$slideTrack.css({opacity:1}),i.$slider.removeClass("slick-loading"),i.initUI(),"progressive"===i.options.lazyLoad&&i.progressiveLazyLoad()},e.prototype.next=e.prototype.slickNext=function(){this.changeSlide({data:{message:"next"}})},e.prototype.orientationChange=function(){var i=this;i.checkResponsive(),i.setPosition()},e.prototype.pause=e.prototype.slickPause=function(){var i=this;i.autoPlayClear(),i.paused=!0},e.prototype.play=e.prototype.slickPlay=function(){var i=this;i.autoPlay(),i.options.autoplay=!0,i.paused=!1,i.focussed=!1,i.interrupted=!1},e.prototype.postSlide=function(e){var t=this;t.unslicked||(t.$slider.trigger("afterChange",[t,e]),t.animating=!1,t.slideCount>t.options.slidesToShow&&t.setPosition(),t.swipeLeft=null,t.options.autoplay&&t.autoPlay(),!0===t.options.accessibility&&(t.initADA(),t.options.focusOnChange&&i(t.$slides.get(t.currentSlide)).attr("tabindex",0).focus()))},e.prototype.prev=e.prototype.slickPrev=function(){this.changeSlide({data:{message:"previous"}})},e.prototype.preventDefault=function(i){i.preventDefault()},e.prototype.progressiveLazyLoad=function(e){e=e||1;var t,o,s,n,r,l=this,d=i("img[data-lazy]",l.$slider);d.length?(t=d.first(),o=t.attr("data-lazy"),s=t.attr("data-srcset"),n=t.attr("data-sizes")||l.$slider.attr("data-sizes"),(r=document.createElement("img")).onload=function(){s&&(t.attr("srcset",s),n&&t.attr("sizes",n)),t.attr("src",o).removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading"),!0===l.options.adaptiveHeight&&l.setPosition(),l.$slider.trigger("lazyLoaded",[l,t,o]),l.progressiveLazyLoad()},r.onerror=function(){e<3?setTimeout(function(){l.progressiveLazyLoad(e+1)},500):(t.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),l.$slider.trigger("lazyLoadError",[l,t,o]),l.progressiveLazyLoad())},r.src=o):l.$slider.trigger("allImagesLoaded",[l])},e.prototype.refresh=function(e){var t,o,s=this;o=s.slideCount-s.options.slidesToShow,!s.options.infinite&&s.currentSlide>o&&(s.currentSlide=o),s.slideCount<=s.options.slidesToShow&&(s.currentSlide=0),t=s.currentSlide,s.destroy(!0),i.extend(s,s.initials,{currentSlide:t}),s.init(),e||s.changeSlide({data:{message:"index",index:t}},!1)},e.prototype.registerBreakpoints=function(){var e,t,o,s=this,n=s.options.responsive||null;if("array"===i.type(n)&&n.length){s.respondTo=s.options.respondTo||"window";for(e in n)if(o=s.breakpoints.length-1,n.hasOwnProperty(e)){for(t=n[e].breakpoint;o>=0;)s.breakpoints[o]&&s.breakpoints[o]===t&&s.breakpoints.splice(o,1),o--;s.breakpoints.push(t),s.breakpointSettings[t]=n[e].settings}s.breakpoints.sort(function(i,e){return s.options.mobileFirst?i-e:e-i})}},e.prototype.reinit=function(){var e=this;e.$slides=e.$slideTrack.children(e.options.slide).addClass("slick-slide"),e.slideCount=e.$slides.length,e.currentSlide>=e.slideCount&&0!==e.currentSlide&&(e.currentSlide=e.currentSlide-e.options.slidesToScroll),e.slideCount<=e.options.slidesToShow&&(e.currentSlide=0),e.registerBreakpoints(),e.setProps(),e.setupInfinite(),e.buildArrows(),e.updateArrows(),e.initArrowEvents(),e.buildDots(),e.updateDots(),e.initDotEvents(),e.cleanUpSlideEvents(),e.initSlideEvents(),e.checkResponsive(!1,!0),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),e.setPosition(),e.focusHandler(),e.paused=!e.options.autoplay,e.autoPlay(),e.$slider.trigger("reInit",[e])},e.prototype.resize=function(){var e=this;i(window).width()!==e.windowWidth&&(clearTimeout(e.windowDelay),e.windowDelay=window.setTimeout(function(){e.windowWidth=i(window).width(),e.checkResponsive(),e.unslicked||e.setPosition()},50))},e.prototype.removeSlide=e.prototype.slickRemove=function(i,e,t){var o=this;if(i="boolean"==typeof i?!0===(e=i)?0:o.slideCount-1:!0===e?--i:i,o.slideCount<1||i<0||i>o.slideCount-1)return!1;o.unload(),!0===t?o.$slideTrack.children().remove():o.$slideTrack.children(this.options.slide).eq(i).remove(),o.$slides=o.$slideTrack.children(this.options.slide),o.$slideTrack.children(this.options.slide).detach(),o.$slideTrack.append(o.$slides),o.$slidesCache=o.$slides,o.reinit()},e.prototype.setCSS=function(i){var e,t,o=this,s={};!0===o.options.rtl&&(i=-i),e="left"==o.positionProp?Math.ceil(i)+"px":"0px",t="top"==o.positionProp?Math.ceil(i)+"px":"0px",s[o.positionProp]=i,!1===o.transformsEnabled?o.$slideTrack.css(s):(s={},!1===o.cssTransitions?(s[o.animType]="translate("+e+", "+t+")",o.$slideTrack.css(s)):(s[o.animType]="translate3d("+e+", "+t+", 0px)",o.$slideTrack.css(s)))},e.prototype.setDimensions=function(){var i=this;!1===i.options.vertical?!0===i.options.centerMode&&i.$list.css({padding:"0px "+i.options.centerPadding}):(i.$list.height(i.$slides.first().outerHeight(!0)*i.options.slidesToShow),!0===i.options.centerMode&&i.$list.css({padding:i.options.centerPadding+" 0px"})),i.listWidth=i.$list.width(),i.listHeight=i.$list.height(),!1===i.options.vertical&&!1===i.options.variableWidth?(i.slideWidth=Math.ceil(i.listWidth/i.options.slidesToShow),i.$slideTrack.width(Math.ceil(i.slideWidth*i.$slideTrack.children(".slick-slide").length))):!0===i.options.variableWidth?i.$slideTrack.width(5e3*i.slideCount):(i.slideWidth=Math.ceil(i.listWidth),i.$slideTrack.height(Math.ceil(i.$slides.first().outerHeight(!0)*i.$slideTrack.children(".slick-slide").length)));var e=i.$slides.first().outerWidth(!0)-i.$slides.first().width();!1===i.options.variableWidth&&i.$slideTrack.children(".slick-slide").width(i.slideWidth-e)},e.prototype.setFade=function(){var e,t=this;t.$slides.each(function(o,s){e=t.slideWidth*o*-1,!0===t.options.rtl?i(s).css({position:"relative",right:e,top:0,zIndex:t.options.zIndex-2,opacity:0}):i(s).css({position:"relative",left:e,top:0,zIndex:t.options.zIndex-2,opacity:0})}),t.$slides.eq(t.currentSlide).css({zIndex:t.options.zIndex-1,opacity:1})},e.prototype.setHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.css("height",e)}},e.prototype.setOption=e.prototype.slickSetOption=function(){var e,t,o,s,n,r=this,l=!1;if("object"===i.type(arguments[0])?(o=arguments[0],l=arguments[1],n="multiple"):"string"===i.type(arguments[0])&&(o=arguments[0],s=arguments[1],l=arguments[2],"responsive"===arguments[0]&&"array"===i.type(arguments[1])?n="responsive":void 0!==arguments[1]&&(n="single")),"single"===n)r.options[o]=s;else if("multiple"===n)i.each(o,function(i,e){r.options[i]=e});else if("responsive"===n)for(t in s)if("array"!==i.type(r.options.responsive))r.options.responsive=[s[t]];else{for(e=r.options.responsive.length-1;e>=0;)r.options.responsive[e].breakpoint===s[t].breakpoint&&r.options.responsive.splice(e,1),e--;r.options.responsive.push(s[t])}l&&(r.unload(),r.reinit())},e.prototype.setPosition=function(){var i=this;i.setDimensions(),i.setHeight(),!1===i.options.fade?i.setCSS(i.getLeft(i.currentSlide)):i.setFade(),i.$slider.trigger("setPosition",[i])},e.prototype.setProps=function(){var i=this,e=document.body.style;i.positionProp=!0===i.options.vertical?"top":"left","top"===i.positionProp?i.$slider.addClass("slick-vertical"):i.$slider.removeClass("slick-vertical"),void 0===e.WebkitTransition&&void 0===e.MozTransition&&void 0===e.msTransition||!0===i.options.useCSS&&(i.cssTransitions=!0),i.options.fade&&("number"==typeof i.options.zIndex?i.options.zIndex<3&&(i.options.zIndex=3):i.options.zIndex=i.defaults.zIndex),void 0!==e.OTransform&&(i.animType="OTransform",i.transformType="-o-transform",i.transitionType="OTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.MozTransform&&(i.animType="MozTransform",i.transformType="-moz-transform",i.transitionType="MozTransition",void 0===e.perspectiveProperty&&void 0===e.MozPerspective&&(i.animType=!1)),void 0!==e.webkitTransform&&(i.animType="webkitTransform",i.transformType="-webkit-transform",i.transitionType="webkitTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.msTransform&&(i.animType="msTransform",i.transformType="-ms-transform",i.transitionType="msTransition",void 0===e.msTransform&&(i.animType=!1)),void 0!==e.transform&&!1!==i.animType&&(i.animType="transform",i.transformType="transform",i.transitionType="transition"),i.transformsEnabled=i.options.useTransform&&null!==i.animType&&!1!==i.animType},e.prototype.setSlideClasses=function(i){var e,t,o,s,n=this;if(t=n.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden","true"),n.$slides.eq(i).addClass("slick-current"),!0===n.options.centerMode){var r=n.options.slidesToShow%2==0?1:0;e=Math.floor(n.options.slidesToShow/2),!0===n.options.infinite&&(i>=e&&i<=n.slideCount-1-e?n.$slides.slice(i-e+r,i+e+1).addClass("slick-active").attr("aria-hidden","false"):(o=n.options.slidesToShow+i,t.slice(o-e+1+r,o+e+2).addClass("slick-active").attr("aria-hidden","false")),0===i?t.eq(t.length-1-n.options.slidesToShow).addClass("slick-center"):i===n.slideCount-1&&t.eq(n.options.slidesToShow).addClass("slick-center")),n.$slides.eq(i).addClass("slick-center")}else i>=0&&i<=n.slideCount-n.options.slidesToShow?n.$slides.slice(i,i+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"):t.length<=n.options.slidesToShow?t.addClass("slick-active").attr("aria-hidden","false"):(s=n.slideCount%n.options.slidesToShow,o=!0===n.options.infinite?n.options.slidesToShow+i:i,n.options.slidesToShow==n.options.slidesToScroll&&n.slideCount-i<n.options.slidesToShow?t.slice(o-(n.options.slidesToShow-s),o+s).addClass("slick-active").attr("aria-hidden","false"):t.slice(o,o+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"));"ondemand"!==n.options.lazyLoad&&"anticipated"!==n.options.lazyLoad||n.lazyLoad()},e.prototype.setupInfinite=function(){var e,t,o,s=this;if(!0===s.options.fade&&(s.options.centerMode=!1),!0===s.options.infinite&&!1===s.options.fade&&(t=null,s.slideCount>s.options.slidesToShow)){for(o=!0===s.options.centerMode?s.options.slidesToShow+1:s.options.slidesToShow,e=s.slideCount;e>s.slideCount-o;e-=1)t=e-1,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t-s.slideCount).prependTo(s.$slideTrack).addClass("slick-cloned");for(e=0;e<o+s.slideCount;e+=1)t=e,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t+s.slideCount).appendTo(s.$slideTrack).addClass("slick-cloned");s.$slideTrack.find(".slick-cloned").find("[id]").each(function(){i(this).attr("id","")})}},e.prototype.interrupt=function(i){var e=this;i||e.autoPlay(),e.interrupted=i},e.prototype.selectHandler=function(e){var t=this,o=i(e.target).is(".slick-slide")?i(e.target):i(e.target).parents(".slick-slide"),s=parseInt(o.attr("data-slick-index"));s||(s=0),t.slideCount<=t.options.slidesToShow?t.slideHandler(s,!1,!0):t.slideHandler(s)},e.prototype.slideHandler=function(i,e,t){var o,s,n,r,l,d=null,a=this;if(e=e||!1,!(!0===a.animating&&!0===a.options.waitForAnimate||!0===a.options.fade&&a.currentSlide===i))if(!1===e&&a.asNavFor(i),o=i,d=a.getLeft(o),r=a.getLeft(a.currentSlide),a.currentLeft=null===a.swipeLeft?r:a.swipeLeft,!1===a.options.infinite&&!1===a.options.centerMode&&(i<0||i>a.getDotCount()*a.options.slidesToScroll))!1===a.options.fade&&(o=a.currentSlide,!0!==t?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o));else if(!1===a.options.infinite&&!0===a.options.centerMode&&(i<0||i>a.slideCount-a.options.slidesToScroll))!1===a.options.fade&&(o=a.currentSlide,!0!==t?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o));else{if(a.options.autoplay&&clearInterval(a.autoPlayTimer),s=o<0?a.slideCount%a.options.slidesToScroll!=0?a.slideCount-a.slideCount%a.options.slidesToScroll:a.slideCount+o:o>=a.slideCount?a.slideCount%a.options.slidesToScroll!=0?0:o-a.slideCount:o,a.animating=!0,a.$slider.trigger("beforeChange",[a,a.currentSlide,s]),n=a.currentSlide,a.currentSlide=s,a.setSlideClasses(a.currentSlide),a.options.asNavFor&&(l=(l=a.getNavTarget()).slick("getSlick")).slideCount<=l.options.slidesToShow&&l.setSlideClasses(a.currentSlide),a.updateDots(),a.updateArrows(),!0===a.options.fade)return!0!==t?(a.fadeSlideOut(n),a.fadeSlide(s,function(){a.postSlide(s)})):a.postSlide(s),void a.animateHeight();!0!==t?a.animateSlide(d,function(){a.postSlide(s)}):a.postSlide(s)}},e.prototype.startLoad=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.hide(),i.$nextArrow.hide()),!0===i.options.dots&&i.slideCount>i.options.slidesToShow&&i.$dots.hide(),i.$slider.addClass("slick-loading")},e.prototype.swipeDirection=function(){var i,e,t,o,s=this;return i=s.touchObject.startX-s.touchObject.curX,e=s.touchObject.startY-s.touchObject.curY,t=Math.atan2(e,i),(o=Math.round(180*t/Math.PI))<0&&(o=360-Math.abs(o)),o<=45&&o>=0?!1===s.options.rtl?"left":"right":o<=360&&o>=315?!1===s.options.rtl?"left":"right":o>=135&&o<=225?!1===s.options.rtl?"right":"left":!0===s.options.verticalSwiping?o>=35&&o<=135?"down":"up":"vertical"},e.prototype.swipeEnd=function(i){var e,t,o=this;if(o.dragging=!1,o.swiping=!1,o.scrolling)return o.scrolling=!1,!1;if(o.interrupted=!1,o.shouldClick=!(o.touchObject.swipeLength>10),void 0===o.touchObject.curX)return!1;if(!0===o.touchObject.edgeHit&&o.$slider.trigger("edge",[o,o.swipeDirection()]),o.touchObject.swipeLength>=o.touchObject.minSwipe){switch(t=o.swipeDirection()){case"left":case"down":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide+o.getSlideCount()):o.currentSlide+o.getSlideCount(),o.currentDirection=0;break;case"right":case"up":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide-o.getSlideCount()):o.currentSlide-o.getSlideCount(),o.currentDirection=1}"vertical"!=t&&(o.slideHandler(e),o.touchObject={},o.$slider.trigger("swipe",[o,t]))}else o.touchObject.startX!==o.touchObject.curX&&(o.slideHandler(o.currentSlide),o.touchObject={})},e.prototype.swipeHandler=function(i){var e=this;if(!(!1===e.options.swipe||"ontouchend"in document&&!1===e.options.swipe||!1===e.options.draggable&&-1!==i.type.indexOf("mouse")))switch(e.touchObject.fingerCount=i.originalEvent&&void 0!==i.originalEvent.touches?i.originalEvent.touches.length:1,e.touchObject.minSwipe=e.listWidth/e.options.touchThreshold,!0===e.options.verticalSwiping&&(e.touchObject.minSwipe=e.listHeight/e.options.touchThreshold),i.data.action){case"start":e.swipeStart(i);break;case"move":e.swipeMove(i);break;case"end":e.swipeEnd(i)}},e.prototype.swipeMove=function(i){var e,t,o,s,n,r,l=this;return n=void 0!==i.originalEvent?i.originalEvent.touches:null,!(!l.dragging||l.scrolling||n&&1!==n.length)&&(e=l.getLeft(l.currentSlide),l.touchObject.curX=void 0!==n?n[0].pageX:i.clientX,l.touchObject.curY=void 0!==n?n[0].pageY:i.clientY,l.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(l.touchObject.curX-l.touchObject.startX,2))),r=Math.round(Math.sqrt(Math.pow(l.touchObject.curY-l.touchObject.startY,2))),!l.options.verticalSwiping&&!l.swiping&&r>4?(l.scrolling=!0,!1):(!0===l.options.verticalSwiping&&(l.touchObject.swipeLength=r),t=l.swipeDirection(),void 0!==i.originalEvent&&l.touchObject.swipeLength>4&&(l.swiping=!0,i.preventDefault()),s=(!1===l.options.rtl?1:-1)*(l.touchObject.curX>l.touchObject.startX?1:-1),!0===l.options.verticalSwiping&&(s=l.touchObject.curY>l.touchObject.startY?1:-1),o=l.touchObject.swipeLength,l.touchObject.edgeHit=!1,!1===l.options.infinite&&(0===l.currentSlide&&"right"===t||l.currentSlide>=l.getDotCount()&&"left"===t)&&(o=l.touchObject.swipeLength*l.options.edgeFriction,l.touchObject.edgeHit=!0),!1===l.options.vertical?l.swipeLeft=e+o*s:l.swipeLeft=e+o*(l.$list.height()/l.listWidth)*s,!0===l.options.verticalSwiping&&(l.swipeLeft=e+o*s),!0!==l.options.fade&&!1!==l.options.touchMove&&(!0===l.animating?(l.swipeLeft=null,!1):void l.setCSS(l.swipeLeft))))},e.prototype.swipeStart=function(i){var e,t=this;if(t.interrupted=!0,1!==t.touchObject.fingerCount||t.slideCount<=t.options.slidesToShow)return t.touchObject={},!1;void 0!==i.originalEvent&&void 0!==i.originalEvent.touches&&(e=i.originalEvent.touches[0]),t.touchObject.startX=t.touchObject.curX=void 0!==e?e.pageX:i.clientX,t.touchObject.startY=t.touchObject.curY=void 0!==e?e.pageY:i.clientY,t.dragging=!0},e.prototype.unfilterSlides=e.prototype.slickUnfilter=function(){var i=this;null!==i.$slidesCache&&(i.unload(),i.$slideTrack.children(this.options.slide).detach(),i.$slidesCache.appendTo(i.$slideTrack),i.reinit())},e.prototype.unload=function(){var e=this;i(".slick-cloned",e.$slider).remove(),e.$dots&&e.$dots.remove(),e.$prevArrow&&e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.remove(),e.$nextArrow&&e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.remove(),e.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden","true").css("width","")},e.prototype.unslick=function(i){var e=this;e.$slider.trigger("unslick",[e,i]),e.destroy()},e.prototype.updateArrows=function(){var i=this;Math.floor(i.options.slidesToShow/2),!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&!i.options.infinite&&(i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false"),i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false"),0===i.currentSlide?(i.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false")):i.currentSlide>=i.slideCount-i.options.slidesToShow&&!1===i.options.centerMode?(i.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")):i.currentSlide>=i.slideCount-1&&!0===i.options.centerMode&&(i.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")))},e.prototype.updateDots=function(){var i=this;null!==i.$dots&&(i.$dots.find("li").removeClass("slick-active").end(),i.$dots.find("li").eq(Math.floor(i.currentSlide/i.options.slidesToScroll)).addClass("slick-active"))},e.prototype.visibility=function(){var i=this;i.options.autoplay&&(document[i.hidden]?i.interrupted=!0:i.interrupted=!1)},i.fn.slick=function(){var i,t,o=this,s=arguments[0],n=Array.prototype.slice.call(arguments,1),r=o.length;for(i=0;i<r;i++)if("object"==typeof s||void 0===s?o[i].slick=new e(o[i],s):t=o[i].slick[s].apply(o[i].slick,n),void 0!==t)return t;return o}});

/*! jquery-gi-thewall v1.0.2 || Goldinteractive <mail@goldinteractive.ch> (http://goldinteractive.ch) */
!function(a,b,c,d,e,f){"use strict";f.support.transition=function(){var b=function(){var b,c=a.createElement("GI"),d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(b in d)if(void 0!==c.style[b])return d[b]}();return b&&{end:b}}();var g=0,h=function(c,e){var h=this,i={onBeforeInit:null,onReady:null,onViewPortUpdate:null,onItemChange:null,onDestroy:null,onShow:null,onHide:null,onContentLoading:null,onContentLoaded:null,margin:{top:10,bottom:10},scrollerElm:null,scrollOffset:150,arrows:!0,closebutton:!0,keyboardNavigation:!0,animationSpeed:300,autoscroll:!0,responsive:!0,initialWrapperHeight:600,dynamicHeight:!0,nextButtonClass:"",prevButtonClass:"",closeButtonClass:""},j="ontouchstart"in b||b.DocumentTouch&&a instanceof DocumentTouch,k=[33,34,35,36,37,38,39,40,27],l=!1,m=f.support.transition,n=!1,o=0,p=".GITheWall"+g,q={click:j?"touchstart":"click",mousedown:j?"touchstart":"mousedown",mouseup:j?"touchend":"mouseup",mousemove:j?"touchmove":"mousemove",mouseleave:j?"touchleave":"mouseleave"},r=f.extend(i,e);this.$el=c,this.$expanderWrapper=f('<div class="GI_TW_expander"></div>'),this.$contentPointer=f('<div class="GI_TW_pointer"></div>'),this.$expanderInner=f('<div class="GI_TW_expander-inner"></div>'),this.$list=f("> ul",this.$el).eq(0),this.$items=f("> li",this.$list),this.itemsLength=this.$items.length,this.currentIndex=null,this.currentRowIndex=null,this.$selectedli=null,this.selectedLiData=null,Function.prototype.debounce=function(a,b){var c,d,e=this;return function(){var f=this,g=arguments,h=function(){c=null,b||(d=e.apply(f,g))},i=b&&!c;return clearTimeout(c),c=setTimeout(h,a),i&&(d=e.apply(f,g)),d}};var s=function(a,b){"function"==typeof a&&f.proxy(a,h,b)()},t=function(){this.$expanderWrapper.append('<span class="GI_TW_arrow GI_TW_prev GI_TW_Controls"><span class="'+r.prevButtonClass+'"></span></span><span class="GI_TW_arrow GI_TW_next GI_TW_Controls"><span class="'+r.nextButtonClass+'"></span></span>'),this.$next=f(".GI_TW_next",this.$expanderWrapper),this.$prev=f(".GI_TW_prev",this.$expanderWrapper)},u=function(){h.$prev.toggleClass("GI_TW_hidden",h.currentIndex<=0),h.$next.toggleClass("GI_TW_hidden",h.currentIndex>=h.itemsLength-1)},v=function(a){return r.autoscroll?void f(r.scrollerElm||"html,body").animate({scrollTop:a}):!1},w=function(){h.$items.removeClass("GI_TW_Current"),"number"==typeof h.currentIndex&&h.$items.eq(h.currentIndex).addClass("GI_TW_Current")},x=function(){this.$contentPointer.css({left:this.selectedLiData.offset.left+this.$selectedli.width()/2})},y=function(a){var b=new f.Deferred,c=f(a).html();if(!c.length)throw new Error('No element can be found using the "'+a+'" selector');return h.$expanderInner.html(c),b.resolve(),b.promise()},z=function(a){var b=new f.Deferred,c=new Image;return c.onload=function(){h.$expanderInner.html('<div class="GI_TW_fullimg"><img src="'+a+'" /></div>'),b.resolve(),c=null},c.src=a,b.promise()},A=function(a){var b=new f.Deferred;return f.get(a,function(a){h.$expanderInner.html(a),b.resolve()}),b.promise()},B=function(a){this.$expanderInner.css({height:a}),a!==o&&(o=a,this.$expanderWrapper.stop(!0,!1).addClass(m?"animating":"")[m?"css":"animate"]({height:a},r.animationSpeed),this.updateElementsPosition())},C=function(){this.selectedLiData.index<0||this.selectedLiData.index>=this.itemsLength||(this.currentIndex=this.selectedLiData.index,this.loadInnerContents(),s(r.onItemChange,this.currentIndex))},D=function(a){this.isOpened()&&void 0===a.target.form&&(a.target.isContentEditable||(f.inArray(a.keyCode,k)>-1&&a.preventDefault(),39===a.keyCode?this.next():37===a.keyCode?this.prev():27===a.keyCode&&this.hideExpander()))},E=function(a){a.stopImmediatePropagation(),a.preventDefault();var b=f(a.currentTarget);b.hasClass("GI_TW_next")?this.next():this.prev()},F=function(){s(r.onBeforeInit),r.arrows&&(t.call(this),u()),r.closebutton&&(this.$expanderWrapper.append('<div class="GI_TW_close GI_TW_Controls"><span class="'+r.closeButtonClass+'"></span></div>'),this.$closebutton=f(".GI_TW_items",this.$expanderWrapper)),this.$expanderWrapper.append(this.$contentPointer),this.$expanderWrapper.append(this.$expanderInner),this.$el.prepend(this.$expanderWrapper),this.bindAll(),s(r.onReady),g++};return this.setLisOffsets=function(){var a,b=0,c=0;this.$items.each(f.proxy(function(d,e){var g=f(e),h=g.data();g.removeClass("GI_TW_First GI_TW_Last GI_TW_Index-"+h.index+" GI_TW_Row-"+h.rowIndex);var i=!1,j=g.position(),k={top:~~j.top,left:~~j.left};(k.top>=b+3||k.top<=b-3)&&(a&&a.addClass("GI_TW_Last"),i=!0,c++),g.addClass((i?"GI_TW_First ":" ")+"GI_TW_Index-"+d+" GI_TW_Row-"+c),g.data({rowIndex:c,offset:k,index:d}),a=g,b=k.top},this))},this.setViewport=function(){l&&(this.setLisOffsets(),this.updateElementsPosition(),x.call(this),s(r.onViewPortUpdate))},this.loadInnerContents=function(){var a,b=this.$selectedli.find("a"),c=this.selectedLiData.href||b.attr("href");if(n=!0,this.$expanderInner.html('<div class="GI_TW_loading"></div>'),!c)return void console.warn("sorry.. it was not possible to load any content");switch(s(r.onContentLoading),this.selectedLiData.contenttype){case"ajax":a=A(c);break;case"inline":a=y(c);break;default:a=z(c)}a.then(function(){h.$expanderInner.css({height:"auto"});var a=r.dynamicHeight?h.$expanderInner.outerHeight():r.initialWrapperHeight;B.call(h,a),h.update(),v(h.$expanderWrapper.offset().top-r.scrollOffset),s(r.onContentLoaded),n=!1})},this.showExpander=function(a){return a.preventDefault(),this.$selectedli=f(a.currentTarget),this.$selectedli.length&&this.$selectedli.hasClass("GI_TW_Current")?void this.hideExpander():(this.selectedLiData=this.$selectedli.data(),l?void C.call(this):(l=!0,this.$expanderWrapper.addClass("opened"),this.setViewport(),C.call(this),void s(r.onShow)))},this.hideExpander=function(){this.$expanderWrapper.removeClass("opened").stop(!0,!1)[m?"css":"animate"]({height:0},r.animationSpeed),this.$expanderInner.empty(),this.currentRowIndex=null,this.$selectedli=null,this.selectedLiData=null,this.currentIndex=null,o=0,this.$items.removeClass("GI_TW_Selected_Row").animate({marginBottom:0},r.animationSpeed),l=!1,w(),s(r.onHide)},this.refresh=function(){this.$list=f("> ul",this.$el).eq(0),this.$items=f("> li",this.$list),this.$list.has(this.$selectedli).length||this.hideExpander(),this.itemsLength=this.$items.length,l&&(this.setLisOffsets(),this.update())},this.update=function(){this.selectedLiData=this.$selectedli.data(),x.call(this),this.selectedLiData.rowIndex!==this.currentRowIndex&&this.updateElementsPosition(),r.arrows&&u(),w.call(this),this.currentRowIndex=this.selectedLiData.rowIndex},this.updateElementsPosition=function(){this.$items.each(function(a,b){var c=f(b),d=c.data(),e=d&&d.rowIndex===h.selectedLiData.rowIndex;c.toggleClass("GI_TW_Selected_Row",e).stop(!0,!1)[m?"css":"animate"]({marginBottom:e?Number(o+r.margin.bottom):0},e?r.animationSpeed:0)}),this.setLisOffsets(),this.updateExpanderPosition()},this.updateExpanderPosition=function(){if(l){var a=this.selectedLiData.offset.top+this.$selectedli.height()+r.margin.top;this.$expanderWrapper.css({top:a})}},this.resizeHeight=function(a){B.call(this,a),this.setViewport()},this.showItemByIndex=function(a){var b=this.$items.eq(a);b.length&&(this.$selectedli=b,this.selectedLiData=b.data(),C.call(this))},this.isOpened=function(){return l},this.next=function(){!n&&l&&this.currentIndex!==this.itemsLength-1&&this.showItemByIndex(this.currentIndex+1)},this.prev=function(){!n&&l&&0!==this.currentIndex&&this.showItemByIndex(this.currentIndex-1)},this.bindAll=function(){m&&this.$expanderWrapper.on(m.end+p,function(){f(this).removeClass("animating")}),r.arrows&&this.$el.on(q.click+p,".GI_TW_arrow",this.$expanderWrapper,f.proxy(E,this)),r.closebutton&&this.$el.on(q.click+p,".GI_TW_close",this.$expanderWrapper,f.proxy(this.hideExpander,this)),this.$el.on("click"+p,"> ul > li",f.proxy(this.showExpander,this)),r.responsive&&d.on("resize"+p+" orientationchange"+p,f.proxy(this.setViewport.debounce(300),this)),r.keyboardNavigation&&d.on("keydown"+p,f.proxy(D,this))},this.unbindAll=function(){this.$el.off(p),this.$expanderWrapper.off(p)},this.destroy=function(a){a&&(a.preventDefault(),a.stopImmediatePropagation()),this.hideExpander(),this.unbindAll(),this.$expanderWrapper.remove(),s(r.onDestroy)},F.call(this),this};f.fn.GITheWall=function(a){return this.length?new h(this,a):void 0}}(document,window,$(document),$(window),$("body"),jQuery);
// jscs:disable
/* jshint -W071, -W074 */
// jscs:enable
/* globals jQuery */
/*
 * jQuery ezPlus 1.2.5
 * Demo's and documentation:
 * http://igorlino.github.io/elevatezoom-plus/
 *
 * licensed under MIT license.
 * http://en.wikipedia.org/wiki/MIT_License
 *
 */

if (typeof Object.create !== 'function') {
    Object.create = function (obj) {
        function F() {
        }

        F.prototype = obj;
        return new F();
    };
}

(function ($, window, document) {
    var EZP = {
        init: function (options, elem) {
            var self = this;

            self.elem = elem;
            self.$elem = $(elem);

            self.options = $.extend({}, $.fn.ezPlus.options, self.responsiveConfig(options || {}));

            self.imageSrc = self.$elem.attr('data-'+self.options.attrImageZoomSrc) ? self.$elem.attr('data-'+self.options.attrImageZoomSrc) : self.$elem.attr('src');

            if (!self.options.enabled) {
                return;
            }

            //TINT OVERRIDE SETTINGS
            if (self.options.tint) {
                self.options.lensColour = 'transparent'; //colour of the lens background
                self.options.lensOpacity = '1'; //opacity of the lens
            }
            //INNER OVERRIDE SETTINGS
            if (self.options.zoomType === 'inner') {
                self.options.showLens = false;
            }

            // LENS OVERRIDE SETTINGS
            if (self.options.zoomType === 'lens') {
                self.options.zoomWindowWidth = 0;
            }

            //UUID WHEN MISSING IDENTIFIER
            if (self.options.zoomId === -1) {
                self.options.zoomId = generateUUID();
            }

            //Remove alt on hover

            self.$elem.parent().removeAttr('title').removeAttr('alt');

            self.zoomImage = self.imageSrc;

            self.refresh(1);

            //Create the image swap from the gallery
            var galleryEvent = self.options.galleryEvent + '.ezpspace';
            galleryEvent += self.options.touchEnabled ? ' touchend.ezpspace' : '';
            self.$galleries = $(self.options.gallery ? ('#' + self.options.gallery) : self.options.gallerySelector);
            self.$galleries.on(galleryEvent, self.options.galleryItem, function (e) {

                //Set a class on the currently active gallery image
                if (self.options.galleryActiveClass) {
                    $(self.options.galleryItem, self.$galleries).removeClass(self.options.galleryActiveClass);
                    $(this).addClass(self.options.galleryActiveClass);
                }
                //stop any link on the a tag from working
                if (this.tagName === 'A') {
                    e.preventDefault();
                }

                //call the swap image function
                if ($(this).data(self.options.attrImageZoomSrc)) {
                    self.zoomImagePre = $(this).data(self.options.attrImageZoomSrc);
                }
                else {
                    self.zoomImagePre = $(this).data('image');
                }
                self.swaptheimage($(this).data('image'), self.zoomImagePre);
                if (this.tagName === 'A') {
                    return false;
                }
            });
            function generateUUID() {
                var d = new Date().getTime();
                var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
                    var r = (d + Math.random() * 16) % 16 | 0; // jshint ignore:line
                    d = Math.floor(d / 16); // jshint ignore:line
                    return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); // jshint ignore:line
                });
                return uuid;
            }
        },
        refresh: function (length) {
            var self = this;

            setTimeout(function () {
                self.fetch(self.imageSrc, self.$elem, self.options.minZoomLevel);

            }, length || self.options.refresh);
        },
        fetch: function (imgsrc, element, minZoom) {
            //get the image
            var self = this;
            var newImg = new Image();
            newImg.onload = function () {
                //set the large image dimensions - used to calculte ratio's
                if (newImg.width / element.width() <= minZoom) {
                    self.largeWidth = element.width() * minZoom;
                } else {
                    self.largeWidth = newImg.width;
                }
                if (newImg.height / element.height() <= minZoom) {
                    self.largeHeight = element.height() * minZoom;
                } else {
                    self.largeHeight = newImg.height;
                }
                //once image is loaded start the calls
                self.startZoom();
                self.currentImage = self.imageSrc;
                //let caller know image has been loaded
                self.options.onZoomedImageLoaded(self.$elem);
            };
            self.setImageSource(newImg, imgsrc); // this must be done AFTER setting onload

            return;
        },
        setImageSource: function (image, src) {
            //sets an image's source.
            image.src = src;
        },
        startZoom: function () {
            var self = this;
            //get dimensions of the non zoomed image
            self.nzWidth = self.$elem.width();
            self.nzHeight = self.$elem.height();

            //activated elements
            self.isWindowActive = false;
            self.isLensActive = false;
            self.isTintActive = false;
            self.overWindow = false;

            //CrossFade Wrapper
            if (self.options.imageCrossfade) {
                var elementZoomWrapper = $('<div class="zoomWrapper"/>')
                    .css({
                        height: self.nzHeight,
                        width: self.nzWidth
                    });
                if(self.$elem.parent().hasClass('zoomWrapper')){
                    self.$elem.unwrap();
                }
                self.zoomWrap = self.$elem.wrap(elementZoomWrapper);
                self.$elem.css({
                    position: 'absolute'
                });
            }

            self.zoomLock = 1;
            self.scrollingLock = false;
            self.changeBgSize = false;
            self.currentZoomLevel = self.options.zoomLevel;

            //get offset of the non zoomed image
            self.updateOffset(self);
            //calculate the width ratio of the large/small image
            self.widthRatio = (self.largeWidth / self.currentZoomLevel) / self.nzWidth;
            self.heightRatio = (self.largeHeight / self.currentZoomLevel) / self.nzHeight;

            function getWindowZoomStyle() {
                return {
                    display: 'none',
                    position: 'absolute',
                    height: self.options.zoomWindowHeight,
                    width: self.options.zoomWindowWidth,
                    border: '' + self.options.borderSize + 'px solid ' + self.options.borderColour,
                    backgroundSize: '' + (self.largeWidth / self.currentZoomLevel) + 'px ' + (self.largeHeight / self.currentZoomLevel) + 'px',
                    backgroundPosition: '0px 0px',
                    backgroundRepeat: 'no-repeat',
                    backgroundColor: '' + self.options.zoomWindowBgColour,
                    overflow: 'hidden',
                    zIndex: 100
                };
            }

            //if window zoom
            if (self.options.zoomType === 'window') {
                self.zoomWindowStyle = getWindowZoomStyle();
            }

            function getInnerZoomStyle() {
                //has a border been put on the image? Lets cater for this
                var borderWidth = self.$elem.css('border-left-width');

                if (self.options.scrollZoom)
                    self.zoomLens = $('<div class="zoomLens"/>');

                return {
                    display: 'none',
                    position: 'absolute',
                    height: self.nzHeight,
                    width: self.nzWidth,
                    marginTop: borderWidth,
                    marginLeft: borderWidth,
                    border: '' + self.options.borderSize + 'px solid ' + self.options.borderColour,
                    backgroundPosition: '0px 0px',
                    backgroundRepeat: 'no-repeat',
                    cursor: self.options.cursor,
                    overflow: 'hidden',
                    zIndex: self.options.zIndex
                };
            }

            //if inner  zoom
            if (self.options.zoomType === 'inner') {
                self.zoomWindowStyle = getInnerZoomStyle();
            }

            function getWindowLensStyle() {
                // adjust images less than the window height

                if (self.nzHeight < self.options.zoomWindowHeight / self.heightRatio) {
                    self.lensHeight = self.nzHeight;
                }
                else {
                    self.lensHeight = self.options.zoomWindowHeight / self.heightRatio;
                }
                if (self.largeWidth < self.options.zoomWindowWidth) {
                    self.lensWidth = self.nzWidth;
                }
                else {
                    self.lensWidth = self.options.zoomWindowWidth / self.widthRatio;
                }

                return {
                    display: 'none',
                    position: 'absolute',
                    height: self.lensHeight,
                    width: self.lensWidth,
                    border: '' + self.options.lensBorderSize + 'px' + ' solid ' + self.options.lensBorderColour,
                    backgroundPosition: '0px 0px',
                    backgroundRepeat: 'no-repeat',
                    backgroundColor: self.options.lensColour,
                    opacity: self.options.lensOpacity,
                    cursor: self.options.cursor,
                    zIndex: 999,
                    overflow: 'hidden'
                };
            }

            //lens style for window zoom
            if (self.options.zoomType === 'window') {
                self.lensStyle = getWindowLensStyle();
            }

            //tint style
            self.tintStyle = {
                display: 'block',
                position: 'absolute',
                height: self.nzHeight,
                width: self.nzWidth,
                backgroundColor: self.options.tintColour,
                opacity: 0
            };

            //lens style for lens zoom with optional round for modern browsers
            self.lensRound = {};

            if (self.options.zoomType === 'lens') {
                self.lensStyle = {
                    display: 'none',
                    position: 'absolute',
                    float: 'left',
                    height: self.options.lensSize,
                    width: self.options.lensSize,
                    border: '' + self.options.borderSize + 'px solid ' + self.options.borderColour,
                    backgroundPosition: '0px 0px',
                    backgroundRepeat: 'no-repeat',
                    backgroundColor: self.options.lensColour,
                    cursor: self.options.cursor
                };
            }

            //does not round in all browsers
            if (self.options.lensShape === 'round') {
                self.lensRound = {
                    borderRadius: self.options.lensSize / 2 + self.options.borderSize
                };
            }

            //create the div's                                                + ""
            //self.zoomContainer = $('<div/>').addClass('zoomContainer').css({"position":"relative", "height":self.nzHeight, "width":self.nzWidth});

            self.zoomContainer = $('<div class="' + self.options.container + '" ' + 'uuid="' + self.options.zoomId + '"/>');
            self.zoomContainer.css({
                position: 'absolute',
                top: self.nzOffset.top,
                left: self.nzOffset.left,
                height: self.nzHeight,
                width: self.nzWidth,
                zIndex: self.options.zIndex
            });
            if (self.$elem.attr('id')) {
                self.zoomContainer.attr('id', self.$elem.attr('id') + '-' + self.options.container);
            }
            $('.' + self.options.container + '[uuid="' + self.options.zoomId + '"]').remove();
            $(self.options.zoomContainerAppendTo).append(self.zoomContainer);

            //this will add overflow hidden and contrain the lens on lens mode
            if (self.options.containLensZoom && self.options.zoomType === 'lens') {
                self.zoomContainer.css('overflow', 'hidden');
            }
            if (self.options.zoomType !== 'inner') {
                self.zoomLens = $('<div class="zoomLens"/>')
                    .css($.extend({}, self.lensStyle, self.lensRound))
                    .appendTo(self.zoomContainer)
                    .click(function () {
                        self.$elem.trigger('click');
                    });

                if (self.options.tint) {
                    self.tintContainer = $('<div class="tintContainer"/>');
                    self.zoomTint = $('<div class="zoomTint"/>').css(self.tintStyle);

                    self.zoomLens.wrap(self.tintContainer);

                    self.zoomTintcss = self.zoomLens.after(self.zoomTint);

                    //if tint enabled - set an image to show over the tint

                    self.zoomTintImage = $('<img src="' + self.$elem.attr('src') + '">')
                        .css({
                            position: 'absolute',
                            top: 0,
                            left: 0,
                            height: self.nzHeight,
                            width: self.nzWidth,
                            maxWidth: 'none'
                        })
                        .appendTo(self.zoomLens)
                        .click(function () {
                            self.$elem.trigger('click');
                        });
                }
            }

            //create zoom window
            var targetZoomContainer = isNaN(self.options.zoomWindowPosition) ? 'body' : self.zoomContainer;
            self.zoomWindow = $('<div class="zoomWindow"/>')
                .css($.extend({
                    zIndex: 999,
                    top: self.windowOffsetTop,
                    left: self.windowOffsetLeft,
                }, self.zoomWindowStyle))
                .appendTo(targetZoomContainer).click(function () {
                    self.$elem.trigger('click');
                });
            self.zoomWindowContainer = $('<div class="zoomWindowContainer" />')
                .css({
                    width: self.options.zoomWindowWidth
                });
            self.zoomWindow.wrap(self.zoomWindowContainer);

            if (self.options.zoomType === 'lens') {
                self.zoomContainer.css('display', 'none');
                self.zoomLens.css({
                    backgroundImage: 'url("' + self.imageSrc + '")'
                });
            }
            if (self.options.zoomType === 'window') {
                self.zoomWindow.css({
                    backgroundImage: 'url("' + self.imageSrc + '")'
                });
            }
            if (self.options.zoomType === 'inner') {
                self.zoomWindow.css({
                    backgroundImage: 'url("' + self.imageSrc + '")'
                });
            }

            /*-------------------END THE ZOOM WINDOW AND LENS----------------------------------*/
            if (self.options.touchEnabled) {
                //touch events
                self.$elem.on('touchmove.ezpspace', function (e) {
                    e.preventDefault();
                    var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
                    self.setPosition(touch);
                });
                self.zoomContainer.on('touchmove.ezpspace', function (e) {
                    self.setElements('show');
                    e.preventDefault();
                    var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
                    self.setPosition(touch);

                });
                self.zoomContainer
                    .add(self.$elem)
                    .on('touchend.ezpspace', function (e) {
                        self.showHideWindow('hide');
                        if (self.options.showLens) {
                            self.showHideLens('hide');
                        }
                        if (self.options.tint && self.options.zoomType !== 'inner') {
                            self.showHideTint('hide');
                        }
                    });

                if (self.options.showLens) {
                    self.zoomLens.on('touchmove.ezpspace', function (e) {

                        e.preventDefault();
                        var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
                        self.setPosition(touch);
                    });

                    self.zoomLens.on('touchend.ezpspace', function (e) {
                        self.showHideWindow('hide');
                        if (self.options.showLens) {
                            self.showHideLens('hide');
                        }
                        if (self.options.tint && self.options.zoomType !== 'inner') {
                            self.showHideTint('hide');
                        }
                    });
                }
            }

            // Needed to work in IE
            self.zoomContainer.on('click.ezpspace touchstart.ezpspace', self.options.onImageClick);

            self.zoomContainer
                .add(self.$elem)
                .on('mousemove.ezpspace', function (e) {
                    if (self.overWindow === false) {
                        self.setElements('show');
                    }
                    mouseMoveZoomHandler(e);
                });

            function mouseMoveZoomHandler(e) {
                //self.overWindow = true;
                //make sure on orientation change the setposition is not fired
                if (self.lastX !== e.clientX || self.lastY !== e.clientY) {
                    self.setPosition(e);
                    self.currentLoc = e;
                }
                self.lastX = e.clientX;
                self.lastY = e.clientY;
            }

            var elementToTrack = null;
            if (self.options.zoomType !== 'inner') {
                elementToTrack = self.zoomLens;
            }
            if (self.options.tint && self.options.zoomType !== 'inner') {
                elementToTrack = self.zoomTint;
            }
            if (self.options.zoomType === 'inner') {
                elementToTrack = self.zoomWindow;
            }

            //register the mouse tracking
            if (elementToTrack) {
                elementToTrack.on('mousemove.ezpspace', mouseMoveZoomHandler);
            }

            //  lensFadeOut: 500,  zoomTintFadeIn
            self.zoomContainer
                .add(self.$elem)
                .hover(function () {
                    if (self.overWindow === false) {
                        self.setElements('show');
                    }
                }, function () {
                    if (!self.scrollLock) {
                        self.setElements('hide');
                        self.options.onDestroy(self.$elem);
                    }
                });
            //end ove image

            if (self.options.zoomType !== 'inner') {
                self.zoomWindow.hover(function () {
                    self.overWindow = true;
                    self.setElements('hide');
                }, function () {
                    self.overWindow = false;
                });
            }
            //end ove image

            // var delta = parseInt(e.originalEvent.wheelDelta || -e.originalEvent.detail);

            //      $(this).empty();
            //    return false;

            //fix for initial zoom setting
            //if (self.options.zoomLevel !== 1) {
            //    	self.changeZoomLevel(self.currentZoomLevel);
            //}
            //set the min zoomlevel
            if (self.options.minZoomLevel) {
                self.minZoomLevel = self.options.minZoomLevel;
            }
            else {
                self.minZoomLevel = self.options.scrollZoomIncrement * 2;
            }

            if (self.options.scrollZoom) {
                //see compatibility of mouse events at https://developer.mozilla.org/en-US/docs/Web/Events/mousewheel
                self.zoomContainer.add(self.$elem).on('wheel DOMMouseScroll MozMousePixelScroll', function (e) {
                    // in IE there is issue with firing of mouseleave - So check whether still scrolling
                    // and on mouseleave check if scrolllock
                    self.scrollLock = true;
                    clearTimeout($.data(this, 'timer'));
                    $.data(this, 'timer', setTimeout(function () {
                        self.scrollLock = false;
                        //do something
                    }, 250));

                    var theEvent = e.originalEvent.deltaY || e.originalEvent.detail * -1;

                    //this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30;
                    //   e.preventDefault();

                    e.stopImmediatePropagation();
                    e.stopPropagation();
                    e.preventDefault();

                    if (theEvent === 0) {
                        // fixes last event inversion bug
                        return false;
                    }
                    var nextZoomLevel;
                    if (theEvent / 120 > 0) {
                        nextZoomLevel = parseFloat(self.currentZoomLevel) - self.options.scrollZoomIncrement;
                        //scrolling up
                        if (nextZoomLevel >= parseFloat(self.minZoomLevel)) {
                            self.changeZoomLevel(nextZoomLevel);
                        }
                    }
                    else {
                        //scrolling down

                        //Check if it has to maintain original zoom window aspect ratio or not
                        if ((!self.fullheight && !self.fullwidth) || !self.options.mantainZoomAspectRatio) {
                            nextZoomLevel = parseFloat(self.currentZoomLevel) + self.options.scrollZoomIncrement;

                            if (self.options.maxZoomLevel) {
                                if (nextZoomLevel <= self.options.maxZoomLevel) {
                                    self.changeZoomLevel(nextZoomLevel);
                                }
                            }
                            else {
                                //andy
                                self.changeZoomLevel(nextZoomLevel);
                            }
                        }
                    }
                    return false;
                });
            }
        },
        destroy: function () {
            var self = this;
            self.$elem.off('.ezpspace');
            self.$galleries.off('.ezpspace');
            $(self.zoomContainer).remove();
            if (self.options.loadingIcon && !!self.spinner && !!self.spinner.length) {
                self.spinner.remove();
                delete self.spinner;
            }
        },
        getIdentifier: function () {
            var self = this;
            return self.options.zoomId;
        },
        setElements: function (type) {
            var self = this;
            if (!self.options.zoomEnabled) {
                return false;
            }
            if (type === 'show') {
                if (self.isWindowSet) {
                    if (self.options.zoomType === 'inner') {
                        self.showHideWindow('show');
                    }
                    if (self.options.zoomType === 'window') {
                        self.showHideWindow('show');
                    }
                    if (self.options.showLens) {
                        self.showHideZoomContainer('show');
                        self.showHideLens('show');
                    }
                    if (self.options.tint && self.options.zoomType !== 'inner') {
                        self.showHideTint('show');
                    }
                }
            }

            if (type === 'hide') {
                if (self.options.zoomType === 'window') {
                    self.showHideWindow('hide');
                }
                if (!self.options.tint) {
                    self.showHideWindow('hide');
                }
                if (self.options.showLens) {
                    self.showHideZoomContainer('hide');
                    self.showHideLens('hide');
                }
                if (self.options.tint) {
                    self.showHideTint('hide');
                }
            }
        },
        setPosition: function (e) {

            var self = this;

            if (!self.options.zoomEnabled || e === undefined) {
                return false;
            }

            //recaclc offset each time in case the image moves
            //this can be caused by other on page elements
            self.nzHeight = self.$elem.height();
            self.nzWidth = self.$elem.width();
            self.updateOffset(self);

            if (self.options.tint && self.options.zoomType !== 'inner') {
                self.zoomTint.css({
                    top: 0,
                    left: 0
                });
            }
            //set responsive
            //will checking if the image needs changing before running this code work faster?
            if (self.options.responsive && !self.options.scrollZoom) {
                if (self.options.showLens) {
                    var lensHeight, lensWidth;
                    if (self.nzHeight < self.options.zoomWindowWidth / self.widthRatio) {
                        self.lensHeight = self.nzHeight;
                    }
                    else {
                        self.lensHeight = self.options.zoomWindowHeight / self.heightRatio;
                    }
                    if (self.largeWidth < self.options.zoomWindowWidth) {
                        self.lensWidth = self.nzWidth;
                    }
                    else {
                        self.lensWidth = (self.options.zoomWindowWidth / self.widthRatio);
                    }
                    self.widthRatio = self.largeWidth / self.nzWidth;
                    self.heightRatio = self.largeHeight / self.nzHeight;
                    if (self.options.zoomType !== 'lens') {
                        //possibly dont need to keep recalcalculating
                        //if the lens is heigher than the image, then set lens size to image size
                        if (self.nzHeight < self.options.zoomWindowWidth / self.widthRatio) {
                            self.lensHeight = self.nzHeight;

                        }
                        else {
                            self.lensHeight = self.options.zoomWindowHeight / self.heightRatio;
                        }

                        if (self.nzWidth < self.options.zoomWindowHeight / self.heightRatio) {
                            self.lensWidth = self.nzWidth;
                        }
                        else {
                            self.lensWidth = self.options.zoomWindowWidth / self.widthRatio;
                        }

                        self.zoomLens.css({
                            width: self.lensWidth,
                            height: self.lensHeight
                        });

                        if (self.options.tint) {
                            self.zoomTintImage.css({
                                width: self.nzWidth,
                                height: self.nzHeight
                            });
                        }

                    }
                    if (self.options.zoomType === 'lens') {
                        self.zoomLens.css({
                            width: self.options.lensSize,
                            height: self.options.lensSize
                        });
                    }
                    //end responsive image change
                }
            }

            //container fix
            self.zoomContainer.css({
                top: self.nzOffset.top,
                left: self.nzOffset.left,
                width: self.nzWidth,  // new code
                height: self.nzHeight // new code
            });
            self.mouseLeft = parseInt(e.pageX - self.pageOffsetX - self.nzOffset.left);
            self.mouseTop = parseInt(e.pageY - self.pageOffsetY - self.nzOffset.top);
            //calculate the Location of the Lens

            //calculate the bound regions - but only if zoom window
            if (self.options.zoomType === 'window') {
                var zoomLensHeight = self.zoomLens.height() / 2;
                var zoomLensWidth = self.zoomLens.width() / 2;
                self.Etoppos = (self.mouseTop < 0 + zoomLensHeight);
                self.Eboppos = (self.mouseTop > self.nzHeight - zoomLensHeight - (self.options.lensBorderSize * 2));
                self.Eloppos = (self.mouseLeft < 0 + zoomLensWidth);
                self.Eroppos = (self.mouseLeft > (self.nzWidth - zoomLensWidth - (self.options.lensBorderSize * 2)));
            }
            //calculate the bound regions - but only for inner zoom
            if (self.options.zoomType === 'inner') {
                self.Etoppos = (self.mouseTop < ((self.nzHeight / 2) / self.heightRatio));
                self.Eboppos = (self.mouseTop > (self.nzHeight - ((self.nzHeight / 2) / self.heightRatio)));
                self.Eloppos = (self.mouseLeft < 0 + (((self.nzWidth / 2) / self.widthRatio)));
                self.Eroppos = (self.mouseLeft > (self.nzWidth - (self.nzWidth / 2) / self.widthRatio - (self.options.lensBorderSize * 2)));
            }

            // if the mouse position of the slider is one of the outerbounds, then hide  window and lens
            if (self.mouseLeft < 0 || self.mouseTop < 0 || self.mouseLeft > self.nzWidth || self.mouseTop > self.nzHeight) {
                self.setElements('hide');
                return;
            }
            //else continue with operations
            else {
                //lens options
                if (self.options.showLens) {
                    //		self.showHideLens('show');
                    //set background position of lens
                    self.lensLeftPos = Math.floor(self.mouseLeft - self.zoomLens.width() / 2);
                    self.lensTopPos = Math.floor(self.mouseTop - self.zoomLens.height() / 2);
                }
                //adjust the background position if the mouse is in one of the outer regions

                //Top region
                if (self.Etoppos) {
                    self.lensTopPos = 0;
                }
                //Left Region
                if (self.Eloppos) {
                    self.windowLeftPos = 0;
                    self.lensLeftPos = 0;
                    self.tintpos = 0;
                }
                //Set bottom and right region for window mode
                if (self.options.zoomType === 'window') {
                    if (self.Eboppos) {
                        self.lensTopPos = Math.max((self.nzHeight) - self.zoomLens.height() - (self.options.lensBorderSize * 2), 0);
                    }
                    if (self.Eroppos) {
                        self.lensLeftPos = (self.nzWidth - (self.zoomLens.width()) - (self.options.lensBorderSize * 2));
                    }
                }
                //Set bottom and right region for inner mode
                if (self.options.zoomType === 'inner') {
                    if (self.Eboppos) {
                        self.lensTopPos = Math.max(((self.nzHeight) - (self.options.lensBorderSize * 2)), 0);
                    }
                    if (self.Eroppos) {
                        self.lensLeftPos = (self.nzWidth - (self.nzWidth) - (self.options.lensBorderSize * 2));
                    }
                }
                //if lens zoom
                if (self.options.zoomType === 'lens') {

                    self.windowLeftPos = ((e.pageX - self.pageOffsetX - self.nzOffset.left) * self.widthRatio - self.zoomLens.width() / 2) * -1;
                    self.windowTopPos = ((e.pageY - self.pageOffsetY - self.nzOffset.top) * self.heightRatio - self.zoomLens.height() / 2) * -1;
                    self.zoomLens.css({
                        backgroundPosition: '' + self.windowLeftPos + 'px ' + self.windowTopPos + 'px'
                    });

                    if (self.changeBgSize) {
                        if (self.nzHeight > self.nzWidth) {
                            if (self.options.zoomType === 'lens') {
                                self.zoomLens.css({
                                    backgroundSize: '' +
                                    (self.largeWidth / self.newvalueheight) + 'px ' +
                                    (self.largeHeight / self.newvalueheight) + 'px'
                                });
                            }

                            self.zoomWindow.css({
                                backgroundSize: '' +
                                (self.largeWidth / self.newvalueheight) + 'px ' +
                                (self.largeHeight / self.newvalueheight) + 'px'
                            });
                        }
                        else {
                            if (self.options.zoomType === 'lens') {
                                self.zoomLens.css({
                                    backgroundSize: '' +
                                    (self.largeWidth / self.newvaluewidth) + 'px ' +
                                    (self.largeHeight / self.newvaluewidth) + 'px'
                                });
                            }
                            self.zoomWindow.css({
                                backgroundSize: '' +
                                (self.largeWidth / self.newvaluewidth) + 'px ' +
                                (self.largeHeight / self.newvaluewidth) + 'px'
                            });
                        }
                        self.changeBgSize = false;
                    }

                    self.setWindowPosition(e);
                }
                //if tint zoom
                if (self.options.tint && self.options.zoomType !== 'inner') {
                    self.setTintPosition(e);
                }
                //set the css background position
                if (self.options.zoomType === 'window') {
                    self.setWindowPosition(e);
                }
                if (self.options.zoomType === 'inner') {
                    self.setWindowPosition(e);
                }
                if (self.options.showLens) {
                    if (self.fullwidth && self.options.zoomType !== 'lens') {
                        self.lensLeftPos = 0;
                    }
                    self.zoomLens.css({
                        left: self.lensLeftPos,
                        top: self.lensTopPos
                    });
                }

            } //end else
        },
        showHideZoomContainer: function (change) {
            var self = this;
            if (change === 'show') {
                if (self.zoomContainer) {
                    self.zoomContainer.show();
                }
            }
            if (change === 'hide') {
                if (self.zoomContainer) {
                    self.zoomContainer.hide();
                }
            }
        },
        showHideWindow: function (change) {
            var self = this;
            if (change === 'show') {
                if (!self.isWindowActive && self.zoomWindow) {
                    self.options.onShow(self);
                    if (self.options.zoomWindowFadeIn) {
                        self.zoomWindow.stop(true, true, false).fadeIn(self.options.zoomWindowFadeIn);
                    }
                    else {
                        self.zoomWindow.show();
                    }
                    self.isWindowActive = true;
                }
            }
            if (change === 'hide') {
                if (self.isWindowActive) {
                    if (self.options.zoomWindowFadeOut) {
                        self.zoomWindow.stop(true, true).fadeOut(self.options.zoomWindowFadeOut, function () {
                            if (self.loop) {
                                //stop moving the zoom window when zoom window is faded out
                                clearInterval(self.loop);
                                self.loop = false;
                            }
                        });
                    }
                    else {
                        self.zoomWindow.hide();
                    }
                    self.options.onHide(self);
                    self.isWindowActive = false;
                }
            }
        },
        showHideLens: function (change) {
            var self = this;
            if (change === 'show') {
                if (!self.isLensActive) {
                    if (self.zoomLens) {
                        if (self.options.lensFadeIn) {
                            self.zoomLens.stop(true, true, false).fadeIn(self.options.lensFadeIn);
                        }
                        else {
                            self.zoomLens.show();
                        }
                    }
                    self.isLensActive = true;
                }
            }
            if (change === 'hide') {
                if (self.isLensActive) {
                    if (self.zoomLens) {
                        if (self.options.lensFadeOut) {
                            self.zoomLens.stop(true, true).fadeOut(self.options.lensFadeOut);
                        }
                        else {
                            self.zoomLens.hide();
                        }
                    }
                    self.isLensActive = false;
                }
            }
        },
        showHideTint: function (change) {
            var self = this;
            if (change === 'show') {
                if (!self.isTintActive && self.zoomTint) {

                    if (self.options.zoomTintFadeIn) {
                        self.zoomTint.css('opacity', self.options.tintOpacity).animate().stop(true, true).fadeIn('slow');
                    }
                    else {
                        self.zoomTint.css('opacity', self.options.tintOpacity).animate();
                        self.zoomTint.show();
                    }
                    self.isTintActive = true;
                }
            }
            if (change === 'hide') {
                if (self.isTintActive) {

                    if (self.options.zoomTintFadeOut) {
                        self.zoomTint.stop(true, true).fadeOut(self.options.zoomTintFadeOut);
                    }
                    else {
                        self.zoomTint.hide();
                    }
                    self.isTintActive = false;
                }
            }
        },

        setLensPosition: function (e) {
        },

        setWindowPosition: function (e) {
            //return obj.slice( 0, count );
            var self = this;

            if (!isNaN(self.options.zoomWindowPosition)) {

                switch (self.options.zoomWindowPosition) {
                    case 1: //done
                        self.windowOffsetTop = (self.options.zoomWindowOffsetY);//DONE - 1
                        self.windowOffsetLeft = (+self.nzWidth); //DONE 1, 2, 3, 4, 16
                        break;
                    case 2:
                        if (self.options.zoomWindowHeight > self.nzHeight) { //positive margin

                            self.windowOffsetTop = ((self.options.zoomWindowHeight / 2) - (self.nzHeight / 2)) * (-1);
                            self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16
                        }
                        else { //negative margin
                            $.noop();
                        }
                        break;
                    case 3: //done
                        self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize * 2)); //DONE 3,9
                        self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16
                        break;
                    case 4: //done
                        self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
                        self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16
                        break;
                    case 5: //done
                        self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
                        self.windowOffsetLeft = (self.nzWidth - self.zoomWindow.width() - (self.options.borderSize * 2)); //DONE - 5,15
                        break;
                    case 6:
                        if (self.options.zoomWindowHeight > self.nzHeight) { //positive margin
                            self.windowOffsetTop = (self.nzHeight);  //DONE - 4,5,6,7,8

                            self.windowOffsetLeft = ((self.options.zoomWindowWidth / 2) - (self.nzWidth / 2) + (self.options.borderSize * 2)) * (-1);
                        }
                        else { //negative margin
                            $.noop();
                        }

                        break;
                    case 7: //done
                        self.windowOffsetTop = (self.nzHeight);  //DONE - 4,5,6,7,8
                        self.windowOffsetLeft = 0; //DONE 7, 13
                        break;
                    case 8: //done
                        self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
                        self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1);  //DONE 8,9,10,11,12
                        break;
                    case 9:  //done
                        self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize * 2)); //DONE 3,9
                        self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1);  //DONE 8,9,10,11,12
                        break;
                    case 10:
                        if (self.options.zoomWindowHeight > self.nzHeight) { //positive margin

                            self.windowOffsetTop = ((self.options.zoomWindowHeight / 2) - (self.nzHeight / 2)) * (-1);
                            self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1);  //DONE 8,9,10,11,12
                        }
                        else { //negative margin
                            $.noop();
                        }
                        break;
                    case 11:
                        self.windowOffsetTop = (self.options.zoomWindowOffsetY);
                        self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1);  //DONE 8,9,10,11,12
                        break;
                    case 12: //done
                        self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16
                        self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1);  //DONE 8,9,10,11,12
                        break;
                    case 13: //done
                        self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16
                        self.windowOffsetLeft = (0); //DONE 7, 13
                        break;
                    case 14:
                        if (self.options.zoomWindowHeight > self.nzHeight) { //positive margin
                            self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16

                            self.windowOffsetLeft = ((self.options.zoomWindowWidth / 2) - (self.nzWidth / 2) + (self.options.borderSize * 2)) * (-1);
                        }
                        else { //negative margin
                            $.noop();
                        }
                        break;
                    case 15://done
                        self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16
                        self.windowOffsetLeft = (self.nzWidth - self.zoomWindow.width() - (self.options.borderSize * 2)); //DONE - 5,15
                        break;
                    case 16:  //done
                        self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16
                        self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16
                        break;
                    default: //done
                        self.windowOffsetTop = (self.options.zoomWindowOffsetY);//DONE - 1
                        self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16
                }
            } //end isNAN
            else {
                // For BC purposes, treat passed element as ID if element not found
                self.externalContainer = $(self.options.zoomWindowPosition);
                if (!self.externalContainer.length) {
                    self.externalContainer = $('#' + self.options.zoomWindowPosition);
                }

                self.externalContainerWidth = self.externalContainer.width();
                self.externalContainerHeight = self.externalContainer.height();
                self.externalContainerOffset = self.externalContainer.offset();

                self.windowOffsetTop = self.externalContainerOffset.top;//DONE - 1
                self.windowOffsetLeft = self.externalContainerOffset.left; //DONE 1, 2, 3, 4, 16

            }
            self.isWindowSet = true;
            self.windowOffsetTop = self.windowOffsetTop + self.options.zoomWindowOffsetY;
            self.windowOffsetLeft = self.windowOffsetLeft + self.options.zoomWindowOffsetX;

            self.zoomWindow.css({
                top: self.windowOffsetTop,
                left: self.windowOffsetLeft
            });

            if (self.options.zoomType === 'inner') {
                self.zoomWindow.css({
                    top: 0,
                    left: 0
                });

            }

            self.windowLeftPos = ((e.pageX - self.pageOffsetX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * -1;
            self.windowTopPos = ((e.pageY - self.pageOffsetY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * -1;
            if (self.Etoppos) {
                self.windowTopPos = 0;
            }
            if (self.Eloppos) {
                self.windowLeftPos = 0;
            }
            if (self.Eboppos) {
                self.windowTopPos = (self.largeHeight / self.currentZoomLevel - self.zoomWindow.height()) * (-1);
            }
            if (self.Eroppos) {
                self.windowLeftPos = ((self.largeWidth / self.currentZoomLevel - self.zoomWindow.width()) * (-1));
            }

            //stops micro movements
            if (self.fullheight) {
                self.windowTopPos = 0;
            }
            if (self.fullwidth) {
                self.windowLeftPos = 0;
            }

            //set the css background position
            if (self.options.zoomType === 'window' || self.options.zoomType === 'inner') {

                if (self.zoomLock === 1) {
                    //overrides for images not zoomable
                    if (self.widthRatio <= 1) {
                        self.windowLeftPos = 0;
                    }
                    if (self.heightRatio <= 1) {
                        self.windowTopPos = 0;
                    }
                }
                // adjust images less than the window height

                // if (self.options.zoomType === 'window') {
                //     if (self.largeHeight < self.options.zoomWindowHeight) {
                //         self.windowTopPos = 0;
                //     }
                //     if (self.largeWidth < self.options.zoomWindowWidth) {
                //         self.windowLeftPos = 0;
                //     }
                // }
                //set the zoomwindow background position
                if (self.options.easing) {

                    //     if(self.changeZoom){
                    //           clearInterval(self.loop);
                    //           self.changeZoom = false;
                    //           self.loop = false;

                    //            }
                    //set the pos to 0 if not set
                    if (!self.xp) {
                        self.xp = 0;
                    }
                    if (!self.yp) {
                        self.yp = 0;
                    }
                    var interval = 16;
                    var easingInterval = parseInt(self.options.easing);
                    if (typeof easingInterval === 'number' && isFinite(easingInterval) && Math.floor(easingInterval) === easingInterval) {
                        interval = easingInterval;
                    }
                    //if loop not already started, then run it
                    if (!self.loop) {
                        self.loop = setInterval(function () {
                            //using zeno's paradox

                            self.xp += (self.windowLeftPos - self.xp) / self.options.easingAmount;
                            self.yp += (self.windowTopPos - self.yp) / self.options.easingAmount;
                            if (self.scrollingLock) {

                                clearInterval(self.loop);
                                self.xp = self.windowLeftPos;
                                self.yp = self.windowTopPos;

                                self.xp = ((e.pageX - self.pageOffsetX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * (-1);
                                self.yp = (((e.pageY - self.pageOffsetY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * (-1));

                                if (self.changeBgSize) {
                                    if (self.nzHeight > self.nzWidth) {
                                        if (self.options.zoomType === 'lens') {
                                            self.zoomLens.css({
                                                backgroundSize: '' +
                                                    (self.largeWidth / self.newvalueheight) + 'px ' +
                                                    (self.largeHeight / self.newvalueheight) + 'px'
                                            });
                                        }
                                        self.zoomWindow.css({
                                            backgroundSize: '' +
                                                (self.largeWidth / self.newvalueheight) + 'px ' +
                                                (self.largeHeight / self.newvalueheight) + 'px'
                                        });
                                    }
                                    else {
                                        if (self.options.zoomType !== 'lens') {
                                            self.zoomLens.css({
                                                backgroundSize: '' +
                                                    (self.largeWidth / self.newvaluewidth) + 'px ' +
                                                    (self.largeHeight / self.newvalueheight) + 'px'
                                            });
                                        }
                                        self.zoomWindow.css({
                                            backgroundSize: '' +
                                                (self.largeWidth / self.newvaluewidth) + 'px ' +
                                                (self.largeHeight / self.newvaluewidth) + 'px'
                                        });
                                    }

                                    /*
                                     if(!self.bgxp){self.bgxp = self.largeWidth/self.newvalue;}
                                     if(!self.bgyp){self.bgyp = self.largeHeight/self.newvalue ;}
                                     if (!self.bgloop){
                                     self.bgloop = setInterval(function(){

                                     self.bgxp += (self.largeWidth/self.newvalue  - self.bgxp) / self.options.easingAmount;
                                     self.bgyp += (self.largeHeight/self.newvalue  - self.bgyp) / self.options.easingAmount;

                                     self.zoomWindow.css('background-size', self.bgxp + 'px ' + self.bgyp + 'px' );


                                     }, 16);

                                     }
                                     */
                                    self.changeBgSize = false;
                                }

                                self.zoomWindow.css({
                                    backgroundPosition: '' + self.windowLeftPos + 'px ' + self.windowTopPos + 'px'
                                });
                                self.scrollingLock = false;
                                self.loop = false;

                            }
                            else if (Math.round(Math.abs(self.xp - self.windowLeftPos) + Math.abs(self.yp - self.windowTopPos)) < 1) {
                                //stops micro movements
                                clearInterval(self.loop);
                                self.zoomWindow.css({
                                    backgroundPosition: '' + self.windowLeftPos + 'px ' + self.windowTopPos + 'px'
                                });
                                self.loop = false;
                            }
                            else {
                                if (self.changeBgSize) {
                                    if (self.nzHeight > self.nzWidth) {
                                        if (self.options.zoomType === 'lens') {
                                            self.zoomLens.css({
                                                backgroundSize: '' +
                                                (self.largeWidth / self.newvalueheight) + 'px ' +
                                                (self.largeHeight / self.newvalueheight) + 'px'
                                            });
                                        }
                                        self.zoomWindow.css({
                                            backgroundSize: '' +
                                            (self.largeWidth / self.newvalueheight) + 'px ' +
                                            (self.largeHeight / self.newvalueheight) + 'px'
                                        });
                                    }
                                    else {
                                        if (self.options.zoomType !== 'lens') {
                                            self.zoomLens.css({
                                                backgroundSize: '' +
                                                (self.largeWidth / self.newvaluewidth) + 'px ' +
                                                (self.largeHeight / self.newvaluewidth) + 'px'
                                            });
                                        }
                                        self.zoomWindow.css({
                                            backgroundSize: '' +
                                            (self.largeWidth / self.newvaluewidth) + 'px ' +
                                            (self.largeHeight / self.newvaluewidth) + 'px'
                                        });
                                    }
                                    self.changeBgSize = false;
                                }

                                self.zoomWindow.css({
                                    backgroundPosition: '' + self.xp + 'px ' + self.yp + 'px'
                                });
                            }
                        }, interval);
                    }
                }
                else {
                    if (self.changeBgSize) {
                        if (self.nzHeight > self.nzWidth) {
                            if (self.options.zoomType === 'lens') {
                                self.zoomLens.css({
                                    backgroundSize: '' +
                                    (self.largeWidth / self.newvalueheight) + 'px ' +
                                    (self.largeHeight / self.newvalueheight) + 'px'
                                });
                            }

                            self.zoomWindow.css({
                                backgroundSize: '' +
                                (self.largeWidth / self.newvalueheight) + 'px ' +
                                (self.largeHeight / self.newvalueheight) + 'px'
                            });
                        }
                        else {
                            if (self.options.zoomType === 'lens') {
                                self.zoomLens.css({
                                    backgroundSize: '' +
                                    (self.largeWidth / self.newvaluewidth) + 'px ' +
                                    (self.largeHeight / self.newvaluewidth) + 'px'
                                });
                            }
                            if ((self.largeHeight / self.newvaluewidth) < self.options.zoomWindowHeight) {

                                self.zoomWindow.css({
                                    backgroundSize: '' +
                                    (self.largeWidth / self.newvaluewidth) + 'px ' +
                                    (self.largeHeight / self.newvaluewidth) + 'px'
                                });
                            }
                            else {

                                self.zoomWindow.css({
                                    backgroundSize: '' +
                                    (self.largeWidth / self.newvalueheight) + 'px ' +
                                    (self.largeHeight / self.newvalueheight) + 'px'
                                });
                            }

                        }
                        self.changeBgSize = false;
                    }

                    self.zoomWindow.css({
                        backgroundPosition: '' +
                        self.windowLeftPos + 'px ' +
                        self.windowTopPos + 'px'
                    });
                }
            }
        },

        setTintPosition: function (e) {
            var self = this;
            var zoomLensWidth = self.zoomLens.width();
            var zoomLensHeight = self.zoomLens.height();
            self.updateOffset(self);
            self.tintpos = ((e.pageX - self.pageOffsetX - self.nzOffset.left) - (zoomLensWidth / 2)) * -1;
            self.tintposy = ((e.pageY - self.pageOffsetY - self.nzOffset.top) - zoomLensHeight / 2) * -1;
            if (self.Etoppos) {
                self.tintposy = 0;
            }
            if (self.Eloppos) {
                self.tintpos = 0;
            }
            if (self.Eboppos) {
                self.tintposy = (self.nzHeight - zoomLensHeight - (self.options.lensBorderSize * 2)) * (-1);
            }
            if (self.Eroppos) {
                self.tintpos = ((self.nzWidth - zoomLensWidth - (self.options.lensBorderSize * 2)) * (-1));
            }
            if (self.options.tint) {
                //stops micro movements
                if (self.fullheight) {
                    self.tintposy = 0;

                }
                if (self.fullwidth) {
                    self.tintpos = 0;

                }
                self.zoomTintImage.css({
                    left: self.tintpos,
                    top: self.tintposy
                });
            }
        },

        swaptheimage: function (smallimage, largeimage) {
            var self = this;
            var newImg = new Image();

            if (self.options.loadingIcon && !self.spinner) {
                var styleAttr = {
                    background: 'url("' + self.options.loadingIcon + '") no-repeat',
                    height: self.nzHeight,
                    width: self.nzWidth,
                    zIndex: 2000,
                    position: 'absolute',
                    backgroundPosition: 'center center',
                };
                if (self.options.zoomType === 'inner') {
                    styleAttr.setProperty('top', 0);
                }
                self.spinner = $('<div class="ezp-spinner"></div>')
                  .css(styleAttr);
                self.$elem.after(self.spinner);
            } else if (self.spinner) {
                self.spinner.show();
            }

            self.options.onImageSwap(self.$elem);

            newImg.onload = function () {
                self.largeWidth = newImg.width;
                self.largeHeight = newImg.height;
                self.zoomImage = largeimage;
                self.zoomWindow.css({
                    backgroundSize: '' + self.largeWidth + 'px ' + self.largeHeight + 'px'
                });

                self.swapAction(smallimage, largeimage);
                return;
            };
            self.setImageSource(newImg, largeimage);  // this must be done AFTER setting onload
        },

        swapAction: function (smallimage, largeimage) {
            var self = this;
            var elemWidth = self.$elem.width();
            var elemHeight = self.$elem.height();
            var newImg2 = new Image();
            newImg2.onload = function () {
                //re-calculate values
                self.nzHeight = newImg2.height;
                self.nzWidth = newImg2.width;
                self.options.onImageSwapComplete(self.$elem);

                self.doneCallback();
                return;
            };
            self.setImageSource(newImg2, smallimage);

            //reset the zoomlevel to that initially set in options
            self.currentZoomLevel = self.options.zoomLevel;
            self.options.maxZoomLevel = false;

            //swaps the main image
            //self.$elem.attr('src',smallimage);
            //swaps the zoom image
            if (self.options.zoomType === 'lens') {
                self.zoomLens.css('background-image', 'url("' + largeimage + '")');
            }
            if (self.options.zoomType === 'window') {
                self.zoomWindow.css('background-image', 'url("' + largeimage + '")');
            }
            if (self.options.zoomType === 'inner') {
                self.zoomWindow.css('background-image', 'url("' + largeimage + '")');
            }

            self.currentImage = largeimage;

            if (self.options.imageCrossfade) {
                var oldImg = self.$elem;
                var newImg = oldImg.clone();
                self.$elem.attr('src', smallimage);
                self.$elem.after(newImg);
                newImg.stop(true).fadeOut(self.options.imageCrossfade, function () {
                    $(this).remove();
                });

                // if(self.options.zoomType === 'inner'){
                //remove any attributes on the cloned image so we can resize later
                self.$elem.width('auto').removeAttr('width');
                self.$elem.height('auto').removeAttr('height');
                //   }

                oldImg.fadeIn(self.options.imageCrossfade);

                if (self.options.tint && self.options.zoomType !== 'inner') {

                    var oldImgTint = self.zoomTintImage;
                    var newImgTint = oldImgTint.clone();
                    self.zoomTintImage.attr('src', largeimage);
                    self.zoomTintImage.after(newImgTint);
                    newImgTint.stop(true).fadeOut(self.options.imageCrossfade, function () {
                        $(this).remove();
                    });

                    oldImgTint.fadeIn(self.options.imageCrossfade);

                    //self.zoomTintImage.attr('width',elem.data('image'));

                    //resize the tint window
                    self.zoomTint.css({
                        height: elemHeight,
                        width: elemWidth
                    });
                }

                self.zoomContainer.css({
                    'height': elemHeight,
                    'width': elemWidth
                });

                if (self.options.zoomType === 'inner') {
                    if (!self.options.constrainType) {
                        self.zoomWrap.parent().css({
                            'height': elemHeight,
                            'width': elemWidth
                        });

                        self.zoomWindow.css({
                            'height': elemHeight,
                            'width': elemWidth
                        });
                    }
                }

                if (self.options.imageCrossfade) {
                    self.zoomWrap.css({
                        'height': elemHeight,
                        'width': elemWidth
                    });
                }
            }
            else {
                self.$elem.attr('src', smallimage);
                if (self.options.tint) {
                    self.zoomTintImage.attr('src', largeimage);
                    //self.zoomTintImage.attr('width',elem.data('image'));
                    self.zoomTintImage.attr('height', elemHeight);
                    //self.zoomTintImage.attr('src') = elem.data('image');
                    self.zoomTintImage.css('height', elemHeight);
                    self.zoomTint.css('height', elemHeight);

                }
                self.zoomContainer.css({
                    'height': elemHeight,
                    'width': elemWidth
                });

                if (self.options.imageCrossfade) {
                    self.zoomWrap.css({
                        'height': elemHeight,
                        'width': elemWidth
                    });
                }
            }
            if (self.options.constrainType) {

                //This will contrain the image proportions
                if (self.options.constrainType === 'height') {

                    var autoWDimension = {
                        'height': self.options.constrainSize,
                        'width': 'auto'
                    };
                    self.zoomContainer.css(autoWDimension);

                    if (self.options.imageCrossfade) {
                        self.zoomWrap.css(autoWDimension);
                        self.constwidth = self.zoomWrap.width();
                    }
                    else {
                        self.$elem.css(autoWDimension);
                        self.constwidth = elemWidth;
                    }

                    var constWDim = {
                        'height': self.options.constrainSize,
                        'width': self.constwidth
                    };
                    if (self.options.zoomType === 'inner') {

                        self.zoomWrap.parent().css(constWDim);
                        self.zoomWindow.css(constWDim);
                    }
                    if (self.options.tint) {
                        self.tintContainer.css(constWDim);
                        self.zoomTint.css(constWDim);
                        self.zoomTintImage.css(constWDim);
                    }

                }
                if (self.options.constrainType === 'width') {
                    var autoHDimension = {
                        'height': 'auto',
                        'width': self.options.constrainSize
                    };
                    self.zoomContainer.css(autoHDimension);

                    if (self.options.imageCrossfade) {
                        self.zoomWrap.css(autoHDimension);
                        self.constheight = self.zoomWrap.height();
                    }
                    else {
                        self.$elem.css(autoHDimension);
                        self.constheight = elemHeight;
                    }

                    var constHDim = {
                        'height': self.constheight,
                        'width': self.options.constrainSize
                    };
                    if (self.options.zoomType === 'inner') {
                        self.zoomWrap.parent().css(constHDim);
                        self.zoomWindow.css(constHDim);
                    }
                    if (self.options.tint) {
                        self.tintContainer.css(constHDim);
                        self.zoomTint.css(constHDim);
                        self.zoomTintImage.css(constHDim);
                    }
                }
            }
        },

        doneCallback: function () {
            var self = this;
            if (self.options.loadingIcon && !!self.spinner && !!self.spinner.length) {
                self.spinner.hide();
            }

            self.updateOffset(self);
            self.nzWidth = self.$elem.width();
            self.nzHeight = self.$elem.height();

            // reset the zoomlevel back to default
            self.currentZoomLevel = self.options.zoomLevel;

            //ratio of the large to small image
            self.widthRatio = self.largeWidth / self.nzWidth;
            self.heightRatio = self.largeHeight / self.nzHeight;

            //NEED TO ADD THE LENS SIZE FOR ROUND
            // adjust images less than the window height
            if (self.options.zoomType === 'window') {

                if (self.nzHeight < self.options.zoomWindowHeight / self.heightRatio) {
                    self.lensHeight = self.nzHeight;

                }
                else {
                    self.lensHeight = self.options.zoomWindowHeight / self.heightRatio;
                }

                if (self.nzWidth < self.options.zoomWindowWidth) {
                    self.lensWidth = self.nzWidth;
                }
                else {
                    self.lensWidth = self.options.zoomWindowWidth / self.widthRatio;
                }

                if (self.zoomLens) {
                    self.zoomLens.css({
                        'width': self.lensWidth,
                        'height': self.lensHeight
                    });
                }
            }
        },

        getCurrentImage: function () {
            var self = this;
            return self.zoomImage;
        },

        getGalleryList: function () {
            var self = this;
            //loop through the gallery options and set them in list for fancybox
            self.gallerylist = [];
            if (self.options.gallery) {
                $('#' + self.options.gallery + ' a').each(function () {

                    var imgSrc = '';
                    if ($(this).data(self.options.attrImageZoomSrc)) {
                        imgSrc = $(this).data(self.options.attrImageZoomSrc);
                    }
                    else if ($(this).data('image')) {
                        imgSrc = $(this).data('image');
                    }
                    //put the current image at the start
                    if (imgSrc === self.zoomImage) {
                        self.gallerylist.unshift({
                            href: '' + imgSrc + '',
                            title: $(this).find('img').attr('title')
                        });
                    }
                    else {
                        self.gallerylist.push({
                            href: '' + imgSrc + '',
                            title: $(this).find('img').attr('title')
                        });
                    }
                });
            }
            //if no gallery - return current image
            else {
                self.gallerylist.push({
                    href: '' + self.zoomImage + '',
                    title: $(this).find('img').attr('title')
                });
            }
            return self.gallerylist;
        },

        changeZoomLevel: function (value) {
            var self = this;

            //flag a zoom, so can adjust the easing during setPosition
            self.scrollingLock = true;

            //round to two decimal places
            self.newvalue = parseFloat(value).toFixed(2);
            var newvalue = self.newvalue;

            //maxwidth & Maxheight of the image
            var maxheightnewvalue = self.largeHeight / ((self.options.zoomWindowHeight / self.nzHeight) * self.nzHeight);
            var maxwidthtnewvalue = self.largeWidth / ((self.options.zoomWindowWidth / self.nzWidth) * self.nzWidth);

            //calculate new heightratio
            if (self.options.zoomType !== 'inner') {
                if (maxheightnewvalue <= newvalue) {
                    self.heightRatio = (self.largeHeight / maxheightnewvalue) / self.nzHeight;
                    self.newvalueheight = maxheightnewvalue;
                    self.fullheight = true;
                }
                else {
                    self.heightRatio = (self.largeHeight / newvalue) / self.nzHeight;
                    self.newvalueheight = newvalue;
                    self.fullheight = false;
                }

                // calculate new width ratio

                if (maxwidthtnewvalue <= newvalue) {
                    self.widthRatio = (self.largeWidth / maxwidthtnewvalue) / self.nzWidth;
                    self.newvaluewidth = maxwidthtnewvalue;
                    self.fullwidth = true;
                }
                else {
                    self.widthRatio = (self.largeWidth / newvalue) / self.nzWidth;
                    self.newvaluewidth = newvalue;
                    self.fullwidth = false;
                }
                if (self.options.zoomType === 'lens') {
                    if (maxheightnewvalue <= newvalue) {
                        self.fullwidth = true;
                        self.newvaluewidth = maxheightnewvalue;
                    } else {
                        self.widthRatio = (self.largeWidth / newvalue) / self.nzWidth;
                        self.newvaluewidth = newvalue;

                        self.fullwidth = false;
                    }
                }
            }

            if (self.options.zoomType === 'inner') {
                maxheightnewvalue = parseFloat(self.largeHeight / self.nzHeight).toFixed(2);
                maxwidthtnewvalue = parseFloat(self.largeWidth / self.nzWidth).toFixed(2);
                if (newvalue > maxheightnewvalue) {
                    newvalue = maxheightnewvalue;
                }
                if (newvalue > maxwidthtnewvalue) {
                    newvalue = maxwidthtnewvalue;
                }

                if (maxheightnewvalue <= newvalue) {
                    self.heightRatio = (self.largeHeight / newvalue) / self.nzHeight;
                    if (newvalue > maxheightnewvalue) {
                        self.newvalueheight = maxheightnewvalue;
                    } else {
                        self.newvalueheight = newvalue;
                    }
                    self.fullheight = true;
                }
                else {
                    self.heightRatio = (self.largeHeight / newvalue) / self.nzHeight;

                    if (newvalue > maxheightnewvalue) {

                        self.newvalueheight = maxheightnewvalue;
                    } else {
                        self.newvalueheight = newvalue;
                    }
                    self.fullheight = false;
                }

                if (maxwidthtnewvalue <= newvalue) {

                    self.widthRatio = (self.largeWidth / newvalue) / self.nzWidth;
                    if (newvalue > maxwidthtnewvalue) {

                        self.newvaluewidth = maxwidthtnewvalue;
                    } else {
                        self.newvaluewidth = newvalue;
                    }

                    self.fullwidth = true;
                }
                else {
                    self.widthRatio = (self.largeWidth / newvalue) / self.nzWidth;
                    self.newvaluewidth = newvalue;
                    self.fullwidth = false;
                }
            } //end inner
            var scrcontinue = false;

            if (self.options.zoomType === 'inner') {
                if (self.nzWidth >= self.nzHeight) {
                    if (self.newvaluewidth <= maxwidthtnewvalue) {
                        scrcontinue = true;
                    }
                    else {
                        scrcontinue = false;
                        self.fullheight = true;
                        self.fullwidth = true;
                    }
                }
                if (self.nzHeight > self.nzWidth) {
                    if (self.newvaluewidth <= maxwidthtnewvalue) {
                        scrcontinue = true;
                    }
                    else {
                        scrcontinue = false;
                        self.fullheight = true;
                        self.fullwidth = true;
                    }
                }
            }

            if (self.options.zoomType !== 'inner') {
                scrcontinue = true;
            }

            if (scrcontinue) {
                self.zoomLock = 0;
                self.changeZoom = true;

                //if lens height is less than image height
                if (((self.options.zoomWindowHeight) / self.heightRatio) <= self.nzHeight) {
                    self.currentZoomLevel = self.newvalueheight;
                    if (self.options.zoomType !== 'lens' && self.options.zoomType !== 'inner') {
                        self.changeBgSize = true;
                        self.zoomLens.css({
                            height: self.options.zoomWindowHeight / self.heightRatio
                        });
                    }
                    if (self.options.zoomType === 'lens' || self.options.zoomType === 'inner') {
                        self.changeBgSize = true;
                    }
                }

                if ((self.options.zoomWindowWidth / self.widthRatio) <= self.nzWidth) {
                    if (self.options.zoomType !== 'inner') {
                        if (self.newvaluewidth > self.newvalueheight) {
                            self.currentZoomLevel = self.newvaluewidth;
                        }
                    }

                    if (self.options.zoomType !== 'lens' && self.options.zoomType !== 'inner') {
                        self.changeBgSize = true;

                        self.zoomLens.css({
                            width: self.options.zoomWindowWidth / self.widthRatio
                        });
                    }
                    if (self.options.zoomType === 'lens' || self.options.zoomType === 'inner') {
                        self.changeBgSize = true;
                    }

                }
                if (self.options.zoomType === 'inner') {
                    self.changeBgSize = true;

                    if (self.nzWidth > self.nzHeight) {
                        self.currentZoomLevel = self.newvaluewidth;
                    }
                    else if (self.nzHeight >= self.nzWidth) {
                        self.currentZoomLevel = self.newvaluewidth;
                    }
                }
            }      //under

            //sets the boundry change, called in setWindowPos
            self.setPosition(self.currentLoc);
            //
        },

        closeAll: function () {
            var self = this;
            if (self.zoomWindow) {
                self.zoomWindow.hide();
            }
            if (self.zoomLens) {
                self.zoomLens.hide();
            }
            if (self.zoomTint) {
                self.zoomTint.hide();
            }
        },
        updateOffset: function (self) {
            if (self.options.zoomContainerAppendTo !== 'body') {
                self.nzOffset = self.$elem.offset();
                var appendedPosition = $(self.options.zoomContainerAppendTo).offset();
                self.nzOffset.top = self.$elem.offset().top - appendedPosition.top;
                self.nzOffset.left = self.$elem.offset().left - appendedPosition.left;

                // NOTE: When initialising ezPlus on an element
                // present inside a dialog the positions will
                // not be correct unless the dialog occupies the
                // entire viewport. These page offsets will help
                // zoom lens and zoom window to be positioned
                // correctly

                // Update page offsets
                self.pageOffsetX = appendedPosition.left;
                self.pageOffsetY = appendedPosition.top;
            } else {
                self.nzOffset = self.$elem.offset();

                // Update page offsets
                self.pageOffsetX = 0;
                self.pageOffsetY = 0;
            }
        },

        changeState: function (value) {
            var self = this;
            if (value === 'enable') {
                self.options.zoomEnabled = true;
            }
            if (value === 'disable') {
                self.options.zoomEnabled = false;
            }
        },

        responsiveConfig: function (options) {
            if (options.respond && options.respond.length > 0) {
                return $.extend({}, options, this.configByScreenWidth(options));
            }
            return options;
        },

        configByScreenWidth: function (options) {
            var screenWidth = $(window).width();

            var config = $.grep(options.respond, function (item) {
                var range = item.range.split('-');
                return (screenWidth >= range[0]) && (screenWidth <= range[1]);
            });

            if (config.length > 0) {
                return config[0];
            } else {
                return options;
            }
        }
    };

    $.fn.ezPlus = function (options) {
        return this.each(function () {
            var elevate = Object.create(EZP);

            elevate.init(options, this);

            $.data(this, 'ezPlus', elevate);

        });
    };

    $.fn.ezPlus.options = {
        container: 'ZoomContainer',
        attrImageZoomSrc: 'zoom-image', // attribute to plugin use for zoom
        borderColour: '#888',
        borderSize: 4,
        constrainSize: false,  //in pixels the dimensions you want to constrain on
        constrainType: false,  //width or height
        containLensZoom: false,
        cursor: 'inherit', // user should set to what they want the cursor as, if they have set a click function
        debug: false,
        easing: false,
        easingAmount: 12,
        enabled: true,

        gallery: false,
        galleryActiveClass: 'zoomGalleryActive',
        gallerySelector: false,
        galleryItem: 'a',
        galleryEvent: 'click',

        imageCrossfade: false,

        lensBorderColour: '#000',
        lensBorderSize: 1,
        lensColour: 'white', //colour of the lens background
        lensFadeIn: false,
        lensFadeOut: false,
        lensOpacity: 0.4, //opacity of the lens
        lensShape: 'square', //can be 'round'
        lensSize: 200,
        lenszoom: false,

        loadingIcon: false, //http://www.example.com/spinner.gif

        // This change will allow to decide if you want to decrease
        // zoom of one of the dimensions once the other reached it's top value,
        // or keep the aspect ratio, default behaviour still being as always,
        // allow to continue zooming out, so it keeps retrocompatibility.
        mantainZoomAspectRatio: false,
        maxZoomLevel: false,
        minZoomLevel: 1.01,

        onComplete: $.noop,
        onDestroy: $.noop,
        onImageClick: $.noop,
        onImageSwap: $.noop,
        onImageSwapComplete: $.noop,
        onShow: $.noop,
        onHide: $.noop,
        onZoomedImageLoaded: $.noop,

        preloading: 1, //by default, load all the images, if 0, then only load images after activated (PLACEHOLDER FOR NEXT VERSION)
        respond: [],
        responsive: true,
        scrollZoom: false, //allow zoom on mousewheel, true to activate
        scrollZoomIncrement: 0.1,  //steps of the scrollzoom
        showLens: true,
        tint: false, //enable the tinting
        tintColour: '#333', //default tint color, can be anything, red, #ccc, rgb(0,0,0)
        tintOpacity: 0.4, //opacity of the tint
        touchEnabled: true,

        zoomActivation: 'hover', // Can also be click (PLACEHOLDER FOR NEXT VERSION)
        zoomContainerAppendTo: 'body', //zoom container parent selector
        zoomId: -1, // identifier for the zoom container
        zoomLevel: 1, //default zoom level of image
        zoomTintFadeIn: false,
        zoomTintFadeOut: false,
        zoomType: 'window', //window is default,  also 'lens' available -
        zoomWindowAlwaysShow: false,
        zoomWindowBgColour: '#fff',
        zoomWindowFadeIn: false,
        zoomWindowFadeOut: false,
        zoomWindowHeight: 400,
        zoomWindowOffsetX: 0,
        zoomWindowOffsetY: 0,
        zoomWindowPosition: 1, //Possible values: 1-16, but we can also position with a selector string.
        zoomWindowWidth: 400,
        zoomEnabled: true, //false disables zoomwindow from showing
        zIndex: 999
    };

})(window.jQuery, window, document);

// code for lazyload background img
var $body = $('body');

document.addEventListener('lazybeforeunveil', function (e) {
    var bg = e.target.getAttribute('data-bg');
    if (bg) {
        e.target.style.backgroundImage = 'url(' + bg + ')';
    }
});
var checkCurrentGallery = [];
$(document).ready(function () {

    //slider gallery setting
    if ($('.ns-gallery-thumb-slider-wrap').length) {
        var nsGallerySlider = $('.ns-gallery-slider-init');
        nsGallerySlider.on('beforeChange', function (event, slick, currentSlide, nextSlide) {
            $('.slick-current .ns-gallery-slide-video-wrap').removeClass('video-played');
            if ($('.slick-current .ns-gallery-slide-video-wrap').hasClass('video-internal')) {
                var $vid = $('.slick-current .ns-gallery-slide-video-wrap .video');
                $vid[0].pause();
                $vid[0].currentTime = 0;
            } else if ($('.slick-current .ns-gallery-slide-video-wrap').hasClass('video-external')) {
                var $vid = $('.slick-current .ns-gallery-slide-video-wrap iframe.video');
                $vid[0].src = '';
            }
        });
    }


    // code for video play button
    $('.btn-video-play').on('click', function(){
        $(this).parents('.ns-gallery-slide-video-wrap').addClass('video-played');
        if ($(this).parents('.ns-gallery-slide-video-wrap').hasClass('video-internal')) {
            var $vid = $(this).parents('.ns-gallery-slide-video-wrap').find('.video');
            $vid.get(0).play();
        }else {
            var $extVideo = $(this).parents('.ns-gallery-slide-video-wrap').find('iframe.video').data('src');
            console.log($extVideo);
            $(this).parents('.ns-gallery-slide-video-wrap').find('iframe.video').attr('src', $extVideo+'?autoplay=1');
        }
    });
});

$(window).on('load', function () {
    // code for Masonry & Isotope Gallery Settings
    if ($('.ns-gallery-masonry-view').length) {
        var $grid = $('.grid');
        var $img = $('img');
        $grid.isotope({
            itemSelector: '.grid-item',
        });
        var $flexGrid = $('.ns-gallery-masonry-flex .grid');
        $flexGrid.isotope({
            itemSelector: '.grid-item',
            percentPosition: true,
            masonry: {
                columnWidth: '.grid-sizer'
            }
        });
        $grid.imagesLoaded(function () {
            $img.on('load', function(){
                $grid.isotope('layout');
            });
        });
        $('.ns-gallery-isotope-filters').on('click', 'button', function () {
            checkCurrentGallery = [];
            let filterValue = $(this).attr('data-filter');
            let albumUid = $(this).attr('data-uid');
            let cuid = $(this).attr('data-contentuid');
            let url = $(this).attr('data-ajaxurl');
            getAlbums(albumUid,filterValue,url,cuid,$(this));
            $(this).parents('.ns-gallery-isotope-wrap').find('.ns-gallery-isotope-filters button').removeClass('active');
            $(this).addClass('active');
        });
    }
    if ($('.ns-gallery-mosaic-view').length) {
        var $mosaicGrid = $('.ns-gallery-mosaic-view');
        var $img = $('img');
        $mosaicGrid.isotope({
            itemSelector: '.ns-gallery-mosaic-item',
            percentPosition: true,
            masonry: {
                columnWidth: '.grid-sizer'
            }
        });
        $mosaicGrid.imagesLoaded(function () {
            $img.on('load', function(){
                $mosaicGrid.isotope('layout');
            });
        });
    }
});

function getAlbums(albumUid, filterValue,url,cuid,$this) {
    let param = {
        uid: albumUid
    }
    $.ajax({
        url : url,
        method: 'post',
        data: param,
        success: function (res) {
            $wrapper = $('.ajaxwrapper-'+cuid);
            
            let totalNews = $wrapper.children('.totalbum').val();
            let parentClassBlock = $('#ajax-' + cuid);
            let $flexGrid2;
            if(totalNews == undefined){
                $("#totNews-ajax-"+cuid).val($($.parseHTML(res)).filter("#totNews-ajax-"+cuid).val());
            } else {
                $('#totNews-ajax-'+cuid).val(totalNews);
            }
            if (parentClassBlock.parent().hasClass('ns-gallery-masonry-flex')) {
                var success =  $($.parseHTML(res)).filter(".res-"+cuid);
                var uidHidden =  $($.parseHTML(res)).filter("#album-id-ajax-"+cuid); 
                var totPage =  $($.parseHTML(res)).filter("#totPage");
                $("#album-id-ajax-"+cuid).attr("value", uidHidden[0].value);
                $("#totPage").attr("value", totPage[0].value);
                $wrapper.html('');
                $wrapper.html(success[0]);
                $flexGrid2 = $('.ajax-' + cuid + ' .grid');
            }
            if (parentClassBlock.parent().hasClass('ns-gallery-masonry-classic')) {
                var success =  $($.parseHTML(res)).filter(".ns-gallery-masonry-classic");
                var uidHidden =  $($.parseHTML(res)).filter("#album-id-ajax-"+cuid); 
                var totPage =  $($.parseHTML(res)).filter("#totPage");
                $("#album-id-ajax-"+cuid).attr("value", uidHidden[0].value);
                $("#totPage").attr("value", totPage[0].value);
                $wrapper.html('');
                $wrapper.html(success[0]);
                $flexGrid2 = $('.ajax-' + cuid + ' .grid');
            }
            if (parentClassBlock.parent().hasClass('ns-gallery-masonry-pinterest')) {
                var success =  $($.parseHTML(res)).filter(".ns-gallery-masonry-pinterest");
                var uidHidden =  $($.parseHTML(res)).filter("#album-id-ajax-"+cuid); 
                var totPage =  $($.parseHTML(res)).filter("#totPage");
                $("#album-id-ajax-"+cuid).attr("value", uidHidden[0].value);
                $("#totPage").attr("value", totPage[0].value);
                $wrapper.html('');
                $wrapper.html(success[0]);
                $flexGrid2 = $('.ajax-' + cuid + ' .grid');
            }
            if (parentClassBlock.hasClass('ns-gallery-mosaic-view2')) {
                $flexGrid2 = $('.ns-gallery-mosaic-view');
            }
            $flexGrid2.isotope();
            $flexGrid2.imagesLoaded().progress(function(){
                $flexGrid2.isotope('layout');
            });
            // this is for the lazy-load images
            var $img = $('img');
            $flexGrid2.imagesLoaded(function () {
                $img.on('load', function () {
                    $flexGrid2.isotope('layout');
                });
            });
            parentClassBlock.lightGallery();
            parentClassBlock.data('lightGallery').destroy(true);

            var gallerySettings = $('#gallery-settings-ajax-' + cuid).val();
            var cssEasing = $('#cssEasing-ajax-' + cuid).val();
            if (cssEasing > 0) {
                switch (cssEasing) {
                    case '1':
                        $cssEasing = 'cubic-bezier(0.250, 0.250, 0.750, 0.750)';
                        break;
                    case '2':
                        $cssEasing = 'cubic-bezier(0.250, 0.100, 0.250, 1.000)';
                        break;
                    case '3':
                        $cssEasing = 'cubic-bezier(0.420, 0.000, 1.000, 1.000)';
                        break;
                    case '4':
                        $cssEasing = 'cubic-bezier(0.000, 0.000, 0.580, 1.000)';
                        break;
                    case '5':
                        $cssEasing = 'cubic-bezier(0.420, 0.000, 0.580, 1.000)';
                        break;
                    case '6':
                        $cssEasing = 'cubic-bezier(0.550, 0.085, 0.680, 0.530)';
                        break;
                    case '7':
                        $cssEasing = 'cubic-bezier(0.550, 0.055, 0.675, 0.190)';
                        break;
                    case '8':
                        $cssEasing = 'cubic-bezier(0.895, 0.030, 0.685, 0.220)';
                        break;
                    case '9':
                        $cssEasing = 'cubic-bezier(0.755, 0.050, 0.855, 0.060)';
                        break;
                    case '10':
                        $cssEasing = 'cubic-bezier(0.470, 0.000, 0.745, 0.715)';
                        break;
                    case '11':
                        $cssEasing = 'cubic-bezier(0.950, 0.050, 0.795, 0.035)';
                        break;
                    case '12':
                        $cssEasing = 'cubic-bezier(0.600, 0.040, 0.980, 0.335)';
                        break;
                    case '13':
                        $cssEasing = 'cubic-bezier(0.600, -0.280, 0.735, 0.045)';
                        break;
                    case '14':
                        $cssEasing = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
                        break;
                    case '15':
                        $cssEasing = 'cubic-bezier(0.215, 0.610, 0.355, 1.000)';
                        break;
                    case '16':
                        $cssEasing = 'cubic-bezier(0.165, 0.840, 0.440, 1.000)';
                        break;
                    case '17':
                        $cssEasing = 'cubic-bezier(0.230, 1.000, 0.320, 1.000)';
                        break;
                    case '18':
                        $cssEasing = 'cubic-bezier(0.390, 0.575, 0.565, 1.000)';
                        break;
                    case '19':
                        $cssEasing = 'cubic-bezier(0.190, 1.000, 0.220, 1.000)';
                        break;
                    case '20':
                        $cssEasing = 'cubic-bezier(0.075, 0.820, 0.165, 1.000)';
                        break;
                    case '21':
                        $cssEasing = 'cubic-bezier(0.175, 0.885, 0.320, 1.275)';
                        break;
                    case '22':
                        $cssEasing = 'cubic-bezier(0.455, 0.030, 0.515, 0.955)';
                        break;
                    case '23':
                        $cssEasing = 'cubic-bezier(0.645, 0.045, 0.355, 1.000)';
                        break;
                    case '24':
                        $cssEasing = 'cubic-bezier(0.770, 0.000, 0.175, 1.000)';
                        break;
                    case '25':
                        $cssEasing = 'cubic-bezier(0.860, 0.000, 0.070, 1.000)';
                        break;
                    case '26':
                        $cssEasing = 'cubic-bezier(0.445, 0.050, 0.550, 0.950)';
                        break;
                    case '27':
                        $cssEasing = 'cubic-bezier(1.000, 0.000, 0.000, 1.000)';
                        break;
                    case '28':
                        $cssEasing = 'cubic-bezier(0.785, 0.135, 0.150, 0.860)';
                        break;
                    case '29':
                        $cssEasing = 'cubic-bezier(0.680, -0.550, 0.265, 1.550)';
                        break;
                }
            }
            if (gallerySettings) {
                var getSettings = gallerySettings.split(',');
                getSettings.forEach(settVal => {
                    var getKey = settVal.split(':');
                    switch (getKey[0]) {
                        case "thumbnail":
                            $thumbnail2 = getKey[1];
                            if ($thumbnail2 == 'true' || $thumbnail2 == 1) {
                                $thumbnail2 = true;
                            } else {
                                $thumbnail2 = false;
                            }
                            break;
                        case "fullScreen":
                            $fullScreen = getKey[1];
                            if ($fullScreen == 'true' || $fullScreen == 1) {
                                $fullScreen = true;
                            } else {
                                $fullScreen = false;
                            }
                            break;
                        case "zoom":
                            $zoom = getKey[1];
                            if ($zoom == 'true' || $zoom == 1) {
                                $zoom = true;
                            } else {
                                $zoom = false;
                            }
                            break;
                        case "autoplayControls":
                            $auto = getKey[1];
                            if ($auto == 'true' || $auto == 1) {
                                $auto = true;
                            } else {
                                $auto = false;
                            }
                            break;
                        case "download":
                            $download = getKey[1];
                            if ($download == 'true' || $download == 1) {
                                $download = true;
                            } else {
                                $download = false;
                            }
                            break;
                        case "controls":
                            $controls = getKey[1];
                            if ($controls == 'true' || $controls == 1) {
                                $controls = true;
                            } else {
                                $controls = false;
                            }
                            break;
                        case "loop":
                            $loop = getKey[1];
                            if ($loop == 'true' || $loop == 1) {
                                $loop = true;
                            } else {
                                $loop = false;
                            }
                            break;
                        case "pause":
                            $pause = parseInt(getKey[1]);
                            break;
                        case "thumbWidth":
                            $thumbWidth = parseInt(getKey[1]);
                            break;
                        case "thumbHeight":
                            $thumbHeight = getKey[1];
                            $thumbHeight = $thumbHeight.replace(/\'/g, "");
                            break;
                        case "counter":
                            $counter = getKey[1];
                            if ($counter == 'true' || $counter == 1) {
                                $counter = true;
                            } else {
                                $counter = false;
                            }
                            break;
                        case "share":
                            $share = getKey[1];
                            if ($share == 'true' || $share == 1) {
                                $share = true;
                            } else {
                                $share = false;
                            }
                            break;
                        case "facebook":
                            $facebook = getKey[1];
                            if ($facebook == 'true' || $facebook == 1) {
                                $facebook = true;
                            } else {
                                $facebook = false;
                            }
                            break;
                        case "twitter":
                            $twitter = getKey[1];
                            if ($twitter == 'true' || $twitter == 1) {
                                $twitter = true;
                            } else {
                                $twitter = false;
                            }
                            break;
                        case "pinterest":
                            $pinterest = getKey[1];
                            if ($pinterest == 'true' || $pinterest == 1) {
                                $pinterest = true;
                            } else {
                                $pinterest = false;
                            }
                            break;
                        case "googlePlus":
                            $googlePlus = getKey[1];
                            if ($googlePlus == 'true' || $googlePlus == 1) {
                                $googlePlus = true;
                            } else {
                                $googlePlus = false;
                            }
                            break;
                        case "enableDrag":
                            $enableDrag = getKey[1];
                            if ($enableDrag == 'true' || $enableDrag == 1) {
                                $enableDrag = true;
                            } else {
                                $enableDrag = false;
                            }
                            break;
                        case "mode":
                            $kaydata = getKey[1];
                            $mode = $kaydata.replace(/\'/g, "");
                            break;
                        case "animateThumb":
                            $animateThumb = getKey[1];
                            if ($animateThumb == 'true' || $animateThumb == 1) {
                                $animateThumb = true;
                            } else {
                                $animateThumb = false;
                            }
                            break;
                    }

                });
                //and then re-initiate gallery again
                $('.ajax-' + cuid).lightGallery({
                    selector: '.ns-gallery-item'
                });
            }
        }
    });
}

$(document).ready(function () {
    var wall = [];
    $('.lg-outer .lg-thumb-open .lg-sub-html').remove();

    $('.loaderImage').show();

// main image loaded ?
    $('.ns-gallery-slide .ns-gallery-item img').on('load', function(){
        // hide/remove the loading image
        $('.loaderImage').hide();
    });

    if ($('.ns-gallery-google-view').length) {
        console.log($('.ns-gallery-google-view').length);
        $('.GITheWall').each(function(index, item) {
            var initialHeight = 500;
            wall[index] = $(this).GITheWall({
                nextButtonClass: 'nsgallery-icon nsgallery-next-icon',
                prevButtonClass: 'nsgallery-icon nsgallery-prev-icon',
                closeButtonClass: 'nsgallery-icon nsgallery-close-icon',
                initialWrapperHeight: initialHeight
            });
        });
    }

    var paginationType = $('#paginationType').val();
    var themeClass = $('#themeClass').val();
    var themeClassIcons = $('#themeClassIcons').val();


    if (themeClass == 1) {
        themeClass = 'ns-gallery-dark-theme ns-gallery-arrow--icon-circle '+themeClassIcons;
    } else {
        themeClass = 'ns-gallery-arrow--icon-circle '+ themeClassIcons;
    }


    function getTotPage($totalPage, $perPage){
        var totPages2 = Math.ceil($totalPage / $perPage);
        return totPages2;
    }

    $('#cover-spin').hide();


    $(document).on('click', '.article-load-more', function (e) {
        if (paginationType == 'pagination') {
            var getParentID = $(this).parent().parent().parent().parent().attr('id');
        } else {
            var getParentID = $(this).parent().parent().attr('id');
        }

        let uid = $('.album-id-' + getParentID).val();
        let lastPage = $('.album-totpage-' + getParentID).val();
        var totNews = $('#totNews-' + getParentID).val();
        var perPage = $('#perPage-' + getParentID).val();
        let totPages = getTotPage(totNews, perPage);
        if (checkCurrentGallery.includes(getParentID)) {
            var galleryPage = checkCurrentGallery[getParentID][0];
            checkCurrentGallery[getParentID]= [galleryPage+1];
            curPage = galleryPage + 1;
        } else {
            curPage = 1;
            checkCurrentGallery.push(getParentID);
            checkCurrentGallery[getParentID] = [];
            checkCurrentGallery[getParentID].push(curPage);
        }

        e.preventDefault();
        $('#cover-spin').show();
        curPage = curPage + 1;
        var curPageUrl = $(this).attr('href');
        var nextPageUrl = curPageUrl;
        var lastVid = $('#lastVid-'+ getParentID).val();
        $.ajax({
            type: 'POST',
            url: nextPageUrl,
            data:{vid:lastVid,uid:uid},
            success: function (response) {

                if (paginationType == 'pagination') {
                    var findNextPageURL = $(response).find('#' + getParentID).find('.pagination-block').html();
                    $('#' + getParentID + ' .pagination-block').html(findNextPageURL);
                } else {
                    var findNextPageURL = $(response).find('.article-load-more').attr('href');
                    $('#' + getParentID + ' .article-load-more').attr('href', findNextPageURL);
                }
                var findNReplace = '#' + getParentID + ' .cus-row';

                var disdata = $(response).find(findNReplace).html();

                disdata = $(disdata + ' .ajaxBlock-'+getParentID).addClass('page-' + curPage);

                var lastVid2 = $(response).find('#lastVid-'+ getParentID).val();
                $('#lastVid-'+ getParentID).val(lastVid2);

                $(disdata).find('.grid-sizer .page-2').remove();

                if (paginationType == 'pagination') {
                    $('.cus-row .ajaxBlock-'+getParentID).remove();
                    if ($('#' + getParentID).hasClass('ns-gallery-album-view')) {
                        $(findNReplace).append(disdata);
                    }
                } else {
                    if (totPages === curPage || totPages == 0) {
                        $('#' + getParentID + ' .pagination-block .article-load-more').fadeOut();
                    }
                    $(findNReplace).append(disdata);
                }
                if ($('.ns-gallery-zoom-view').length > 0 || $('.ns-gallery-google-view').length > 0) {
                    $(findNReplace).append(disdata);
                }
                //ISOTOP hasClass("intro")
                if ($('#' + getParentID).parent().hasClass('ns-gallery-masonry-flex')) {

                    var $flexGrid2 = $('.' + getParentID+' .grid');
                }
                if ($('#' + getParentID).parent().hasClass('ns-gallery-masonry-classic')) {

                    var $flexGrid2 = $('.' + getParentID + ' .grid');
                }
                if ($('#' + getParentID).parent().hasClass('ns-gallery-masonry-pinterest')) {

                    var $flexGrid2 = $('.' + getParentID + ' .grid');
                }
                if ($('#' + getParentID).hasClass('ns-gallery-mosaic-view2')) {
                    var $flexGrid2 = $('.ns-gallery-mosaic-view');
                }

                var ZoomTypeSettings = $('#zoom-zoomType-' + getParentID).val();
                //alert(ZoomTypeSettings);
                if (ZoomTypeSettings) {
                    switch (ZoomTypeSettings) {
                        case "inner":
                            $zoomType = 'inner';
                            break;
                        case "lens":
                            $zoomType = 'lens';
                            break;
                        case "default":
                            $zoomType = '';
                            break;
                    }
                }

                var ZoomGallerySettings = $('#zoom-gallery-settings-' + getParentID).val();
                if (ZoomGallerySettings) {
                    var getSettings2 = ZoomGallerySettings.split(',');

                    getSettings2.forEach(settVal => {
                        var getKey = settVal.split(':');

                        switch (getKey[0]) {
                            case "zoomWindowFadeIn":
                                $zoomWindowFadeIn = parseInt(getKey[1]);
                                break;
                            case "zoomWindowFadeOut":
                                $zoomWindowFadeOut = parseInt(getKey[1]);
                                break;
                            case "lensFadeIn":
                                $lensFadeIn = parseInt(getKey[1]);
                                break;
                            case "lensFadeOut":
                                $lensFadeOut = parseInt(getKey[1]);
                                break;
                            case "easing":
                                $easing = getKey[1];
                                if ($easing == 'true' || $easing == 1) {
                                    $easing = true;
                                } else {
                                    $easing = false;
                                }
                                break;
                            case "scrollZoom":
                                $scrollZoom = getKey[1];
                                if ($scrollZoom == 'true' || $scrollZoom == 1) {
                                    $scrollZoom = true;
                                } else {
                                    $scrollZoom = false;
                                }
                                break;
                            case "lensShape":
                                switch (getKey[1]) {
                                    case "'round'":
                                        $lensShape = 'round';
                                        break;
                                    case "'square'":
                                        $lensShape = 'square';
                                        break;
                                }
                                break;
                            case "tint":
                                $tint = getKey[1];
                                if ($tint == 'true' || $tint == 1) {
                                    $tint = true;
                                } else {
                                    $tint = false;
                                }
                                break;
                            case "tintColour":
                                $tintColour = getKey[1];
                                $tintColour = $tintColour.replace(/\'/g, "");
                                break;
                            case "zoomWindowPosition":
                                $zoomWindowPosition = parseInt(getKey[1]);
                                break;

                        }
                    });
                }
                if ($('#' + getParentID).hasClass('ns-gallery-zoom-view--single')) {
                    if ($zoomType != '') {
                        $('.nsGalleryZoomImgSingle').ezPlus({
                            responsive: true,
                            zoomWindowPosition: $zoomWindowPosition,
                            tint: $tint,
                            tintColour: $tintColour,
                            zoomType: $zoomType,
                            zoomWindowFadeIn: $zoomWindowFadeIn,
                            zoomWindowFadeOut: $zoomWindowFadeOut,
                            lensFadeIn: $lensFadeIn,
                            lensFadeOut: $lensFadeOut,
                            easing: $easing,
                            scrollZoom: $scrollZoom,
                            lensShape: $lensShape,
                            respond: [
                                {
                                    range: '0-767',
                                    zoomWindowHeight: 230,
                                    zoomWindowWidth: 230,
                                    zoomWindowPosition: 6,
                                },
                                {
                                    range: '768-1199',
                                    zoomWindowHeight: 300,
                                    zoomWindowWidth: 300
                                }
                            ]
                        });
                    } else {
                        $('.nsGalleryZoomImgSingle').ezPlus({
                            responsive: true,
                            zoomWindowPosition: $zoomWindowPosition,
                            tint: $tint,
                            tintColour: $tintColour,
                            zoomWindowFadeIn: $zoomWindowFadeIn,
                            zoomWindowFadeOut: $zoomWindowFadeOut,
                            lensFadeIn: $lensFadeIn,
                            lensFadeOut: $lensFadeOut,
                            easing: $easing,
                            scrollZoom: $scrollZoom,
                            lensShape: $lensShape,
                            respond: [
                                {
                                    range: '0-767',
                                    zoomWindowHeight: 230,
                                    zoomWindowWidth: 230,
                                    zoomWindowPosition: 6,
                                },
                                {
                                    range: '768-1199',
                                    zoomWindowHeight: 300,
                                    zoomWindowWidth: 300
                                }
                            ]
                        });
                    }
                }
                if ($('#' + getParentID).hasClass('zoom-' + getParentID)) {

                    if ($zoomType != '') {
                        $('#nsGalleryZoomImg-' + getParentID).ezPlus({
                            lensSize: 100,
                            //gallery: getParentID,
                            zoomWindowPosition: $zoomWindowPosition,
                            zoomType: $zoomType,
                            tint: $tint,
                            tintColour: $tintColour,
                            zoomWindowFadeIn: $zoomWindowFadeIn,
                            zoomWindowFadeOut: $zoomWindowFadeOut,
                            lensFadeIn: $lensFadeIn,
                            lensFadeOut: $lensFadeOut,
                            easing: $easing,
                            scrollZoom: $scrollZoom,
                            lensShape: $lensShape,
                            cursor: 'pointer',
                            galleryActiveClass: 'active',
                            imageCrossfade: true,
                            loadingIcon: 'images/spinner.gif',
                            responsive: true,
                            respond: [
                                {
                                    range: '0-767',
                                    zoomWindowHeight: 230,
                                    zoomWindowWidth: 230,
                                    zoomWindowPosition: 5,
                                },
                                {
                                    range: '768-1199',
                                    zoomWindowHeight: 300,
                                    zoomWindowWidth: 300
                                }
                            ]
                        });
                    } else {
                        $('#nsGalleryZoomImg-' + getParentID).ezPlus({
                            lensSize: 100,
                            //gallery: getParentID,
                            zoomWindowPosition: $zoomWindowPosition,
                            tint: $tint,
                            tintColour: $tintColour,
                            zoomWindowFadeIn: $zoomWindowFadeIn,
                            zoomWindowFadeOut: $zoomWindowFadeOut,
                            lensFadeIn: $lensFadeIn,
                            lensFadeOut: $lensFadeOut,
                            easing: $easing,
                            scrollZoom: $scrollZoom,
                            lensShape: $lensShape,
                            cursor: 'pointer',
                            galleryActiveClass: 'active',
                            imageCrossfade: true,
                            loadingIcon: 'images/spinner.gif',
                            responsive: true,
                            respond: [
                                {
                                    range: '0-767',
                                    zoomWindowHeight: 230,
                                    zoomWindowWidth: 230,
                                    zoomWindowPosition: 5,
                                },
                                {
                                    range: '768-1199',
                                    zoomWindowHeight: 300,
                                    zoomWindowWidth: 300
                                }
                            ]
                        });
                    }
                }

                if ($('#' + getParentID).hasClass('GITheWall')) {
                    $('.GITheWall').each(function(index, item) {
                        wall[index].refresh();
                    });
                }
                if ($flexGrid2) {
                    if (paginationType == 'pagination') {
                        $flexGrid2.isotope('destroy');
                        $flexGrid2.isotope();
                        $flexGrid2.append(disdata).isotope('appended',disdata);
                        // this is for the normal
                        $flexGrid2.imagesLoaded().progress(function(){
                            $flexGrid2.isotope('layout');
                        });
                        // this is for the lazy-load images
                        var $img = $('img');
                        $flexGrid2.imagesLoaded(function () {
                            $img.on('load', function () {
                                $flexGrid2.isotope('layout');
                            });
                        });
                    } else {
                        $flexGrid2.isotope('destroy');
                        $flexGrid2.isotope();
                        $flexGrid2.append(disdata).isotope('appended',disdata);
                        $flexGrid2.imagesLoaded().progress(function(){
                            $flexGrid2.isotope('layout');
                        });
                        // this is for the lazy-load images
                        var $img = $('img');
                        $flexGrid2.imagesLoaded(function () {
                            $img.on('load', function () {
                                $flexGrid2.isotope('layout');
                            });
                        });
                    }
                }
                try {
                    $('.' + getParentID).lightGallery();
                    $('.' + getParentID).data('lightGallery').destroy(true);
                } catch (ex) { };

                var gallerySettings = $('#gallery-settings-' + getParentID).val();
                var cssEasing = $('#cssEasing-' + getParentID).val();
                if (cssEasing > 0) {
                    switch (cssEasing) {
                        case '1':
                            $cssEasing = 'cubic-bezier(0.250, 0.250, 0.750, 0.750)';
                            break;
                        case '2':
                            $cssEasing = 'cubic-bezier(0.250, 0.100, 0.250, 1.000)';
                            break;
                        case '3':
                            $cssEasing = 'cubic-bezier(0.420, 0.000, 1.000, 1.000)';
                            break;
                        case '4':
                            $cssEasing = 'cubic-bezier(0.000, 0.000, 0.580, 1.000)';
                            break;
                        case '5':
                            $cssEasing = 'cubic-bezier(0.420, 0.000, 0.580, 1.000)';
                            break;
                        case '6':
                            $cssEasing = 'cubic-bezier(0.550, 0.085, 0.680, 0.530)';
                            break;
                        case '7':
                            $cssEasing = 'cubic-bezier(0.550, 0.055, 0.675, 0.190)';
                            break;
                        case '8':
                            $cssEasing = 'cubic-bezier(0.895, 0.030, 0.685, 0.220)';
                            break;
                        case '9':
                            $cssEasing = 'cubic-bezier(0.755, 0.050, 0.855, 0.060)';
                            break;
                        case '10':
                            $cssEasing = 'cubic-bezier(0.470, 0.000, 0.745, 0.715)';
                            break;
                        case '11':
                            $cssEasing = 'cubic-bezier(0.950, 0.050, 0.795, 0.035)';
                            break;
                        case '12':
                            $cssEasing = 'cubic-bezier(0.600, 0.040, 0.980, 0.335)';
                            break;
                        case '13':
                            $cssEasing = 'cubic-bezier(0.600, -0.280, 0.735, 0.045)';
                            break;
                        case '14':
                            $cssEasing = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
                            break;
                        case '15':
                            $cssEasing = 'cubic-bezier(0.215, 0.610, 0.355, 1.000)';
                            break;
                        case '16':
                            $cssEasing = 'cubic-bezier(0.165, 0.840, 0.440, 1.000)';
                            break;
                        case '17':
                            $cssEasing = 'cubic-bezier(0.230, 1.000, 0.320, 1.000)';
                            break;
                        case '18':
                            $cssEasing = 'cubic-bezier(0.390, 0.575, 0.565, 1.000)';
                            break;
                        case '19':
                            $cssEasing = 'cubic-bezier(0.190, 1.000, 0.220, 1.000)';
                            break;
                        case '20':
                            $cssEasing = 'cubic-bezier(0.075, 0.820, 0.165, 1.000)';
                            break;
                        case '21':
                            $cssEasing = 'cubic-bezier(0.175, 0.885, 0.320, 1.275)';
                            break;
                        case '22':
                            $cssEasing = 'cubic-bezier(0.455, 0.030, 0.515, 0.955)';
                            break;
                        case '23':
                            $cssEasing = 'cubic-bezier(0.645, 0.045, 0.355, 1.000)';
                            break;
                        case '24':
                            $cssEasing = 'cubic-bezier(0.770, 0.000, 0.175, 1.000)';
                            break;
                        case '25':
                            $cssEasing = 'cubic-bezier(0.860, 0.000, 0.070, 1.000)';
                            break;
                        case '26':
                            $cssEasing = 'cubic-bezier(0.445, 0.050, 0.550, 0.950)';
                            break;
                        case '27':
                            $cssEasing = 'cubic-bezier(1.000, 0.000, 0.000, 1.000)';
                            break;
                        case '28':
                            $cssEasing = 'cubic-bezier(0.785, 0.135, 0.150, 0.860)';
                            break;
                        case '29':
                            $cssEasing = 'cubic-bezier(0.680, -0.550, 0.265, 1.550)';
                            break;
                    }
                }

                if (gallerySettings) {
                    var getSettings = gallerySettings.split(',');
                    getSettings.forEach(settVal => {
                        var getKey = settVal.split(':');
                        switch (getKey[0]) {
                            case "thumbnail":
                                $thumbnail2 = getKey[1];
                                if ($thumbnail2 == 'true' || $thumbnail2 == 1) {
                                    $thumbnail2 = true;
                                } else {
                                    $thumbnail2 = false;
                                }
                                break;
                            case "fullScreen":
                                $fullScreen = getKey[1];
                                if ($fullScreen == 'true' || $fullScreen == 1) {
                                    $fullScreen = true;
                                } else {
                                    $fullScreen = false;
                                }
                                break;
                            case "zoom":
                                $zoom = getKey[1];
                                if ($zoom == 'true' || $zoom == 1) {
                                    $zoom = true;
                                } else {
                                    $zoom = false;
                                }
                                break;
                            case "autoplayControls":
                                $auto = getKey[1];
                                if ($auto == 'true' || $auto == 1) {
                                    $auto = true;
                                } else {
                                    $auto = false;
                                }
                                break;
                            case "download":
                                $download = getKey[1];
                                if ($download == 'true' || $download == 1) {
                                    $download = true;
                                } else {
                                    $download = false;
                                }
                                break;
                            case "controls":
                                $controls = getKey[1];
                                if ($controls == 'true' || $controls == 1) {
                                    $controls = true;
                                } else {
                                    $controls = false;
                                }
                                break;
                            case "loop":
                                $loop = getKey[1];
                                if ($loop == 'true' || $loop == 1) {
                                    $loop = true;
                                } else {
                                    $loop = false;
                                }
                                break;
                            case "pause":
                                $pause = parseInt(getKey[1]);
                                break;
                            case "thumbWidth":
                                $thumbWidth = parseInt(getKey[1]);
                                break;
                            case "thumbHeight":
                                $thumbHeight = getKey[1];
                                $thumbHeight = $thumbHeight.replace(/\'/g, "");
                                break;
                            case "counter":
                                $counter = getKey[1];
                                if ($counter == 'true' || $counter == 1) {
                                    $counter = true;
                                } else {
                                    $counter = false;
                                }
                                break;
                            case "share":
                                $share = getKey[1];
                                if ($share == 'true' || $share == 1) {
                                    $share = true;
                                } else {
                                    $share = false;
                                }
                                break;
                            case "facebook":
                                $facebook = getKey[1];
                                if ($facebook == 'true' || $facebook == 1) {
                                    $facebook = true;
                                } else {
                                    $facebook = false;
                                }
                                break;
                            case "twitter":
                                $twitter = getKey[1];
                                if ($twitter == 'true' || $twitter == 1) {
                                    $twitter = true;
                                } else {
                                    $twitter = false;
                                }
                                break;
                            case "pinterest":
                                $pinterest = getKey[1];
                                if ($pinterest == 'true' || $pinterest == 1) {
                                    $pinterest = true;
                                } else {
                                    $pinterest = false;
                                }
                                break;
                            case "googlePlus":
                                $googlePlus = getKey[1];
                                if ($googlePlus == 'true' || $googlePlus == 1) {
                                    $googlePlus = true;
                                } else {
                                    $googlePlus = false;
                                }
                                break;
                            case "enableDrag":
                                $enableDrag = getKey[1];
                                if ($enableDrag == 'true' || $enableDrag == 1) {
                                    $enableDrag = true;
                                } else {
                                    $enableDrag = false;
                                }
                                break;
                            case "mode":
                                $kaydata = getKey[1];
                                $mode = $kaydata.replace(/\'/g, "");
                                break;
                            case "animateThumb":
                                $animateThumb = getKey[1];
                                if ($animateThumb == 'true' || $animateThumb == 1) {
                                    $animateThumb = true;
                                } else {
                                    $animateThumb = false;
                                }
                                break;
                        }

                    });

                    //and then re-initiate gallery again
                    $('.' + getParentID).lightGallery({
                        selector: '.ns-gallery-item',
                        addClass: themeClass,
                        fullScreen : $fullScreen,
                        zoom : $zoom,
                        auto : $auto,
                        download : $download,
                        controls : $controls,
                        loop : $loop,
                        pause: $pause,
                        counter : $counter,
                        enableDrag : $enableDrag,
                        share: $share,
                        facebook: $facebook,
                        twitter: $twitter,
                        pinterest: $pinterest,
                        googlePlus: $googlePlus,
                        mode: $mode,
                        cssEasing: $cssEasing,
                        thumbWidth: $thumbWidth,
                        thumbHeight: $thumbHeight,
                        animateThumb: $animateThumb

                    });
                }
                $('#cover-spin').hide();
            }
        });
    });

});