// magnific popup v0.8.9 by dmitry semenov // http://bit.ly/magnific-popup#build=inline+image+ajax+iframe+gallery+retina+fastclick (function(a){var b="close",c="afterclose",d="beforeappend",e="markupparse",f="open",g="change",h="mfp",i="."+h,j="mfp-ready",k="mfp-removing",l="mfp-prevent-close",m,n=function(){},o=!!window.jquery,p,q=a(window),r,s,t,u,v,w=function(a,b){m.ev.on(h+a+i,b)},x=function(b,c,d,e){var f=document.createelement("div");return f.classname="mfp-"+b,d&&(f.innerhtml=d),e?c&&c.appendchild(f):(f=a(f),c&&f.appendto(c)),f},y=function(b,c){m.ev.triggerhandler(h+b,c),m.st.callbacks&&(b=b.charat(0).tolowercase()+b.slice(1),m.st.callbacks[b]&&m.st.callbacks[b].apply(m,a.isarray(c)?c:[c]))},z=function(){(m.st.focus?m.content.find(m.st.focus).eq(0):m.wrap).focus()},a=function(b){if(b!==v||!m.currtemplate.closebtn)m.currtemplate.closebtn=a(m.st.closemarkup.replace("%title%",m.st.tclose)),v=b;return m.currtemplate.closebtn},b=function(){a.magnificpopup.instance||(m=new n,m.init(),a.magnificpopup.instance=m)},c=function(b){if(a(b).hasclass(l))return;var c=m.st.closeoncontentclick,d=m.st.closeonbgclick;if(c&&d)return!0;if(!m.content||a(b).hasclass("mfp-close")||m.preloader&&b===m.preloader[0])return!0;if(b!==m.content[0]&&!a.contains(m.content[0],b)){if(d)return!0}else if(c)return!0;return!1};n.prototype={constructor:n,init:function(){var b=navigator.appversion;m.isie7=b.indexof("msie 7.")!==-1,m.isie8=b.indexof("msie 8.")!==-1,m.islowie=m.isie7||m.isie8,m.isandroid=/android/gi.test(b),m.isios=/iphone|ipad|ipod/gi.test(b),m.probablymobile=m.isandroid||m.isios||/(opera mini)|kindle|webos|blackberry|(opera mobi)|(windows phone)|iemobile/i.test(navigator.useragent),r=a(document.body),s=a(document),m.popupscache={}},open:function(b){var c;if(b.isobj===!1){m.items=b.items.toarray(),m.index=0;var d=b.items,g;for(c=0;c(a||q.height())},_parsemarkup:function(b,c,d){var f;d.data&&(c=a.extend(d.data,c)),y(e,[b,c,d]),a.each(c,function(a,c){if(c===undefined||c===!1)return!0;f=a.split("_");if(f.length>1){var d=b.find(i+"-"+f[0]);if(d.length>0){var e=f[1];e==="replacewith"?d[0]!==c[0]&&d.replacewith(c):e==="img"?d.is("img")?d.attr("src",c):d.replacewith(''):d.attr(f[1],c)}}else b.find(i+"-"+a).html(c)})},_getscrollbarsize:function(){if(m.scrollbarsize===undefined){var a=document.createelement("div");a.id="mfp-sbm",a.style.csstext="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendchild(a),m.scrollbarsize=a.offsetwidth-a.clientwidth,document.body.removechild(a)}return m.scrollbarsize}},a.magnificpopup={instance:null,proto:n.prototype,modules:[],open:function(a,b){return b(),a||(a={}),a.isobj=!0,a.index=b||0,this.instance.open(a)},close:function(){return a.magnificpopup.instance.close()},registermodule:function(b,c){c.options&&(a.magnificpopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableon:0,key:null,midclick:!1,mainclass:"",preloader:!0,focus:"",closeoncontentclick:!1,closeonbgclick:!0,closebtninside:!0,aligntop:!1,removaldelay:0,fixedcontentpos:"auto",fixedbgpos:"auto",overflowy:"auto",closemarkup:'',tclose:"close (esc)",tloading:"loading..."}},a.fn.magnificpopup=function(b){b();var c=a(this);if(typeof b=="string")if(b==="open"){var d,e=o?c.data("magnificpopup"):c[0].magnificpopup,f=parseint(arguments[1],10)||0;e.items?d=e.items[f]:(d=c,e.delegate&&(d=d.find(e.delegate)),d=d.eq(f)),m._openclick({mfpel:d},c,e)}else m.isopen&&m[b].apply(m,array.prototype.slice.call(arguments,1));else o?c.data("magnificpopup",b):c[0].magnificpopup=b,m.addgroup(c,b);return c};var d="inline",e,f,g,h=function(){g&&(f.after(g.addclass(e)).detach(),g=null)};a.magnificpopup.registermodule(d,{options:{hiddenclass:"hide",markup:"",tnotfound:"content not found"},proto:{initinline:function(){m.types.push(d),w(b+"."+d,function(){h()})},getinline:function(b,c){h();if(b.src){var d=m.st.inline,e=a(b.src);if(e.length){var f=e[0].parentnode;f&&f.tagname&&(f||(e=d.hiddenclass,f=x(e),e="mfp-"+e),g=e.after(f).detach().removeclass(e)),m.updatestatus("ready")}else m.updatestatus("error",d.tnotfound),e=a("
");return b.inlineelement=e,e}return m.updatestatus("ready"),m._parsemarkup(c,{},b),c}}});var i="ajax",j,k=function(){j&&r.removeclass(j)};a.magnificpopup.registermodule(i,{options:{settings:null,cursor:"mfp-ajax-cur",terror:'the content could not be loaded.'},proto:{initajax:function(){m.types.push(i),j=m.st.ajax.cursor,w(b+"."+i,function(){k(),m.req&&m.req.abort()})},getajax:function(b){j&&r.addclass(j),m.updatestatus("loading");var c=a.extend({url:b.src,success:function(c,d,e){var f={data:c,xhr:e};y("parseajax",f),m.appendcontent(a(f.data),i),b.finished=!0,k(),z(),settimeout(function(){m.wrap.addclass(j)},16),m.updatestatus("ready"),y("ajaxcontentadded")},error:function(){k(),b.finished=b.loaderror=!0,m.updatestatus("error",m.st.ajax.terror.replace("%url%",b.src))}},m.st.ajax.settings);return m.req=a.ajax(c),""}}});var l,m=function(b){if(b.data&&b.data.title!==undefined)return b.data.title;var c=m.st.image.titlesrc;if(c){if(a.isfunction(c))return c.call(m,b);if(b.el)return b.el.attr(c)||""}return""};a.magnificpopup.registermodule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titlesrc:"title",verticalfit:!0,terror:'the image could not be loaded.'},proto:{initimage:function(){var a=m.st.image,c=".image";m.types.push("image"),w(f+c,function(){m.curritem.type==="image"&&a.cursor&&r.addclass(a.cursor)}),w(b+c,function(){a.cursor&&r.removeclass(a.cursor),q.off("resize"+i)}),w("resize"+c,m.resizeimage),m.islowie&&w("afterchange",m.resizeimage)},resizeimage:function(){var a=m.curritem;if(!a.img)return;if(m.st.image.verticalfit){var b=0;m.islowie&&(b=parseint(a.img.css("padding-top"),10)+parseint(a.img.css("padding-bottom"),10)),a.img.css("max-height",m.wh-b)}},_onimagehassize:function(a){a.img&&(a.hassize=!0,l&&clearinterval(l),a.ischeckingimgsize=!1,y("imagehassize",a),a.imghidden&&(m.content&&m.content.removeclass("mfp-loading"),a.imghidden=!1))},findimagesize:function(a){var b=0,c=a.img[0],d=function(e){l&&clearinterval(l),l=setinterval(function(){if(c.naturalwidth>0){m._onimagehassize(a);return}b>200&&clearinterval(l),b++,b===3?d(10):b===40?d(50):b===100&&d(500)},e)};d(1)},getimage:function(b,c){var d=0,e=function(){b&&(b.img[0].complete?(b.img.off(".mfploader"),b===m.curritem&&(m._onimagehassize(b),m.updatestatus("ready")),b.hassize=!0,b.loaded=!0):(d++,d<200?settimeout(e,100):f()))},f=function(){b&&(b.img.off(".mfploader"),b===m.curritem&&(m._onimagehassize(b),m.updatestatus("error",g.terror.replace("%url%",b.src))),b.hassize=!0,b.loaded=!0,b.loaderror=!0)},g=m.st.image,h=c.find(".mfp-img");if(h.length){var i=new image;i.classname="mfp-img",b.img=a(i).on("load.mfploader",e).on("error.mfploader",f),i.src=b.src,h.is("img")&&(b.img=b.img.clone())}return m._parsemarkup(c,{title:m(b),img_replacewith:b.img},b),m.resizeimage(),b.hassize?(l&&clearinterval(l),b.loaderror?(c.addclass("mfp-loading"),m.updatestatus("error",g.terror.replace("%url%",b.src))):(c.removeclass("mfp-loading"),m.updatestatus("ready")),c):(m.updatestatus("loading"),b.loading=!0,b.hassize||(b.imghidden=!0,c.addclass("mfp-loading"),m.findimagesize(b)),c)}}});var n="iframe",o="//about:blank",p=function(a){if(m.currtemplate[n]){var b=m.currtemplate[n].find("iframe");b.length&&(a||(b[0].src=o),m.isie8&&b.css("display",a?"block":"none"))}};a.magnificpopup.registermodule(n,{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(){m.types.push(n),w("beforechange",function(a,b,c){b!==c&&(b===n?p():c===n&&p(!0))}),w(b+"."+n,function(){p()})},getiframe:function(b,c){var d=b.src,e=m.st.iframe;a.each(e.patterns,function(){if(d.indexof(this.index)>-1)return this.id&&(typeof this.id=="string"?d=d.substr(d.lastindexof(this.id)+this.id.length,d.length):d=this.id.call(this,d)),d=this.src.replace("%id%",d),!1});var f={};return e.srcaction&&(f[e.srcaction]=d),m._parsemarkup(c,f,b),m.updatestatus("ready"),c}}});var q=function(a){var b=m.items.length;return a>b-1?a-b:a<0?b+a:a},r=function(a,b,c){return a.replace("%curr%",b+1).replace("%total%",c)};a.magnificpopup.registermodule("gallery",{options:{enabled:!1,arrowmarkup:'',preload:[0,2],navigatebyimgclick:!0,arrows:!0,tprev:"previous (left arrow key)",tnext:"next (right arrow key)",tcounter:"%curr% of %total%"},proto:{initgallery:function(){var c=m.st.gallery,d=".mfp-gallery",h=boolean(a.fn.mfpfastclick);m.direction=!0;if(!c||!c.enabled)return!1;u+=" mfp-gallery",w(f+d,function(){c.navigatebyimgclick&&m.wrap.on("click"+d,".mfp-img",function(){if(m.items.length>1)return m.next(),!1}),s.on("keydown"+d,function(a){a.keycode===37?m.prev():a.keycode===39&&m.next()})}),w("updatestatus"+d,function(a,b){b.text&&(b.text=r(b.text,m.curritem.index,m.items.length))}),w(e+d,function(a,b,d,e){var f=m.items.length;d.counter=f>1?r(c.tcounter,e.index,f):""}),w("buildcontrols"+d,function(){if(m.items.length>1&&c.arrows&&!m.arrowleft){var b=c.arrowmarkup,d=m.arrowleft=a(b.replace("%title%",c.tprev).replace("%dir%","left")).addclass(l),e=m.arrowright=a(b.replace("%title%",c.tnext).replace("%dir%","right")).addclass(l),f=h?"mfpfastclick":"click";d[f](function(){m.prev()}),e[f](function(){m.next()}),m.isie7&&(x("b",d[0],!1,!0),x("a",d[0],!1,!0),x("b",e[0],!1,!0),x("a",e[0],!1,!0)),m.container.append(d.add(e))}}),w(g+d,function(){m._preloadtimeout&&cleartimeout(m._preloadtimeout),m._preloadtimeout=settimeout(function(){m.preloadnearbyimages(),m._preloadtimeout=null},16)}),w(b+d,function(){s.off(d),m.wrap.off("click"+d),m.arrowleft&&h&&m.arrowleft.add(m.arrowright).destroymfpfastclick(),m.arrowright=m.arrowleft=null})},next:function(){m.direction=!0,m.index=q(m.index+1),m.updateitemhtml()},prev:function(){m.direction=!1,m.index=q(m.index-1),m.updateitemhtml()},goto:function(a){m.direction=a>=m.index,m.index=a,m.updateitemhtml()},preloadnearbyimages:function(){var a=m.st.gallery.preload,b=math.min(a[0],m.items.length),c=math.min(a[1],m.items.length),d;for(d=1;d<=(m.direction?c:b);d++)m._preloaditem(m.index+d);for(d=1;d<=(m.direction?b:c);d++)m._preloaditem(m.index-d)},_preloaditem:function(b){b=q(b);if(m.items[b].preloaded)return;var c=m.items[b];c.parsed||(c=m.parseel(b)),y("lazyload",c),c.type==="image"&&(c.img=a('').on("load.mfploader",function(){c.hassize=!0}).on("error.mfploader",function(){c.hassize=!0,c.loaderror=!0}).attr("src",c.src)),c.preloaded=!0}}});var s="retina";a.magnificpopup.registermodule(s,{options:{replacesrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initretina:function(){if(window.devicepixelratio>1){var a=m.st.retina,b=a.ratio;b=isnan(b)?b():b,b>1&&(w("imagehassize."+s,function(a,c){c.img.css({"max-width":c.img[0].naturalwidth/b,width:"100%"})}),w("elementparse."+s,function(c,d){d.src=a.replacesrc(d,b)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){q.off("touchmove"+f+" touchend"+f)},e="mfpfastclick",f="."+e;a.fn.mfpfastclick=function(e){return a(this).each(function(){var g=a(this),h;if(c){var i,j,k,l,m,n;g.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalevent?a.originalevent.touches[0]:a.touches[0],j=m.clientx,k=m.clienty,q.on("touchmove"+f,function(a){m=a.originalevent?a.originalevent.touches:a.touches,n=m.length,m=m[0];if(math.abs(m.clientx-j)>10||math.abs(m.clienty-k)>10)l=!0,d()}).on("touchend"+f,function(a){d();if(l||n>1)return;h=!0,a.preventdefault(),cleartimeout(i),i=settimeout(function(){h=!1},b),e()})})}g.on("click"+f,function(){h||e()})})},a.fn.destroymfpfastclick=function(){a(this).off("touchstart"+f+" click"+f),c&&q.off("touchmove"+f+" touchend"+f)}}()})(window.jquery||window.zepto)