/*! Magnific Popup - v1.0.0 - 2015-09-17 * http://dimsemenov.com/plugins/magnific-popup/ * Copyright (c) 2015 Dmitry Semenov; */ ;(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){a(require("jquery"))}else{a(window.jQuery||window.Zepto)}}}(function(B){var x="Close",G="BeforeClose",v="AfterClose",M="BeforeAppend",f="MarkupParse",k="Open",h="Change",C="mfp",d="."+C,H="mfp-ready",J="mfp-removing",e="mfp-prevent-close";var R,y=function(){},I=!!(window.jQuery),A,a=B(window),z,E,b,K;var i=function(V,W){R.ev.on(C+V+d,W)},n=function(Z,W,X,V){var Y=document.createElement("div");Y.className="mfp-"+Z;if(X){Y.innerHTML=X}if(!V){Y=B(Y);if(W){Y.appendTo(W)}}else{if(W){W.appendChild(Y)}}return Y},O=function(W,V){R.ev.triggerHandler(C+W,V);if(R.st.callbacks){W=W.charAt(0).toLowerCase()+W.slice(1);if(R.st.callbacks[W]){R.st.callbacks[W].apply(R,B.isArray(V)?V:[V])}}},D=function(V){if(V!==K||!R.currTemplate.closeBtn){R.currTemplate.closeBtn=B(R.st.closeMarkup.replace("%title%",R.st.tClose));K=V}return R.currTemplate.closeBtn},s=function(){if(!B.magnificPopup.instance){R=new y();R.init();B.magnificPopup.instance=R}},U=function(){var W=document.createElement("p").style,V=["ms","O","Moz","Webkit"];if(W.transition!==undefined){return true}while(V.length){if(V.pop()+"Transition" in W){return true}}return false};y.prototype={constructor:y,init:function(){var V=navigator.appVersion;R.isIE7=V.indexOf("MSIE 7.")!==-1;R.isIE8=V.indexOf("MSIE 8.")!==-1;R.isLowIE=R.isIE7||R.isIE8;R.isAndroid=(/android/gi).test(V);R.isIOS=(/iphone|ipad|ipod/gi).test(V);R.supportsTransition=U();R.probablyMobile=(R.isAndroid||R.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent));z=B(document);R.popupsCache={}},open:function(aa){var ab;if(aa.isObj===false){R.items=aa.items.toArray();R.index=0;var ac=aa.items,ad;for(ab=0;ab(V||a.height()))},_setFocus:function(){(R.st.focus?R.content.find(R.st.focus).eq(0):R.wrap).focus()},_onFocusIn:function(V){if(V.target!==R.wrap[0]&&!B.contains(R.wrap[0],V.target)){R._setFocus();return false}},_parseMarkup:function(X,W,Y){var V;if(Y.data){W=B.extend(Y.data,W)}O(f,[X,W,Y]);B.each(W,function(aa,ac){if(ac===undefined||ac===false){return true}V=aa.split("_");if(V.length>1){var ab=X.find(d+"-"+V[0]);if(ab.length>0){var Z=V[1];if(Z==="replaceWith"){if(ab[0]!==ac[0]){ab.replaceWith(ac)}}else{if(Z==="img"){if(ab.is("img")){ab.attr("src",ac)}else{ab.replaceWith('')}}else{ab.attr(V[1],ac)}}}}else{X.find(d+"-"+aa).html(ac)}})},_getScrollbarSize:function(){if(R.scrollbarSize===undefined){var V=document.createElement("div");V.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;";document.body.appendChild(V);R.scrollbarSize=V.offsetWidth-V.clientWidth;document.body.removeChild(V)}return R.scrollbarSize}};B.magnificPopup={instance:null,proto:y.prototype,modules:[],open:function(W,V){s();if(!W){W={}}else{W=B.extend(true,{},W)}W.isObj=true;W.index=V||0;return this.instance.open(W)},close:function(){return B.magnificPopup.instance&&B.magnificPopup.instance.close()},registerModule:function(V,W){if(W.options){B.magnificPopup.defaults[V]=W.options}B.extend(this.proto,W.proto);this.modules.push(V)},defaults:{disableOn:0,key:null,midClick:false,mainClass:"",preloader:true,focus:"",closeOnContentClick:false,closeOnBgClick:true,closeBtnInside:true,showCloseBtn:true,enableEscapeKey:true,modal:false,alignTop:false,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}};B.fn.magnificPopup=function(X){s();var Y=B(this);if(typeof X==="string"){if(X==="open"){var V,Z=I?Y.data("magnificPopup"):Y[0].magnificPopup,W=parseInt(arguments[1],10)||0;if(Z.items){V=Z.items[W]}else{V=Y;if(Z.delegate){V=V.find(Z.delegate)}V=V.eq(W)}R._openClick({mfpEl:V},Y,Z)}else{if(R.isOpen){R[X].apply(R,Array.prototype.slice.call(arguments,1))}}}else{X=B.extend(true,{},X);if(I){Y.data("magnificPopup",X)}else{Y[0].magnificPopup=X}R.addGroup(Y,X)}return Y};var F="inline",Q,N,r,l=function(){if(r){N.after(r.addClass(Q)).detach();r=null}};B.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){R.types.push(F);i(x+"."+F,function(){l()})},getInline:function(Z,Y){l();if(Z.src){var V=R.st.inline,X=B(Z.src);if(X.length){var W=X[0].parentNode;if(W&&W.tagName){if(!N){Q=V.hiddenClass;N=n(Q);Q="mfp-"+Q}r=X.after(N).detach().removeClass(Q)}R.updateStatus("ready")}else{R.updateStatus("error",V.tNotFound);X=B("
")}Z.inlineElement=X;return X}R.updateStatus("ready");R._parseMarkup(Y,{},Z);return Y}}});var t="ajax",T,u=function(){if(T){B(document.body).removeClass(T)}},S=function(){u();if(R.req){R.req.abort()}};B.magnificPopup.registerModule(t,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){R.types.push(t);T=R.st.ajax.cursor;i(x+"."+t,S);i("BeforeChange."+t,S)},getAjax:function(W){if(T){B(document.body).addClass(T)}R.updateStatus("loading");var V=B.extend({url:W.src,success:function(Z,aa,Y){var X={data:Z,xhr:Y};O("ParseAjax",X);R.appendContent(B(X.data),t);W.finished=true;u();R._setFocus();setTimeout(function(){R.wrap.addClass(H)},16);R.updateStatus("ready");O("AjaxContentAdded")},error:function(){u();W.finished=W.loadError=true;R.updateStatus("error",R.st.ajax.tError.replace("%url%",W.src))}},R.st.ajax.settings);R.req=B.ajax(V);return""}}});var g,c=function(V){if(V.data&&V.data.title!==undefined){return V.data.title}var W=R.st.image.titleSrc;if(W){if(B.isFunction(W)){return W.call(R,V)}else{if(V.el){return V.el.attr(W)||""}}}return""};B.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:true,tError:'The image could not be loaded.'},proto:{initImage:function(){var W=R.st.image,V=".image";R.types.push("image");i(k+V,function(){if(R.currItem.type==="image"&&W.cursor){B(document.body).addClass(W.cursor)}});i(x+V,function(){if(W.cursor){B(document.body).removeClass(W.cursor)}a.off("resize"+d)});i("Resize"+V,R.resizeImage);if(R.isLowIE){i("AfterChange",R.resizeImage)}},resizeImage:function(){var W=R.currItem;if(!W||!W.img){return}if(R.st.image.verticalFit){var V=0;if(R.isLowIE){V=parseInt(W.img.css("padding-top"),10)+parseInt(W.img.css("padding-bottom"),10)}W.img.css("max-height",R.wH-V)}},_onImageHasSize:function(V){if(V.img){V.hasSize=true;if(g){clearInterval(g)}V.isCheckingImgSize=false;O("ImageHasSize",V);if(V.imgHidden){if(R.content){R.content.removeClass("mfp-loading")}V.imgHidden=false}}},findImageSize:function(Y){var V=0,W=Y.img[0],X=function(Z){if(g){clearInterval(g)}g=setInterval(function(){if(W.naturalWidth>0){R._onImageHasSize(Y);return}if(V>200){clearInterval(g)}V++;if(V===3){X(10)}else{if(V===40){X(50)}else{if(V===100){X(500)}}}},Z)};X(1)},getImage:function(ab,Y){var aa=0,ac=function(){if(ab){if(ab.img[0].complete){ab.img.off(".mfploader");if(ab===R.currItem){R._onImageHasSize(ab);R.updateStatus("ready")}ab.hasSize=true;ab.loaded=true;O("ImageLoadComplete")}else{aa++;if(aa<200){setTimeout(ac,100)}else{V()}}}},V=function(){if(ab){ab.img.off(".mfploader");if(ab===R.currItem){R._onImageHasSize(ab);R.updateStatus("error",Z.tError.replace("%url%",ab.src))}ab.hasSize=true;ab.loaded=true;ab.loadError=true}},Z=R.st.image;var X=Y.find(".mfp-img");if(X.length){var W=document.createElement("img");W.className="mfp-img";if(ab.el&&ab.el.find("img").length){W.alt=ab.el.find("img").attr("alt")}ab.img=B(W).on("load.mfploader",ac).on("error.mfploader",V);W.src=ab.src;if(X.is("img")){ab.img=ab.img.clone()}W=ab.img[0];if(W.naturalWidth>0){ab.hasSize=true}else{if(!W.width){ab.hasSize=false}}}R._parseMarkup(Y,{title:c(ab),img_replaceWith:ab.img},ab);R.resizeImage();if(ab.hasSize){if(g){clearInterval(g)}if(ab.loadError){Y.addClass("mfp-loading");R.updateStatus("error",Z.tError.replace("%url%",ab.src))}else{Y.removeClass("mfp-loading");R.updateStatus("ready")}return Y}R.updateStatus("loading");ab.loading=true;if(!ab.hasSize){ab.imgHidden=true;Y.addClass("mfp-loading");R.findImageSize(ab)}return Y}}});var j,L=function(){if(j===undefined){j=document.createElement("p").style.MozTransform!==undefined}return j};B.magnificPopup.registerModule("zoom",{options:{enabled:false,easing:"ease-in-out",duration:300,opener:function(V){return V.is("img")?V:V.find("img")}},proto:{initZoom:function(){var W=R.st.zoom,Z=".zoom",ac;if(!W.enabled||!R.supportsTransition){return}var ab=W.duration,aa=function(af){var ae=af.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),ag="all "+(W.duration/1000)+"s "+W.easing,ah={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},ad="transition";ah["-webkit-"+ad]=ah["-moz-"+ad]=ah["-o-"+ad]=ah[ad]=ag;ae.css(ah);return ae},V=function(){R.content.css("visibility","visible")},X,Y;i("BuildControls"+Z,function(){if(R._allowZoom()){clearTimeout(X);R.content.css("visibility","hidden");ac=R._getItemToZoom();if(!ac){V();return}Y=aa(ac);Y.css(R._getOffset());R.wrap.append(Y);X=setTimeout(function(){Y.css(R._getOffset(true));X=setTimeout(function(){V();setTimeout(function(){Y.remove();ac=Y=null;O("ZoomAnimationEnded")},16)},ab)},16)}});i(G+Z,function(){if(R._allowZoom()){clearTimeout(X);R.st.removalDelay=ab;if(!ac){ac=R._getItemToZoom();if(!ac){return}Y=aa(ac)}Y.css(R._getOffset(true));R.wrap.append(Y);R.content.css("visibility","hidden");setTimeout(function(){Y.css(R._getOffset())},16)}});i(x+Z,function(){if(R._allowZoom()){V();if(Y){Y.remove()}ac=null}})},_allowZoom:function(){return R.currItem.type==="image"},_getItemToZoom:function(){if(R.currItem.hasSize){return R.currItem.img}else{return false}},_getOffset:function(X){var V;if(X){V=R.currItem.img}else{V=R.st.zoom.opener(R.currItem.el||R.currItem)}var aa=V.offset();var W=parseInt(V.css("padding-top"),10);var Z=parseInt(V.css("padding-bottom"),10);aa.top-=(B(window).scrollTop()-W);var Y={width:V.width(),height:(I?V.innerHeight():V[0].offsetHeight)-Z-W};if(L()){Y["-moz-transform"]=Y.transform="translate("+aa.left+"px,"+aa.top+"px)"}else{Y.left=aa.left;Y.top=aa.top}return Y}}});var q="iframe",p="//about:blank",P=function(V){if(R.currTemplate[q]){var W=R.currTemplate[q].find("iframe");if(W.length){if(!V){W[0].src=p}if(R.isIE8){W.css("display",V?"block":"none")}}}};B.magnificPopup.registerModule(q,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){R.types.push(q);i("BeforeChange",function(X,V,W){if(V!==W){if(V===q){P()}else{if(W===q){P(true)}}}});i(x+"."+q,function(){P()})},getIframe:function(Z,Y){var V=Z.src;var X=R.st.iframe;B.each(X.patterns,function(){if(V.indexOf(this.index)>-1){if(this.id){if(typeof this.id==="string"){V=V.substr(V.lastIndexOf(this.id)+this.id.length,V.length)}else{V=this.id.call(this,V)}}V=this.src.replace("%id%",V);return false}});var W={};if(X.srcAction){W[X.srcAction]=V}R._parseMarkup(Y,W,Z);R.updateStatus("ready");return Y}}});var w=function(V){var W=R.items.length;if(V>W-1){return V-W}else{if(V<0){return W+V}}return V},o=function(X,W,V){return X.replace(/%curr%/gi,W+1).replace(/%total%/gi,V)};B.magnificPopup.registerModule("gallery",{options:{enabled:false,arrowMarkup:'',preload:[0,2],navigateByImgClick:true,arrows:true,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var V=R.st.gallery,X=".mfp-gallery",W=Boolean(B.fn.mfpFastClick);R.direction=true;if(!V||!V.enabled){return false}b+=" mfp-gallery";i(k+X,function(){if(V.navigateByImgClick){R.wrap.on("click"+X,".mfp-img",function(){if(R.items.length>1){R.next();return false}})}z.on("keydown"+X,function(Y){if(Y.keyCode===37){R.prev()}else{if(Y.keyCode===39){R.next()}}})});i("UpdateStatus"+X,function(Z,Y){if(Y.text){Y.text=o(Y.text,R.currItem.index,R.items.length)}});i(f+X,function(ac,aa,Z,ab){var Y=R.items.length;Z.counter=Y>1?o(V.tCounter,ab.index,Y):""});i("BuildControls"+X,function(){if(R.items.length>1&&V.arrows&&!R.arrowLeft){var aa=V.arrowMarkup,ab=R.arrowLeft=B(aa.replace(/%title%/gi,V.tPrev).replace(/%dir%/gi,"left")).addClass(e),Z=R.arrowRight=B(aa.replace(/%title%/gi,V.tNext).replace(/%dir%/gi,"right")).addClass(e);var Y=W?"mfpFastClick":"click";ab[Y](function(){R.prev()});Z[Y](function(){R.next()});if(R.isIE7){n("b",ab[0],false,true);n("a",ab[0],false,true);n("b",Z[0],false,true);n("a",Z[0],false,true)}R.container.append(ab.add(Z))}});i(h+X,function(){if(R._preloadTimeout){clearTimeout(R._preloadTimeout)}R._preloadTimeout=setTimeout(function(){R.preloadNearbyImages();R._preloadTimeout=null},16)});i(x+X,function(){z.off(X);R.wrap.off("click"+X);if(R.arrowLeft&&W){R.arrowLeft.add(R.arrowRight).destroyMfpFastClick()}R.arrowRight=R.arrowLeft=null})},next:function(){R.direction=true;R.index=w(R.index+1);R.updateItemHTML()},prev:function(){R.direction=false;R.index=w(R.index-1);R.updateItemHTML()},goTo:function(V){R.direction=(V>=R.index);R.index=V;R.updateItemHTML()},preloadNearbyImages:function(){var Y=R.st.gallery.preload,W=Math.min(Y[0],R.items.length),X=Math.min(Y[1],R.items.length),V;for(V=1;V<=(R.direction?X:W);V++){R._preloadItem(R.index+V)}for(V=1;V<=(R.direction?W:X);V++){R._preloadItem(R.index-V)}},_preloadItem:function(V){V=w(V);if(R.items[V].preloaded){return}var W=R.items[V];if(!W.parsed){W=R.parseEl(V)}O("LazyLoad",W);if(W.type==="image"){W.img=B('').on("load.mfploader",function(){W.hasSize=true}).on("error.mfploader",function(){W.hasSize=true;W.loadError=true;O("LazyLoadError",W)}).attr("src",W.src)}W.preloaded=true}}});var m="retina";B.magnificPopup.registerModule(m,{options:{replaceSrc:function(V){return V.src.replace(/\.\w+$/,function(W){return"@2x"+W})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var V=R.st.retina,W=V.ratio;W=!isNaN(W)?W:W();if(W>1){i("ImageHasSize."+m,function(Y,X){X.img.css({"max-width":X.img[0].naturalWidth/W,width:"100%"})});i("ElementParse."+m,function(Y,X){X.src=V.replaceSrc(X,W)})}}}}});(function(){var W=1000,Y="ontouchstart" in window,Z=function(){a.off("touchmove"+X+" touchend"+X)},V="mfpFastClick",X="."+V;B.fn.mfpFastClick=function(aa){return B(this).each(function(){var ah=B(this),ag;if(Y){var ai,ad,ac,af,ab,ae;ah.on("touchstart"+X,function(aj){af=false;ae=1;ab=aj.originalEvent?aj.originalEvent.touches[0]:aj.touches[0];ad=ab.clientX;ac=ab.clientY;a.on("touchmove"+X,function(ak){ab=ak.originalEvent?ak.originalEvent.touches:ak.touches;ae=ab.length;ab=ab[0];if(Math.abs(ab.clientX-ad)>10||Math.abs(ab.clientY-ac)>10){af=true;Z()}}).on("touchend"+X,function(ak){Z();if(af||ae>1){return}ag=true;ak.preventDefault();clearTimeout(ai);ai=setTimeout(function(){ag=false},W);aa()})})}ah.on("click"+X,function(){if(!ag){aa()}})})};B.fn.destroyMfpFastClick=function(){B(this).off("touchstart"+X+" click"+X);if(Y){a.off("touchmove"+X+" touchend"+X)}}})();s()}));