;var ThemifyGallery,FixedHeader,ThemifyParallax;(function($){function UpdateQueryString(a,b,c){c||(c=window.location.href);var d=RegExp("([?|&])"+a+"=.*?(&|#|$)(.*)","gi");if(d.test(c))return b!==void 0&&null!==b?c.replace(d,"$1"+a+"="+b+"$2$3"):c.replace(d,"$1$3").replace(/(&|\?)$/,"");if(b!==void 0&&null!==b){var e=-1!==c.indexOf("?")?"&":"?",f=c.split("#");return c=f[0]+e+a+"="+b,f[1]&&(c+="#"+f[1]),c}return c;}
function themeScrollTo(offset,duration){duration=duration||800;$('body,html').animate({scrollTop:offset},duration);}
(function($,window,document,undefined){var pluginName="themifyScroll",defaults={speed:1800};function Plugin(element,options){this.element=element;this.options=$.extend({},defaults,options);this._defaults=defaults;this._name=pluginName;this.onClicking=false;this.init();}
Plugin.prototype={sections:['header'],init:function(){var self=this;$('#main-nav li a').each(function(){var url=$(this).prop('hash');if('undefined'!=typeof url&&url.indexOf('#')!=-1&&url.length>1){self.sections.push(url);}});$('body').on('click','a[href*=#]',function(e){var elementClick=$(this).prop('hash');if('undefined'!=typeof elementClick&&elementClick.indexOf('#')!=-1&&elementClick.length>1){var destination=$(elementClick).offset().top,newHash='#'+elementClick.replace('#','');if($(elementClick).length===0){return;}
self.onClicking=true;if(!$('body').hasClass('ie')){e.preventDefault();$("html,body").animate({scrollTop:destination},self.options.speed,function(){self.onClicking=false;});}
$(this).parent('li').addClass('current_page_item').siblings().removeClass('current_page_item');if(elementClick.replace('#','')!=='header'){self.setHash(newHash);}else{self.clearHash();}
if($(window).width()<=760&&$('#main-nav').is(':visible')){$('#menu-icon').trigger('click');}}});this.changeHash();},changeHash:function(){var self=this;if(self.sections.length>0){var didScroll=false;$(window).scroll(function(){didScroll=true;});setInterval(function(){if(didScroll){didScroll=false;$.each(self.sections,function(index,value){var section=value,obj=$(value);if(obj.length>0){var offsetY=obj.offset().top,elemHeight=obj.height();var offsetAmount=offsetY;elemHeight=obj.height();if(offsetAmount<window.pageYOffset&&offsetAmount+elemHeight>window.pageYOffset){if(self.onClicking)return;if(section.replace('#','')!=='header'){self.setHash(section);}
$('a[href*='+section+']').parent('li').addClass('current_page_item').siblings().removeClass('current_page_item current-menu-item');if(section.replace('#','')=='header'){self.clearHash();}}}});}},500);}},setHash:function(hash){if(history.pushState){history.pushState(null,null,hash);}
else{location.hash=hash;}},clearHash:function(){if(window.history&&window.history.replaceState){window.history.replaceState('','',window.location.pathname);}else{window.location.href=window.location.href.replace(/#.*$/,'#');}}};$.fn[pluginName]=function(options){return this.each(function(){if(!$.data(this,"plugin_"+pluginName)){$.data(this,"plugin_"+pluginName,new Plugin(this,options));}});};})(jQuery,window,document);function is_touch_device(){return!!('true'==themifyScript.isTouch)||!!('window.navigator.msMaxTouchPoints'in window);}
function is_ie(){return navigator.appName=='Microsoft Internet Explorer';}
function infiniteIsotope(containerSelector,itemSelectorIso,itemSelectorInf,containerInfinite,doIso,isoColW){var scrollMaxPages=parseInt(themifyScript.maxPages),$container=$(containerSelector),$containerInfinite=$(containerInfinite);if(typeof qp_max_pages!='undefined')
scrollMaxPages=qp_max_pages;if((!$('body.list-post').length>0)&&doIso){$container.isotope({masonry:{columnWidth:isoColW},itemSelector:itemSelectorIso,transformsEnabled:false,animationEngine:'jquery'});$(window).resize();}
$containerInfinite.infinitescroll({navSelector:'#load-more a:last',nextSelector:'#load-more a:last',itemSelector:itemSelectorInf,loadingText:'',donetext:'',loading:{img:themifyScript.loadingImg},maxPage:scrollMaxPages,behavior:'auto'!=themifyScript.autoInfinite?'twitter':'',pathParse:function(path,nextPage){return path.match(/^(.*?)\b2\b(?!.*\b2\b)(.*?$)/).slice(1);}},function(newElements){var $newElems=$(newElements).hide();$('.post.newItems').removeClass('newItems');$newElems.addClass('newItems');$newElems.imagesLoaded(function(){$newElems.fadeIn();$('#infscr-loading').fadeOut('normal');if(1==scrollMaxPages){$('#load-more, #infscr-loading').remove();}
if(typeof ThemifyGallery!=='undefined'){ThemifyGallery.init({'context':jQuery(themifyScript.lightboxContext)});}
if(typeof jQuery.fn.carouFredSel!=='undefined'){createCarousel($('.type-portfolio.newItems .slideshow'),'normal');}
if((!$('body.list-post').length>0)&&doIso){$container.isotope('appended',$newElems);}
if(themifyScript.transitionEffect){ThemifyParallax.parallaxElements();if('undefined'!==typeof ThemifyBuilderModuleJs){ThemifyBuilderModuleJs.doAnimation();}}});scrollMaxPages=scrollMaxPages-1;if(1<scrollMaxPages&&'auto'!=themifyScript.autoInfinite)
$('#load-more a').show();});if('auto'==themifyScript.autoInfinite){$('#load-more, #load-more a').hide();}}
function createCarousel(obj,mode){obj.each(function(){var $this=$(this),this_id=$this.data('id');$this.carouFredSel({responsive:true,prev:'#'+this_id+' .carousel-prev',next:'#'+this_id+' .carousel-next',pagination:{container:'#'+this_id+' .carousel-pager'},circular:true,infinite:true,scroll:{items:1,wipe:true,fx:$this.data('effect'),duration:parseInt($this.data('speed'))},auto:{play:!!('off'!=$this.data('autoplay')),pauseDuration:'off'!=$this.data('autoplay')?parseInt($this.data('autoplay')):0},items:{visible:{min:1,max:1},width:222},onCreate:function(){$this.closest('.slideshow-wrap').css({'visibility':'visible','height':'auto'});$('.carousel-next, .carousel-prev',$this.closest('.slideshow-wrap')).hide();$(window).resize();}});});}
FixedHeader={init:function(){this.headerHeight=$('#header hgroup').outerHeight()-$('#nav-bar').outerHeight();if($('body').hasClass('ie')){$('html, body').addClass('iefix');}
$(window).on('scroll',this.activate).on('touchstart.touchScroll',this.activate).on('touchmove.touchScroll',this.activate);},activate:function(){if($(window).scrollTop()<=FixedHeader.headerHeight){FixedHeader.scrollDisabled();}else{FixedHeader.scrollEnabled();}},scrollDisabled:function(){$('#nav-bar').removeClass('fixed-nav-bar');$('body').removeClass('fixed-header-on');},scrollEnabled:function(){$('#nav-bar').addClass('fixed-nav-bar');$('body').addClass('fixed-header-on');}};ThemifyParallax={init:function(){this.windowHeight=$(window).height();$(window).resize(function(){ThemifyParallax.windowHeight=$(window).height();});if(themifyScript.scrollingEffect){if(themifyScript.scrollingEffectType=='effect1'){this.setup_effect_1();}else{this.setup_effect_2();}
this.headerParallax();}else{this.setBackground();}
if(themifyScript.transitionEffect){this.parallaxElements();}},setup_effect_1:function(){var self=ThemifyParallax;self.setBackground();if(!$('body').hasClass('query-section')||is_ie()){return;}
$('.section-post, #headerwrap').each(function(){var ids=$(this).prop('id'),$elemns=$('#'+ids),didScroll=false;setInterval(function(){if(didScroll){didScroll=false;self.run($elemns);}},550);$(window).on('scroll touchstart.touchScroll touchmove.touchScroll',function(){didScroll=true;});});},setup_effect_2:function(){$('.section-post, #headerwrap').each(function(){var $self=$(this),bgImage=typeof $self.data('bg')!=='undefined'?'url("'+$self.data('bg')+'")':'';$self.addClass('scrolling-bg-image').css({backgroundImage:bgImage});if(typeof $.fn.builderParallax!=='undefined'){$self.builderParallax("50%",0.1);}});},run:function(elemns){var $window=$(window),pos=$window.scrollTop(),$element=elemns,top=$element.offset().top,height=$element.outerHeight(true);if(top+height<pos||top>pos+ThemifyParallax.windowHeight){return;}
var cssTopPos=Math.max(Math.round((pos-top)*0.2),0)+'px';$element.css('top',cssTopPos);if($('#nav-bar').hasClass('fixed-nav-bar')){$('#nav-bar').css({'bottom':''});}},headerParallax:function(){if(is_ie()){return;}
$('#header hgroup').each(function(){var self=ThemifyParallax,$this=$(this),offset=($('body').hasClass('admin-bar'))?30:60,elemnTop=parseInt($('#site-logo').offset().top-offset),didScroll=false;setInterval(function(){if(didScroll){didScroll=false;self.plHeaderRun($this,elemnTop,offset);}},550);$(window).on('scroll touchstart.touchScroll touchmove.touchScroll',function(){didScroll=true;});});},plHeaderRun:function($obj,elemnTop,offset){var scrollAmount=$(window).scrollTop(),ratio=scrollAmount-elemnTop,animateTop=-(ratio)+'px';if(scrollAmount>(Math.max(elemnTop-50,0))){$obj.css({'-webkit-transform':'translateY('+animateTop+')','-moz-transform':'translateY('+animateTop+')','-o-transform':'translateY('+animateTop+')','-ms-transform':'translateY('+animateTop+')','transform':'translateY('+animateTop+')'});}else{$obj.removeAttr('style');}},parallaxElements:function(){$('.col2-1.first, .col3-1.first, .col4-1.first, .col4-2.first, .col4-3.first',$('#body, #footer')).each(function(){var $this=$(this);if($this.hasClass('col2-1')){$this.next('.col2-1').addClass('last');$this.next('.col4-1').addClass('third').next('.col4-1').addClass('last');}else if($this.hasClass('col3-1')){$this.next('.col3-1').addClass('second').next('.col3-1').addClass('last');$this.next('.col3-2').addClass('last');}else if($this.hasClass('col4-1')){$this.next('.col4-1').addClass('second').next('.col4-1').addClass('third').next('.col4-1').addClass('last');}else if($this.hasClass('col4-2')){$this.next('.col4-2').addClass('last');$this.next('.col4-1').addClass('third').next('.col4-1').addClass('last');}else if($this.hasClass('col4-3')){$this.next('.col4-1').addClass('last');}});$('.gallery',$('#body')).each(function(){var columns=$(this).attr('class').match(/gallery-columns-([0-9])/)[1];$('dl',$(this)).addClass('middle');$('dl:nth-of-type('+columns+'n+1)',$(this)).addClass('first');$('dl:nth-of-type('+columns+'n+1)',$(this)).removeClass('middle');$('dl:nth-of-type('+columns+'n+'+columns+')',$(this)).addClass('last');$('dl:nth-of-type('+columns+'n+'+columns+')',$(this)).removeClass('middle');if(columns>3){$('dl:nth-of-type('+columns+'n+2)',$(this)).addClass('second');$('dl:nth-of-type('+columns+'n+2)',$(this)).removeClass('middle');$('dl:nth-of-type('+columns+'n+'+(columns-1)+')',$(this)).addClass('third');$('dl:nth-of-type('+columns+'n+'+(columns-1)+')',$(this)).removeClass('middle');}});$.each(themifyScript.transitionSetup.selectors,function(key,val){$(val).addClass(themifyScript.transitionSetup.effect);});},setBackground:function(){if(typeof $.fn.backstretch!=='undefined'){var $section=$('.section-post, #headerwrap'),resizeId;$section.each(function(){var bg=$(this).data('bg');if(typeof bg!=='undefined'){if($(this).hasClass('fullcover')){$(this).backstretch(bg);}else{$(this).css('background-image','url('+bg+')');}}});$(window).on('backstretch.show',function(e,instance){instance.$container.css('z-index','');}).on('resize',function(){clearTimeout(resizeId);resizeId=setTimeout(function(){$section.each(function(){if($(this).hasClass('fullcover')){var instance=$(this).data("backstretch");if('undefined'!==typeof instance)instance.resize();}});},500);});}}};function portfolio_item_break_point(){$('.section-post .shortcode.portfolio, .section-post .module-portfolio').each(function(){var selector='',viewport=$(window).width();$(this).find('.sec-post-break').remove();if($(this).hasClass('grid2-thumb')||$(this).hasClass('grid2')){selector='.post:nth-child(2n+2)';}else if($(this).hasClass('grid4')){selector='.post:nth-child(4n+4)';}else if($(this).hasClass('grid3')){selector='.post:nth-child(3n+3)';}else if($(this).hasClass('grid2')){selector='.post:nth-child(2n+2)';}else{selector='.post:nth-child(1n+1)';}
if(viewport<480){selector='.post:nth-child(1n+1)';}
$(this).find(selector).each(function(){$('<div class="sec-post-break" />').insertAfter($(this));});});}
$(document).ready(function(){var $body=$('body'),$placeholder=$('[placeholder]'),$charts=$('.chart',$body),$skills=$('.progress-bar',$body);$body.on('click','#menu-icon',function(event){event.preventDefault();$("#main-nav").fadeToggle();$("#headerwrap #top-nav").hide();$(this).toggleClass("active");});$('.not-ie .back-top a').on('click',function(e){e.preventDefault();themeScrollTo(0);});if(is_touch_device()){$body.addClass('is-touch');var vh=$(window).height();if(navigator.userAgent.match(/iPhone/i)){vh=vh+60;}
$('.query-section #headerwrap').css('height',vh);}
$('#body').on('mouseover mouseout','.slideshow-wrap',function(event){if(event.type=='mouseover'){if($(window).width()>600){$('.carousel-next, .carousel-prev',$(this)).css('display','block');}}else{if($(window).width()>600){$('.carousel-next, .carousel-prev',$(this)).css('display','none');}}});FixedHeader.init();ThemifyParallax.init();var menuHeight=$('#nav-bar').outerHeight();portfolio_item_break_point();var portoInitialPos;$('.section-post .shortcode.portfolio .porto-expand-js, .section-post .module-portfolio .porto-expand-js').on('click',function(e){e.preventDefault();var $this=$(this),prefixLink=$this.data('prefix-link'),url=UpdateQueryString('porto_expand',1,$this.attr('href')),placehold=$this.closest('.post').nextAll('.sec-post-break').first();if(placehold.length===0){placehold=$this.closest('.shortcode');}
portoInitialPos=$(window).scrollTop();$.ajax({type:"POST",url:url,dataType:'html',beforeSend:function(xhr){$('.portfolio-expanded').remove();$('<div class="portfolio-expanded" />').appendTo(placehold).hide();$('.portfolio-loader').remove();$('<div class="portfolio-loader">').appendTo($this.closest('.portfolio-post').find('.post-image')).show();},success:function(data){var $newElems=$(data);$('.portfolio-expanded').hide().append($newElems).slideDown('slow').promise().done(function(){if(typeof $.fn.carouFredSel!=='undefined'){var slider_id=$('.slideshow-wrap',$newElems).attr('id')+'-expanded';$('.slideshow-wrap',$newElems).attr('id',slider_id);$('.slideshow',$newElems).attr('data-id',slider_id);createCarousel($('.slideshow',$newElems),'expanded');}
themeScrollTo($('.portfolio-expanded').offset().top-menuHeight,1000);$body.trigger('portfolio_expanded');});$('.portfolio-loader').remove();}});});$body.on('portfolio_expanded',function(){if('undefined'!==typeof ThemifyBuilderModuleJs)ThemifyBuilderModuleJs.loadOnAjax();}).on('click','.close-expanded',function(e){e.preventDefault();$(this).parent().slideUp(800,function(){$(this).remove();});themeScrollTo(portoInitialPos);}).on('touchstart touchmove touchend','#main-nav',function(e){e.stopPropagation();});if(typeof $.fn.easyPieChart!=='undefined'){$charts.each(function(){var $self=$(this),barColor=$self.data('color'),percent=$self.data('percent');$.each(themifyScript.chart,function(index,value){if('false'==value||'true'==value){themifyScript.chart[index]='false'!=value;}else if(parseInt(value)){themifyScript.chart[index]=parseInt(value);}else if(parseFloat(value)){themifyScript.chart[index]=parseFloat(value);}});if(typeof barColor!=='undefined')
themifyScript.chart.barColor='#'+barColor.toString().replace('#','');$self.easyPieChart(themifyScript.chart);$self.data('easyPieChart').update(0);if(typeof $.waypoints!=='undefined'&&themifyScript.transitionEffect){$self.waypoint(function(direction){$self.data('easyPieChart').update(percent);},{offset:'80%'});$self.waypoint(function(direction){if(direction==='up'){$self.data('easyPieChart').update(0);}},{offset:'92%'});}else{$self.data('easyPieChart').update(percent);}});}
if(themifyScript.transitionEffect){$skills.each(function(){var $self=$(this).find('span'),percent=$self.data('percent');if(typeof $.waypoints!=='undefined'){$self.waypoint(function(direction){$self.animate({width:percent},800);},{offset:'80%'}).waypoint(function(direction){if(direction==='up'){$self.animate({width:percent},800);}},{offset:'20%'}).waypoint(function(direction){if(direction==='up'){$self.width(0);}},{offset:-10}).waypoint(function(direction){if(direction==='down'){$self.width(0);}},{offset:'110%'});}});}
if(typeof ThemifyGallery!=='undefined'){ThemifyGallery.init({'context':jQuery(themifyScript.lightboxContext)});}
$(window).on('resize',function(){var $context=$('#loops-wrapper'),$verticalSection=$('.section-post.message',$context);for(var i=0;i<$verticalSection.length;i++){var $selection=$verticalSection.eq(i);$selection.css({'lineHeight':parseInt($verticalSection.css('height'))+'px'});if($selection.find('.vertical-centered').length==0){$selection.find('.section-inner').wrapInner('<div class="vertical-centered" />');}}});});$(window).load(function(){$('body').themifyScroll({speed:1000});if(typeof $.fn.carouFredSel!=='undefined'){createCarousel($('.portfolio-post .slideshow'),'normal');}
var target=window.location.hash.replace(/^#\!\//,"").replace('#','');if(target!==''&&$('#'+target).length>0){var anchor=$('#'+target),destination=anchor.offset().top;themeScrollTo(destination,1000);}
if(typeof($.fn.infinitescroll)!=='undefined'){if($('.post').length>0){infiniteIsotope('#loops-wrapper','.post','#content .post','#loops-wrapper',false,'');}
if($('.portfolio-post').length>0){infiniteIsotope('.portfolio-wrapper','.portfolio-post','.portfolio-post','.portfolio-wrapper',false,'');}}});}(jQuery));;var ThemifyGallery={};(function($){ThemifyGallery={config:{fullscreen:themifyScript.lightbox.fullscreenSelector,lightbox:themifyScript.lightbox.lightboxSelector,lightboxGallery:themifyScript.lightbox.gallerySelector,lightboxContentImages:themifyScript.lightbox.lightboxContentImagesSelector,context:document},init:function(config){if(config&&typeof config=='object'){$.extend(ThemifyGallery.config,config);}
if(config.extraLightboxArgs&&typeof config=='object'){for(var attrname in config.extraLightboxArgs){themifyScript.lightbox[attrname]=config.extraLightboxArgs[attrname];}}
this.general();this.parseArgs();this.doLightbox();this.doFullscreen();},general:function(){context=this.config.context;},parseArgs:function(){$.each(themifyScript.lightbox,function(index,value){if('false'==value||'true'==value){themifyScript.lightbox[index]='false'!=value;}else if(parseInt(value)){themifyScript.lightbox[index]=parseInt(value);}else if(parseFloat(value)){themifyScript.lightbox[index]=parseFloat(value);}});},doLightbox:function(){context=this.config.context;if(typeof $.fn.magnificPopup!=='undefined'&&typeof themifyScript.lightbox.lightboxOn!=='undefined'){$(context).on('click',ThemifyGallery.config.lightbox,function(event){event.preventDefault();var $self=$(this),$link=$(this).attr('href'),$type=ThemifyGallery.getFileType($link),$title=(typeof $(this).children('img').attr('alt')!=='undefined')?$(this).children('img').attr('alt'):$(this).attr('title');$iframe_width=(ThemifyGallery.isVideo($link))?'100%':(ThemifyGallery.getParam('width',$link))?ThemifyGallery.getParam('width',$link):'700';$iframe_height=(ThemifyGallery.isVideo($link))?'100%':(ThemifyGallery.getParam('height',$link))?ThemifyGallery.getParam('height',$link):'100%';if($iframe_width.indexOf("%")==-1)$iframe_width+='px';if($iframe_height.indexOf("%")==-1)$iframe_height+='px';var $args={items:{src:$link,title:$title},type:$type,iframe:{markup:'<div class="mfp-iframe-scaler" style="max-width: '+$iframe_width+' !important; height: '+$iframe_height+';">'+'<div class="mfp-close"></div>'+'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+'</div>',}};if($self.find('img').length>0){$.extend($args,{mainClass:'mfp-with-zoom',zoom:{enabled:true,duration:300,easing:'ease-in-out',opener:function(openerElement){return $self.find('img');}}});}
if(ThemifyGallery.isVideo($link)){$args['mainClass']+=' video-frame';}else{$args['mainClass']+=' standard-frame';}
if(ThemifyGallery.isInIframe()){window.parent.jQuery.magnificPopup.open($args);}else{$.magnificPopup.open($args);}});$(themifyScript.lightbox.contentImagesAreas,context).each(function(index){var images=[],links=[];if(themifyScript.lightbox.lightboxContentImages&&themifyScript.lightbox.lightboxGalleryOn){$(ThemifyGallery.config.lightboxContentImages,$(this)).filter(function(index){if(!$(this).parent().hasClass('gallery-icon')&&!$(this).hasClass('lightbox')){links.push($(this));var description=$(this).attr('title');if($(this).next('.wp-caption-text').length>0){description=$(this).next('.wp-caption-text').html();}else{description=$(this).children('img').attr('alt');}
images.push({src:$(this).attr('href'),title:description,type:'image'});return $(this);}}).each(function(index){if(links.length>0){$(this).on('click',function(event){event.preventDefault();var $self=$(this);var $args={items:{src:images[index].src,title:images[index].title},type:'image'};if($self.find('img').length>0){$.extend($args,{mainClass:'mfp-with-zoom',zoom:{enabled:true,duration:300,easing:'ease-in-out',opener:function(openerElement){return $self.find('img');}}});}
if(ThemifyGallery.isInIframe()){window.parent.jQuery.magnificPopup.open($args);}else{$.magnificPopup.open($args);}});}});}});if(themifyScript.lightbox.lightboxGalleryOn){$(context).on('click',ThemifyGallery.config.lightboxGallery,function(event){event.preventDefault();var $gallery=$(ThemifyGallery.config.lightboxGallery,$(this).parent().parent().parent()),images=[];$gallery.each(function(index){var description=$(this).attr('title');if($(this).parent().next('.gallery-caption').length>0){description=$(this).parent().next('.wp-caption-text').html();}else{description=$(this).children('img').attr('alt');}
images.push({src:$(this).attr('href'),title:description,type:'image'});});$args={gallery:{enabled:true},items:images,mainClass:'mfp-with-zoom',zoom:{enabled:true,duration:300,easing:'ease-in-out',opener:function(openerElement){var imageEl=$($gallery[openerElement.index]);return imageEl.is('img')?imageEl:imageEl.find('img');}}}
if(ThemifyGallery.isInIframe()){window.parent.jQuery.magnificPopup.open($args,$gallery.index(this));}else{$.magnificPopup.open($args,$gallery.index(this));}});}}},doFullscreen:function(){if(this.config.context.selector){context=$(themifyScript.lightbox.contentImagesAreas,this.config.context);}else{context=this.config.context;}
if(typeof $.fn.photoSwipe!=='undefined'&&typeof themifyScript.lightbox.fullscreenOn!=='undefined'){$(context).each(function(index){var $elf=$(this),settings={target:window,preventHide:false,zIndex:50000,getImageSource:function(obj){return obj.url;},getImageCaption:function(obj){return obj.caption;}};if($(ThemifyGallery.config.fullscreen,$elf).length>0){var images=[],instance,id=$elf.attr('id');$(ThemifyGallery.config.fullscreen,$elf).each(function(index){images.push({url:$(this).attr('href'),caption:$('img',this).attr('alt')});});for(var attrname in themifyScript.lightbox){settings[attrname]=themifyScript.lightbox[attrname];}
instance=Code.PhotoSwipe.getInstance(id);if(Code.Util.isNothing(instance)){instance=Code.PhotoSwipe.attach(images,settings,id);}}
if(themifyScript.lightbox.lightboxContentImages&&$(ThemifyGallery.config.lightboxContentImages,$elf).length>0){$cimgs=$(ThemifyGallery.config.lightboxContentImages,$elf).filter(function(index){if(!$(this).parent().hasClass('gallery-icon')&&!$(this).hasClass('lightbox'))
return $(this);});if($cimgs.length>0){$cimgs.photoSwipe(themifyScript.lightbox);}}});if(themifyScript.lightbox.fullscreenOn){$(context).on('click',ThemifyGallery.config.fullscreen,function(e){e.preventDefault();var $a=$(this),id=$a.closest(themifyScript.lightbox.contentImagesAreas).attr('id');var instance=window.parent.Code.PhotoSwipe.getInstance(id);var index=0;$.each(instance.cache.images,function(i,item){if(item.src==$a.attr('href')){index=i;}});instance.show(index);});}}},countItems:function(type){context=this.config.context;if('lightbox'==type)return $(this.config.lightbox,context).length+$(this.config.lightboxGallery,context).length+$(ThemifyGallery.config.lightboxContentImages,context).length;else return $(this.config.fullscreen,context).length+$(ThemifyGallery.config.lightboxContentImages,context).length;},isInIframe:function(){if(typeof ThemifyGallery.config.extraLightboxArgs!=='undefined'){if(typeof ThemifyGallery.config.extraLightboxArgs.displayIframeContentsInParent!=='undefined'&&true==ThemifyGallery.config.extraLightboxArgs.displayIframeContentsInParent){return true;}else{return false;}}else{return false;}},getFileType:function(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)||itemSrc.match(/youtu\.be/i)||itemSrc.match(/vimeo\.com/i)||itemSrc.match(/\b.mov\b/i)||itemSrc.match(/\b.swf\b/i)||itemSrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemSrc.match(/\bajax=true\b/i)){return'ajax';}else if(itemSrc.substr(0,1)=='#'){return'inline';}else{return'image';}},isVideo:function(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)||itemSrc.match(/youtu\.be/i)||itemSrc.match(/vimeo\.com/i)||itemSrc.match(/\b.mov\b/i)||itemSrc.match(/\b.swf\b/i)){return true;}else{return false;}},getParam:function(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);return(results==null)?"":results[1];}};}(jQuery));;
/* Magnific Popup - v0.9.9 - 2013-12-27
* http://dimsemenov.com/plugins/magnific-popup/
* Copyright (c) 2013 Dmitry Semenov; */
(function(e){var t,n,i,o,r,a,s,l="Close",c="BeforeClose",d="AfterClose",u="BeforeAppend",p="MarkupParse",f="Open",m="Change",g="mfp",h="."+g,v="mfp-ready",C="mfp-removing",y="mfp-prevent-close",w=function(){},b=!!window.jQuery,I=e(window),x=function(e,n){t.ev.on(g+e+h,n)},k=function(t,n,i,o){var r=document.createElement("div");return r.className="mfp-"+t,i&&(r.innerHTML=i),o?n&&n.appendChild(r):(r=e(r),n&&r.appendTo(n)),r},T=function(n,i){t.ev.triggerHandler(g+n,i),t.st.callbacks&&(n=n.charAt(0).toLowerCase()+n.slice(1),t.st.callbacks[n]&&t.st.callbacks[n].apply(t,e.isArray(i)?i:[i]))},E=function(n){return n===s&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),s=n),t.currTemplate.closeBtn},_=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},S=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};w.prototype={constructor:w,init:function(){var n=navigator.appVersion;t.isIE7=-1!==n.indexOf("MSIE 7."),t.isIE8=-1!==n.indexOf("MSIE 8."),t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(n),t.isIOS=/iphone|ipad|ipod/gi.test(n),t.supportsTransition=S(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),o=e(document),t.popupsCache={}},open:function(n){i||(i=e(document.body));var r;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var s,l=n.items;for(r=0;l.length>r;r++)if(s=l[r],s.parsed&&(s=s.el[0]),s===n.el[0]){t.index=r;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return t.updateItemHTML(),void 0;t.types=[],a="",t.ev=n.mainEl&&n.mainEl.length?n.mainEl.eq(0):o,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,n),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=k("bg").on("click"+h,function(){t.close()}),t.wrap=k("wrap").attr("tabindex",-1).on("click"+h,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=k("container",t.wrap)),t.contentContainer=k("content"),t.st.preloader&&(t.preloader=k("preloader",t.container,t.st.tLoading));var c=e.magnificPopup.modules;for(r=0;c.length>r;r++){var d=c[r];d=d.charAt(0).toUpperCase()+d.slice(1),t["init"+d].call(t)}T("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(p,function(e,t,n,i){n.close_replaceWith=E(i.type)}),a+=" mfp-close-btn-in"):t.wrap.append(E())),t.st.alignTop&&(a+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:I.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:o.height(),position:"absolute"}),t.st.enableEscapeKey&&o.on("keyup"+h,function(e){27===e.keyCode&&t.close()}),I.on("resize"+h,function(){t.updateSize()}),t.st.closeOnContentClick||(a+=" mfp-auto-cursor"),a&&t.wrap.addClass(a);var u=t.wH=I.height(),m={};if(t.fixedContentPos&&t._hasScrollBar(u)){var g=t._getScrollbarSize();g&&(m.marginRight=g)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):m.overflow="hidden");var C=t.st.mainClass;return t.isIE7&&(C+=" mfp-ie7"),C&&t._addClassToMFP(C),t.updateItemHTML(),T("BuildControls"),e("html").css(m),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||i),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(v),t._setFocus()):t.bgOverlay.addClass(v),o.on("focusin"+h,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(u),T(f),n},close:function(){t.isOpen&&(T(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(C),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){T(l);var n=C+" "+v+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var i={marginRight:""};t.isIE7?e("body, html").css("overflow",""):i.overflow="",e("html").css(i)}o.off("keyup"+h+" focusin"+h),t.ev.off(h),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,T(d)},updateSize:function(e){if(t.isIOS){var n=document.documentElement.clientWidth/window.innerWidth,i=window.innerHeight*n;t.wrap.css("height",i),t.wH=i}else t.wH=e||I.height();t.fixedContentPos||t.wrap.css("height",t.wH),T("Resize")},updateItemHTML:function(){var n=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),n.parsed||(n=t.parseEl(t.index));var i=n.type;if(T("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var o=t.st[i]?t.st[i].markup:!1;T("FirstMarkupParse",o),t.currTemplate[i]=o?e(o):!0}r&&r!==n.type&&t.container.removeClass("mfp-"+r+"-holder");var a=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(a,i),n.preloaded=!0,T(m,n),r=n.type,t.container.prepend(t.contentContainer),T("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".mfp-close").length||t.content.append(E()):t.content=e:t.content="",T(u),t.container.addClass("mfp-"+n+"-holder"),t.contentContainer.append(t.content)},parseEl:function(n){var i,o=t.items[n];if(o.tagName?o={el:e(o)}:(i=o.type,o={data:o,src:o.src}),o.el){for(var r=t.types,a=0;r.length>a;a++)if(o.el.hasClass("mfp-"+r[a])){i=r[a];break}o.src=o.el.attr("data-mfp-src"),o.src||(o.src=o.el.attr("href"))}return o.type=i||t.st.type||"inline",o.index=n,o.parsed=!0,t.items[n]=o,T("ElementParse",o),t.items[n]},addGroup:function(e,n){var i=function(i){i.mfpEl=this,t._openClick(i,e,n)};n||(n={});var o="click.magnificPopup";n.mainEl=e,n.items?(n.isObj=!0,e.off(o).on(o,i)):(n.isObj=!1,n.delegate?e.off(o).on(o,n.delegate,i):(n.items=e,e.off(o).on(o,i)))},_openClick:function(n,i,o){var r=void 0!==o.midClick?o.midClick:e.magnificPopup.defaults.midClick;if(r||2!==n.which&&!n.ctrlKey&&!n.metaKey){var a=void 0!==o.disableOn?o.disableOn:e.magnificPopup.defaults.disableOn;if(a)if(e.isFunction(a)){if(!a.call(t))return!0}else if(a>I.width())return!0;n.type&&(n.preventDefault(),t.isOpen&&n.stopPropagation()),o.el=e(n.mfpEl),o.delegate&&(o.items=i.find(o.delegate)),t.open(o)}},updateStatus:function(e,i){if(t.preloader){n!==e&&t.container.removeClass("mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var o={status:e,text:i};T("UpdateStatus",o),e=o.status,i=o.text,t.preloader.html(i),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(y)){var i=t.st.closeOnContentClick,o=t.st.closeOnBgClick;if(i&&o)return!0;if(!t.content||e(n).hasClass("mfp-close")||t.preloader&&n===t.preloader[0])return!0;if(n===t.content[0]||e.contains(t.content[0],n)){if(i)return!0}else if(o&&e.contains(document,n))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?o.height():document.body.scrollHeight)>(e||I.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(n){return n.target===t.wrap[0]||e.contains(t.wrap[0],n.target)?void 0:(t._setFocus(),!1)},_parseMarkup:function(t,n,i){var o;i.data&&(n=e.extend(i.data,n)),T(p,[t,n,i]),e.each(n,function(e,n){if(void 0===n||n===!1)return!0;if(o=e.split("_"),o.length>1){var i=t.find(h+"-"+o[0]);if(i.length>0){var r=o[1];"replaceWith"===r?i[0]!==n[0]&&i.replaceWith(n):"img"===r?i.is("img")?i.attr("src",n):i.replaceWith('<img src="'+n+'" class="'+i.attr("class")+'" />'):i.attr(o[1],n)}}else t.find(h+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.id="mfp-sbm",e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,n){return _(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(n){_();var i=e(this);if("string"==typeof n)if("open"===n){var o,r=b?i.data("magnificPopup"):i[0].magnificPopup,a=parseInt(arguments[1],10)||0;r.items?o=r.items[a]:(o=i,r.delegate&&(o=o.find(r.delegate)),o=o.eq(a)),t._openClick({mfpEl:o},i,r)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),b?i.data("magnificPopup",n):i[0].magnificPopup=n,t.addGroup(i,n);return i};var P,O,z,M="inline",B=function(){z&&(O.after(z.addClass(P)).detach(),z=null)};e.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(M),x(l+"."+M,function(){B()})},getInline:function(n,i){if(B(),n.src){var o=t.st.inline,r=e(n.src);if(r.length){var a=r[0].parentNode;a&&a.tagName&&(O||(P=o.hiddenClass,O=k(P),P="mfp-"+P),z=r.after(O).detach().removeClass(P)),t.updateStatus("ready")}else t.updateStatus("error",o.tNotFound),r=e("<div>");return n.inlineElement=r,r}return t.updateStatus("ready"),t._parseMarkup(i,{},n),i}}});var F,H="ajax",L=function(){F&&i.removeClass(F)},A=function(){L(),t.req&&t.req.abort()};e.magnificPopup.registerModule(H,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){t.types.push(H),F=t.st.ajax.cursor,x(l+"."+H,A),x("BeforeChange."+H,A)},getAjax:function(n){F&&i.addClass(F),t.updateStatus("loading");var o=e.extend({url:n.src,success:function(i,o,r){var a={data:i,xhr:r};T("ParseAjax",a),t.appendContent(e(a.data),H),n.finished=!0,L(),t._setFocus(),setTimeout(function(){t.wrap.addClass(v)},16),t.updateStatus("ready"),T("AjaxContentAdded")},error:function(){L(),n.finished=n.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",n.src))}},t.st.ajax.settings);return t.req=e.ajax(o),""}}});var j,N=function(n){if(n.data&&void 0!==n.data.title)return n.data.title;var i=t.st.image.titleSrc;if(i){if(e.isFunction(i))return i.call(t,n);if(n.el)return n.el.attr(i)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var e=t.st.image,n=".image";t.types.push("image"),x(f+n,function(){"image"===t.currItem.type&&e.cursor&&i.addClass(e.cursor)}),x(l+n,function(){e.cursor&&i.removeClass(e.cursor),I.off("resize"+h)}),x("Resize"+n,t.resizeImage),t.isLowIE&&x("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var n=0;t.isLowIE&&(n=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-n)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,j&&clearInterval(j),e.isCheckingImgSize=!1,T("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var n=0,i=e.img[0],o=function(r){j&&clearInterval(j),j=setInterval(function(){return i.naturalWidth>0?(t._onImageHasSize(e),void 0):(n>200&&clearInterval(j),n++,3===n?o(10):40===n?o(50):100===n&&o(500),void 0)},r)};o(1)},getImage:function(n,i){var o=0,r=function(){n&&(n.img[0].complete?(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("ready")),n.hasSize=!0,n.loaded=!0,T("ImageLoadComplete")):(o++,200>o?setTimeout(r,100):a()))},a=function(){n&&(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("error",s.tError.replace("%url%",n.src))),n.hasSize=!0,n.loaded=!0,n.loadError=!0)},s=t.st.image,l=i.find(".mfp-img");if(l.length){var c=document.createElement("img");c.className="mfp-img",n.img=e(c).on("load.mfploader",r).on("error.mfploader",a),c.src=n.src,l.is("img")&&(n.img=n.img.clone()),c=n.img[0],c.naturalWidth>0?n.hasSize=!0:c.width||(n.hasSize=!1)}return t._parseMarkup(i,{title:N(n),img_replaceWith:n.img},n),t.resizeImage(),n.hasSize?(j&&clearInterval(j),n.loadError?(i.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",n.src))):(i.removeClass("mfp-loading"),t.updateStatus("ready")),i):(t.updateStatus("loading"),n.loading=!0,n.hasSize||(n.imgHidden=!0,i.addClass("mfp-loading"),t.findImageSize(n)),i)}}});var W,R=function(){return void 0===W&&(W=void 0!==document.createElement("p").style.MozTransform),W};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e,n=t.st.zoom,i=".zoom";if(n.enabled&&t.supportsTransition){var o,r,a=n.duration,s=function(e){var t=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),i="all "+n.duration/1e3+"s "+n.easing,o={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},r="transition";return o["-webkit-"+r]=o["-moz-"+r]=o["-o-"+r]=o[r]=i,t.css(o),t},d=function(){t.content.css("visibility","visible")};x("BuildControls"+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.content.css("visibility","hidden"),e=t._getItemToZoom(),!e)return d(),void 0;r=s(e),r.css(t._getOffset()),t.wrap.append(r),o=setTimeout(function(){r.css(t._getOffset(!0)),o=setTimeout(function(){d(),setTimeout(function(){r.remove(),e=r=null,T("ZoomAnimationEnded")},16)},a)},16)}}),x(c+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.st.removalDelay=a,!e){if(e=t._getItemToZoom(),!e)return;r=s(e)}r.css(t._getOffset(!0)),t.wrap.append(r),t.content.css("visibility","hidden"),setTimeout(function(){r.css(t._getOffset())},16)}}),x(l+i,function(){t._allowZoom()&&(d(),r&&r.remove(),e=null)})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return t.currItem.hasSize?t.currItem.img:!1},_getOffset:function(n){var i;i=n?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var o=i.offset(),r=parseInt(i.css("padding-top"),10),a=parseInt(i.css("padding-bottom"),10);o.top-=e(window).scrollTop()-r;var s={width:i.width(),height:(b?i.innerHeight():i[0].offsetHeight)-a-r};return R()?s["-moz-transform"]=s.transform="translate("+o.left+"px,"+o.top+"px)":(s.left=o.left,s.top=o.top),s}}});var Z="iframe",q="//about:blank",D=function(e){if(t.currTemplate[Z]){var n=t.currTemplate[Z].find("iframe");n.length&&(e||(n[0].src=q),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(Z,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',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"},dailymotion:{index:'dailymotion.com',id:function(url){var m=url.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);if(m!==null){if(m[4]!==undefined){return m[4];}return m[2];}return null;},src:'http://www.dailymotion.com/embed/video/%id%'},funnyordie:{index:'funnyordie.com',id:function(url){var m=url.match(/^.+funnyordie.com\/videos\/(.*?)\//);if(m!==null){if(m[1]!==undefined){return m[1];}}return null;},src:'http://www.funnyordie.com/embed/%id%'},bliptv:{index:'blip.tv',id:function(url){var purl=document.createElement('a');purl.href=url;return purl.pathname.trim();},src:'http://www.blip.tv/play%id%/'}}},proto:{initIframe:function(){t.types.push(Z),x("BeforeChange",function(e,t,n){t!==n&&(t===Z?D():n===Z&&D(!0))}),x(l+"."+Z,function(){D()})},getIframe:function(n,i){var o=n.src,r=t.st.iframe;e.each(r.patterns,function(){return o.indexOf(this.index)>-1?(this.id&&(o="string"==typeof this.id?o.substr(o.lastIndexOf(this.id)+this.id.length,o.length):this.id.call(this,o)),o=this.src.replace("%id%",o),!1):void 0});var a={};return r.srcAction&&(a[r.srcAction]=o),t._parseMarkup(i,a,n),t.updateStatus("ready"),i}}});var K=function(e){var n=t.items.length;return e>n-1?e-n:0>e?n+e:e},Y=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',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 n=t.st.gallery,i=".mfp-gallery",r=Boolean(e.fn.mfpFastClick);return t.direction=!0,n&&n.enabled?(a+=" mfp-gallery",x(f+i,function(){n.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),o.on("keydown"+i,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+i,function(e,n){n.text&&(n.text=Y(n.text,t.currItem.index,t.items.length))}),x(p+i,function(e,i,o,r){var a=t.items.length;o.counter=a>1?Y(n.tCounter,r.index,a):""}),x("BuildControls"+i,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var i=n.arrowMarkup,o=t.arrowLeft=e(i.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(i.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=r?"mfpFastClick":"click";o[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(k("b",o[0],!1,!0),k("a",o[0],!1,!0),k("b",a[0],!1,!0),k("a",a[0],!1,!0)),t.container.append(o.add(a))}}),x(m+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),x(l+i,function(){o.off(i),t.wrap.off("click"+i),t.arrowLeft&&r&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=K(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=K(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,i=Math.min(n[0],t.items.length),o=Math.min(n[1],t.items.length);for(e=1;(t.direction?o:i)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?i:o)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=K(n),!t.items[n].preloaded){var i=t.items[n];i.parsed||(i=t.parseEl(n)),T("LazyLoad",i),"image"===i.type&&(i.img=e('<img class="mfp-img" />').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var U="retina";e.magnificPopup.registerModule(U,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(x("ImageHasSize."+U,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),x("ElementParse."+U,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){I.off("touchmove"+r+" touchend"+r)},o="mfpFastClick",r="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var a,s=e(this);if(n){var l,c,d,u,p,f;s.on("touchstart"+r,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+r,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,i())}).on("touchend"+r,function(e){i(),u||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),o())})})}s.on("click"+r,function(){a||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),n&&I.off("touchmove"+r+" touchend"+r)}}(),_()})(window.jQuery||window.Zepto);