");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'
The content could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}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 c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{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(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,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=b.st.gallery,e=".mfp-gallery";return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s);e.click(function(){b.prev()}),f.click(function(){b.next()}),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('
').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{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=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),A()});
/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */
(function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d
i||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;xMath.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(se.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)});
(function($){jQuery.fn.closest_descendent=function(selector){var $found,$current_children=this.children();while($current_children.length){$found=$current_children.filter(selector);if($found.length){break}
$current_children=$current_children.children()}
return $found}}(jQuery));
(function($){jQuery.fn.reverse=[].reverse}(jQuery));
(function($){$.tm_pb_simple_carousel=function(el,options){var settings=$.extend({slide_duration:500,},options);var $tm_carousel=$(el),$carousel_items=$tm_carousel.find('.tm_pb_carousel_items'),$the_carousel_items=$carousel_items.find('.tm_pb_carousel_item');$tm_carousel.tm_animation_running=!1;$tm_carousel.addClass('container-width-change-notify').on('containerWidthChanged',function(event){set_carousel_columns($tm_carousel);set_carousel_height($tm_carousel)});$carousel_items.data('items',$the_carousel_items.toArray());$tm_carousel.data('columns_setting_up',!1);$carousel_items.prepend('');set_carousel_columns($tm_carousel);set_carousel_height($tm_carousel);$tm_carousel_next=$tm_carousel.find('.tm-pb-arrow-next');$tm_carousel_prev=$tm_carousel.find('.tm-pb-arrow-prev');$tm_carousel_next.click(function(){if($tm_carousel.tm_animation_running)return!1;$tm_carousel.tm_carousel_move_to('next');return!1});$tm_carousel_prev.click(function(){if($tm_carousel.tm_animation_running)return!1;$tm_carousel.tm_carousel_move_to('previous');return!1});$tm_carousel.on('swipeleft',function(){$tm_carousel.tm_carousel_move_to('next')});$tm_carousel.on('swiperight',function(){$tm_carousel.tm_carousel_move_to('previous')});function set_carousel_height($the_carousel){var carousel_items_width=$the_carousel_items.width(),carousel_items_height=$the_carousel_items.height();$carousel_items.css('height',carousel_items_height+'px')}
function set_carousel_columns($the_carousel){var columns,$carousel_parent=$the_carousel.parents('.tm_pb_column'),carousel_items_width=$carousel_items.width(),carousel_item_count=$the_carousel_items.length;if($carousel_parent.hasClass('tm_pb_column_4_4')||$carousel_parent.hasClass('tm_pb_column_3_4')||$carousel_parent.hasClass('tm_pb_column_2_3')){if($tm_window.width()<768){columns=3}else{columns=4}}else if($carousel_parent.hasClass('tm_pb_column_1_2')||$carousel_parent.hasClass('tm_pb_column_3_8')||$carousel_parent.hasClass('tm_pb_column_1_3')){columns=3}else if($carousel_parent.hasClass('tm_pb_column_1_4')){if($tm_window.width()>480&&$tm_window.width()<980){columns=3}else{columns=2}}
if(columns===$carousel_items.data('portfolio-columns')){return}
if($the_carousel.data('columns_setting_up')){return}
$the_carousel.data('columns_setting_up',!0);$carousel_items.removeClass('columns-'+$carousel_items.data('portfolio-columns'));$carousel_items.addClass('columns-'+columns);$carousel_items.data('portfolio-columns',columns);if($carousel_items.find('.tm-carousel-group').length){$the_carousel_items.appendTo($carousel_items);$carousel_items.find('.tm-carousel-group').remove()}
var the_carousel_items=$carousel_items.data('items'),$carousel_group=$('').appendTo($carousel_items);$the_carousel_items.data('position','');if(the_carousel_items.length<=columns){$carousel_items.find('.tm-pb-slider-arrows').hide()}else{$carousel_items.find('.tm-pb-slider-arrows').show()}
for(position=1,x=0;x
').insertAfter($active_carousel_group);$next_carousel_group.css({'width':$active_carousel_group.innerWidth()}).show();for(x=0,total=0;;x++,total++){if(total>=active_items_start&&total=next_items_start&&totalcolumns){break}
if(x>=(items.length-1)){x=-1}}
var sorted=$carousel_items.find('.container_append, .delayed_container_append_dup').sort(function(a,b){var el_a_position=parseInt($(a).data('next_position'));var el_b_position=parseInt($(b).data('next_position'));return(el_a_positionel_b_position)?1:0});$(sorted).show().appendTo($next_carousel_group);var left=0;$next_carousel_group.children().each(function(){$(this).css({'position':'absolute','left':left});left=left+$(this).outerWidth(!0)});$active_carousel_group.animate({left:'-100%'},{duration:settings.slide_duration,complete:function(){$carousel_items.find('.delayed_container_append').each(function(){left=$('#'+$(this).attr('id')+'-dup').css('left');$(this).css({'position':'absolute','left':left});$(this).appendTo($next_carousel_group)});$active_carousel_group.removeClass('active');$active_carousel_group.children().each(function(){position=$(this).data('position');current_position=$(this).data('current_position');$(this).removeClass('position_'+position+' '+'changing_position current_position current_position_'+current_position);$(this).data('position','');$(this).data('current_position','');$(this).hide();$(this).css({'position':'','left':''});$(this).appendTo($carousel_items)});$active_carousel_group.remove()}});next_left=$active_carousel_group.width()+parseInt($the_carousel_items.first().css('marginRight').slice(0,-2));$next_carousel_group.addClass('active').css({'position':'absolute','top':0,left:next_left});$next_carousel_group.animate({left:'0%'},{duration:settings.slide_duration,complete:function(){$next_carousel_group.removeClass('next').addClass('active').css({'position':'','width':'','top':'','left':''});$next_carousel_group.find('.changing_position').each(function(index){position=$(this).data('position');current_position=$(this).data('current_position');next_position=$(this).data('next_position');$(this).removeClass('container_append delayed_container_append position_'+position+' '+'changing_position current_position current_position_'+current_position+' next_position next_position_'+next_position);$(this).data('current_position','');$(this).data('next_position','');$(this).data('position',(index+1))});$next_carousel_group.children().css({'position':'','left':''});$next_carousel_group.find('.delayed_container_append_dup').remove();$tm_carousel.tm_animation_running=!1}})}else if(direction=='previous'){var $prev_carousel_group,current_position=columns,prev_position=columns,columns_span=columns-1,active_items_start=items.indexOf($active_carousel_group.children().last()[0]),active_items_end=active_items_start-columns_span,prev_items_start=active_items_end-1,prev_items_end=prev_items_start-columns_span;$prev_carousel_group=$('').insertBefore($active_carousel_group);$prev_carousel_group.css({'left':'-'+$active_carousel_group.innerWidth(),'width':$active_carousel_group.innerWidth()}).show();for(x=(items.length-1),total=(items.length-1);;x--,total--){if(total<=active_items_start&&total>=active_items_end){$(items[x]).addClass('changing_position current_position current_position_'+current_position);$(items[x]).data('current_position',current_position);current_position--}
if(total<=prev_items_start&&total>=prev_items_end){$(items[x]).data('prev_position',prev_position);$(items[x]).addClass('changing_position prev_position prev_position_'+prev_position);if(!$(items[x]).hasClass('current_position')){$(items[x]).addClass('container_append')}else{$(items[x]).clone(!0).appendTo($active_carousel_group).addClass('delayed_container_append_dup').attr('id',$(items[x]).attr('id')+'-dup');$(items[x]).addClass('delayed_container_append')}
prev_position--}
if(prev_position<=0){break}
if(x==0){x=items.length}}
var sorted=$carousel_items.find('.container_append, .delayed_container_append_dup').sort(function(a,b){var el_a_position=parseInt($(a).data('prev_position'));var el_b_position=parseInt($(b).data('prev_position'));return(el_a_position
el_b_position)?1:0});$(sorted).show().appendTo($prev_carousel_group);var left=0;$prev_carousel_group.children().each(function(){$(this).css({'position':'absolute','left':left});left=left+$(this).outerWidth(!0)});$active_carousel_group.animate({left:'100%'},{duration:settings.slide_duration,complete:function(){$carousel_items.find('.delayed_container_append').reverse().each(function(){left=$('#'+$(this).attr('id')+'-dup').css('left');$(this).css({'position':'absolute','left':left});$(this).prependTo($prev_carousel_group)});$active_carousel_group.removeClass('active');$active_carousel_group.children().each(function(){position=$(this).data('position');current_position=$(this).data('current_position');$(this).removeClass('position_'+position+' '+'changing_position current_position current_position_'+current_position);$(this).data('position','');$(this).data('current_position','');$(this).hide();$(this).css({'position':'','left':''});$(this).appendTo($carousel_items)});$active_carousel_group.remove()}});prev_left=(-1)*$active_carousel_group.width()-parseInt($the_carousel_items.first().css('marginRight').slice(0,-2));$prev_carousel_group.addClass('active').css({'position':'absolute','top':0,left:prev_left});$prev_carousel_group.animate({left:'0%'},{duration:settings.slide_duration,complete:function(){$prev_carousel_group.removeClass('prev').addClass('active').css({'position':'','width':'','top':'','left':''});$prev_carousel_group.find('.delayed_container_append_dup').remove();$prev_carousel_group.find('.changing_position').each(function(index){position=$(this).data('position');current_position=$(this).data('current_position');prev_position=$(this).data('prev_position');$(this).removeClass('container_append delayed_container_append position_'+position+' '+'changing_position current_position current_position_'+current_position+' prev_position prev_position_'+prev_position);$(this).data('current_position','');$(this).data('prev_position','');position=index+1;$(this).data('position',position);$(this).addClass('position_'+position)});$prev_carousel_group.children().css({'position':'','left':''});$tm_carousel.tm_animation_running=!1}})}}}
$.fn.tm_pb_simple_carousel=function(options){return this.each(function(){new $.tm_pb_simple_carousel(this,options)})}}(jQuery));
(function($){$.tm_pb_simple_slider=function(el,options){var settings=$.extend({slide:'.tm-slide',arrows:'.tm-pb-slider-arrows',prev_arrow:'.tm-pb-arrow-prev',next_arrow:'.tm-pb-arrow-next',controls:'.tm-pb-controllers a',carousel_controls:'.tm_pb_carousel_item',control_active_class:'tm-pb-active-control',previous_text:tm_pb_custom.previous,next_text:tm_pb_custom.next,fade_speed:500,use_arrows:!0,use_controls:!0,manual_arrows:'',append_controls_to:'',controls_below:!1,controls_class:'tm-pb-controllers',slideshow:!1,slideshow_speed:7000,show_progress_bar:!1,tabs_animation:!1,use_carousel:!1},options);var $tm_slider=$(el),$tm_slide=$tm_slider.closest_descendent(settings.slide),tm_slides_number=$tm_slide.length,tm_fade_speed=settings.fade_speed,tm_active_slide=0,$tm_slider_arrows,$tm_slider_prev,$tm_slider_next,$tm_slider_controls,$tm_slider_carousel_controls,tm_slider_timer,controls_html='',carousel_html='',$progress_bar=null,progress_timer_count=0,$tm_pb_container=$tm_slider.find('.tm_pb_container'),tm_pb_container_width=$tm_pb_container.width(),is_post_slider=$tm_slider.hasClass('tm_pb_post_slider');$tm_slider.tm_animation_running=!1;$.data(el,"tm_pb_simple_slider",$tm_slider);$tm_slide.eq(0).addClass('tm-pb-active-slide');if(!settings.tabs_animation){if(!$tm_slider.hasClass('tm_pb_bg_layout_dark')&&!$tm_slider.hasClass('tm_pb_bg_layout_light')){$tm_slider.addClass(tm_get_bg_layout_color($tm_slide.eq(0)))}}
if(settings.use_arrows&&tm_slides_number>1){if(settings.manual_arrows=='')
$tm_slider.append('');else $tm_slider.append(settings.manual_arrows);$tm_slider_arrows=$tm_slider.find(settings.arrows);$tm_slider_prev=$tm_slider.find(settings.prev_arrow);$tm_slider_next=$tm_slider.find(settings.next_arrow);$tm_slider_next.click(function(){if($tm_slider.tm_animation_running)return!1;$tm_slider.tm_slider_move_to('next');return!1});$tm_slider_prev.click(function(){if($tm_slider.tm_animation_running)return!1;$tm_slider.tm_slider_move_to('previous');return!1});$tm_slider.find(settings.slide).on('swipeleft',function(){$tm_slider.tm_slider_move_to('next')});$tm_slider.find(settings.slide).on('swiperight',function(){$tm_slider.tm_slider_move_to('previous')})}
if(settings.use_controls&&tm_slides_number>1){for(var i=1;i<=tm_slides_number;i++){controls_html+=''+i+' '}
controls_html=''+controls_html+'
';if(settings.append_controls_to=='')
$tm_slider.append(controls_html);else $(settings.append_controls_to).append(controls_html);if(settings.controls_below)
$tm_slider_controls=$tm_slider.parent().find(settings.controls);else $tm_slider_controls=$tm_slider.find(settings.controls);tm_maybe_set_controls_color($tm_slide.eq(0));$tm_slider_controls.click(function(){if($tm_slider.tm_animation_running)return!1;$tm_slider.tm_slider_move_to($(this).index());return!1})}
if(settings.use_carousel&&tm_slides_number>1){for(var i=1;i<=tm_slides_number;i++){slide_id=i-1;image_src=($tm_slide.eq(slide_id).data('image')!==undefined)?'url('+$tm_slide.eq(slide_id).data('image')+')':'none';carousel_html+=''}
carousel_html='';$tm_slider.after(carousel_html);$tm_slider_carousel_controls=$tm_slider.siblings('.tm_pb_carousel').find(settings.carousel_controls);$tm_slider_carousel_controls.click(function(){if($tm_slider.tm_animation_running)return!1;var $this=$(this);$tm_slider.tm_slider_move_to($this.data('slide-id'));return!1})}
if(settings.slideshow&&tm_slides_number>1){$tm_slider.hover(function(){if($tm_slider.hasClass('tm_slider_auto_ignore_hover')){return}
$tm_slider.addClass('tm_slider_hovered');if(typeof tm_slider_timer!='undefined'){clearInterval(tm_slider_timer)}},function(){if($tm_slider.hasClass('tm_slider_auto_ignore_hover')){return}
$tm_slider.removeClass('tm_slider_hovered');tm_slider_auto_rotate()})}
tm_slider_auto_rotate();function tm_slider_auto_rotate(){if(settings.slideshow&&tm_slides_number>1&&!$tm_slider.hasClass('tm_slider_hovered')){tm_slider_timer=setTimeout(function(){$tm_slider.tm_slider_move_to('next')},settings.slideshow_speed)}}
function tm_stop_video(active_slide){var $tm_video,tm_video_src;if(active_slide.has('iframe').length){$tm_video=active_slide.find('iframe');tm_video_src=$tm_video.attr('src');$tm_video.attr('src','');$tm_video.attr('src',tm_video_src)}else if(active_slide.has('video').length){if(!active_slide.find('.tm_pb_section_video_bg').length){$tm_video=active_slide.find('video');$tm_video[0].pause()}}}
function tm_fix_slider_content_images(){var $this_slider=$tm_slider,$slide_image_container=$this_slider.find('.tm-pb-active-slide .tm_pb_slide_image');$slide_video_container=$this_slider.find('.tm-pb-active-slide .tm_pb_slide_video');$slide=$slide_image_container.closest('.tm_pb_slide'),$slider=$slide.closest('.tm_pb_slider'),slide_height=$slider.innerHeight(),image_height=parseInt(slide_height*0.8),$top_header=$('#top-header'),$main_header=$('#main-header'),$tm_transparent_nav=$('.tm_transparent_nav'),$tm_vertical_nav=$('.tm_vertical_nav');$slide_image_container.find('img').css('maxHeight',image_height+'px');if($slide.hasClass('tm_pb_media_alignment_center')){$slide_image_container.css('marginTop','-'+parseInt($slide_image_container.height()/2)+'px')}
$slide_video_container.css('marginTop','-'+parseInt($slide_video_container.height()/2)+'px');$slide_image_container.find('img').addClass('active')}
function tm_get_bg_layout_color($slide){if($slide.hasClass('tm_pb_bg_layout_dark')){return'tm_pb_bg_layout_dark'}
return'tm_pb_bg_layout_light'}
function tm_maybe_set_controls_color($slide){var next_slide_dot_color,$arrows,arrows_color;if(typeof $tm_slider_controls!=='undefined'&&$tm_slider_controls.length){next_slide_dot_color=$slide.data('dots_color')||'';if(next_slide_dot_color!==''){$tm_slider_controls.attr('style','background-color: '+hex_to_rgba(next_slide_dot_color,'0.3')+';')
$tm_slider_controls.filter('.tm-pb-active-control').attr('style','background-color: '+hex_to_rgba(next_slide_dot_color)+'!important;')}else{$tm_slider_controls.removeAttr('style')}}
if(typeof $tm_slider_arrows!=='undefined'&&$tm_slider_arrows.length){$arrows=$tm_slider_arrows.find('a');arrows_color=$slide.data('arrows_color')||'';if(arrows_color!==''){$arrows.css('color',arrows_color)}else{$arrows.css('color','inherit')}}}
function tm_fix_builder_content(){if(is_post_slider){setTimeout(function(){var $tm_pb_circle_counter=$('.tm_pb_circle_counter'),$tm_pb_number_counter=$('.tm_pb_number_counter');window.tm_fix_testimonial_inner_width();if($tm_pb_circle_counter.length){window.tm_pb_reinit_circle_counters($tm_pb_circle_counter)}
if($tm_pb_number_counter.length){window.tm_pb_reinit_number_counters($tm_pb_number_counter)}
window.tm_reinint_waypoint_modules()},1000)}}
function hex_to_rgba(color,alpha){var color_16=parseInt(color.replace('#',''),16),red=(color_16>>16)&255,green=(color_16>>8)&255,blue=color_16&255,alpha=alpha||1,rgba;rgba=red+','+green+','+blue+','+alpha;rgba='rgba('+rgba+')';return rgba}
$tm_window.load(function(){tm_fix_slider_content_images()});$tm_window.resize(function(){tm_fix_slider_content_images()});$tm_slider.tm_slider_move_to=function(direction){var $active_slide=$tm_slide.eq(tm_active_slide),$next_slide;$tm_slider.tm_animation_running=!0;$tm_slider.removeClass('tm_slide_transition_to_next tm_slide_transition_to_previous').addClass('tm_slide_transition_to_'+direction);$tm_slider.find('.tm-pb-moved-slide').removeClass('tm-pb-moved-slide');if(direction=='next'||direction=='previous'){if(direction=='next')
tm_active_slide=(tm_active_slide+1)=0?tm_active_slide-1:tm_slides_number-1}else{if(tm_active_slide==direction){$tm_slider.tm_animation_running=!1;return}
tm_active_slide=direction}
if(typeof tm_slider_timer!='undefined')
clearInterval(tm_slider_timer);$next_slide=$tm_slide.eq(tm_active_slide);$tm_slider.trigger('simple_slider_before_move_to',{direction:direction,next_slide:$next_slide});$tm_slide.each(function(){$(this).css('zIndex',1)});$active_slide.css('zIndex',2).removeClass('tm-pb-active-slide').addClass('tm-pb-moved-slide');$next_slide.css({'display':'block',opacity:0}).addClass('tm-pb-active-slide');tm_fix_slider_content_images();tm_fix_builder_content();if(settings.use_controls)
$tm_slider_controls.removeClass(settings.control_active_class).eq(tm_active_slide).addClass(settings.control_active_class);if(settings.use_carousel)
$tm_slider_carousel_controls.removeClass(settings.control_active_class).eq(tm_active_slide).addClass(settings.control_active_class);if(!settings.tabs_animation){tm_maybe_set_controls_color($next_slide);$next_slide.animate({opacity:1},tm_fade_speed);$active_slide.addClass('tm_slide_transition').css({'display':'list-item','opacity':1}).animate({opacity:0},tm_fade_speed,function(){var active_slide_layout_bg_color=tm_get_bg_layout_color($active_slide),next_slide_layout_bg_color=tm_get_bg_layout_color($next_slide);$(this).css('display','none').removeClass('tm_slide_transition');tm_stop_video($active_slide);$tm_slider.removeClass(active_slide_layout_bg_color).addClass(next_slide_layout_bg_color);$tm_slider.tm_animation_running=!1;$tm_slider.trigger('simple_slider_after_move_to',{next_slide:$next_slide})})}else{$next_slide.css({'display':'none',opacity:0});$active_slide.addClass('tm_slide_transition').css({'display':'block','opacity':1}).animate({opacity:0},tm_fade_speed,function(){$(this).css('display','none').removeClass('tm_slide_transition');$next_slide.css({'display':'block','opacity':0}).animate({opacity:1},tm_fade_speed,function(){$tm_slider.tm_animation_running=!1;$tm_slider.trigger('simple_slider_after_move_to',{next_slide:$next_slide})})})}
tm_slider_auto_rotate()}}
$.fn.tm_pb_simple_slider=function(options){return this.each(function(){new $.tm_pb_simple_slider(this,options)})}}(jQuery));
/**!
* easyPieChart
* Lightweight plugin to render simple, animated and retina optimized pie charts
*
* @license
* @author Robert Fleischmann (http://robert-fleischmann.de)
* @version 2.1.5
**/
(function(root,factory){if(typeof exports==='object'){module.exports=factory(require('jquery'))}else if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else{factory(root.jQuery)}}(this,function($){var CanvasRenderer=function(el,options){var cachedBackground;var canvas=document.createElement('canvas');el.appendChild(canvas);if(typeof(G_vmlCanvasManager)!=='undefined'){G_vmlCanvasManager.initElement(canvas)}
var ctx=canvas.getContext('2d');canvas.width=canvas.height=options.size;var scaleBy=1;if(window.devicePixelRatio>1){scaleBy=window.devicePixelRatio;canvas.style.width=canvas.style.height=[options.size,'px'].join('');canvas.width=canvas.height=options.size*scaleBy;ctx.scale(scaleBy,scaleBy)}
ctx.translate(options.size/2,options.size/2);ctx.rotate((-1/2+options.rotate/180)*Math.PI);var radius=(options.size-options.lineWidth)/2;if(options.scaleColor&&options.scaleLength){radius-=options.scaleLength+2}
Date.now=Date.now||function(){return+(new Date())};var drawCircle=function(color,lineWidth,percent,alpha){percent=Math.min(Math.max(-1,percent||0),1);var isNegative=percent<=0?!0:!1;ctx.beginPath();ctx.arc(0,0,radius,0,Math.PI*2*percent,isNegative);ctx.strokeStyle=color;ctx.globalAlpha=alpha;ctx.lineWidth=lineWidth;ctx.stroke()};var drawScale=function(){var offset;var length;ctx.lineWidth=1;ctx.fillStyle=options.scaleColor;ctx.save();for(var i=24;i>0;--i){if(i%6===0){length=options.scaleLength;offset=0}else{length=options.scaleLength*0.6;offset=options.scaleLength-length}
ctx.fillRect(-options.size/2+offset,0,length,1);ctx.rotate(Math.PI/12)}
ctx.restore()};var reqAnimationFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(callback){window.setTimeout(callback,1000/60)}}());var drawBackground=function(){if(options.scaleColor)drawScale();if(options.trackColor)drawCircle(options.trackColor,options.lineWidth,1,options.trackAlpha)};this.getCanvas=function(){return canvas};this.getCtx=function(){return ctx};this.clear=function(){ctx.clearRect(options.size/-2,options.size/-2,options.size,options.size)};this.draw=function(percent){if(!!options.scaleColor||!!options.trackColor){if(ctx.getImageData&&ctx.putImageData){if(!cachedBackground){drawBackground();cachedBackground=ctx.getImageData(0,0,options.size*scaleBy,options.size*scaleBy)}else{ctx.putImageData(cachedBackground,0,0)}}else{this.clear();drawBackground()}}else{this.clear()}
ctx.lineCap=options.lineCap;var color;if(typeof(options.barColor)==='function'){color=options.barColor(percent)}else{color=options.barColor}
drawCircle(color,options.lineWidth,percent/100,options.barAlpha)}.bind(this);this.animate=function(from,to){var startTime=Date.now();options.onStart(from,to);var animation=function(){var process=Math.min(Date.now()-startTime,options.animate.duration);var currentValue=options.easing(this,process,from,to-from,options.animate.duration);this.draw(currentValue);options.onStep(from,to,currentValue);if(process>=options.animate.duration){options.onStop(from,to)}else{reqAnimationFrame(animation)}}.bind(this);reqAnimationFrame(animation)}.bind(this)};var EasyPieChart=function(el,opts){var defaultOptions={barColor:'#ef1e25',barAlpha:1.0,trackColor:'#f9f9f9',trackAlpha:1.0,scaleColor:'#dfe0e0',scaleLength:5,lineCap:'round',lineWidth:3,size:110,rotate:0,render:!0,animate:{duration:1000,enabled:!0},easing:function(x,t,b,c,d){t=t/(d/2);if(t<1){return c/2*t*t+b}
return-c/2*((--t)*(t-2)-1)+b},onStart:function(from,to){return},onStep:function(from,to,currentValue){return},onStop:function(from,to){return}};if(typeof(CanvasRenderer)!=='undefined'){defaultOptions.renderer=CanvasRenderer}else if(typeof(SVGRenderer)!=='undefined'){defaultOptions.renderer=SVGRenderer}else{throw new Error('Please load either the SVG- or the CanvasRenderer')}
var options={};var currentValue=0;var init=function(){this.el=el;this.options=options;for(var i in defaultOptions){if(defaultOptions.hasOwnProperty(i)){options[i]=opts&&typeof(opts[i])!=='undefined'?opts[i]:defaultOptions[i];if(typeof(options[i])==='function'){options[i]=options[i].bind(this)}}}
if(typeof(options.easing)==='string'&&typeof(jQuery)!=='undefined'&&jQuery.isFunction(jQuery.easing[options.easing])){options.easing=jQuery.easing[options.easing]}else{options.easing=defaultOptions.easing}
if(typeof(options.animate)==='number'){options.animate={duration:options.animate,enabled:!0}}
if(typeof(options.animate)==='boolean'&&!options.animate){options.animate={duration:1000,enabled:options.animate}}
this.renderer=new options.renderer(el,options);this.renderer.draw(currentValue);if(el.dataset&&el.dataset.percent){this.update(parseFloat(el.dataset.percent))}else if(el.getAttribute&&el.getAttribute('data-percent')){this.update(parseFloat(el.getAttribute('data-percent')))}}.bind(this);this.update=function(newValue){newValue=parseFloat(newValue);if(options.animate.enabled){this.renderer.animate(currentValue,newValue)}else{this.renderer.draw(newValue)}
currentValue=newValue;return this}.bind(this);this.disableAnimation=function(){options.animate.enabled=!1;return this};this.enableAnimation=function(){options.animate.enabled=!0;return this};init()};$.fn.easyPieChart=function(options){return this.each(function(){var instanceOptions;if(!$.data(this,'easyPieChart')){instanceOptions=$.extend({},options,$(this).data());$.data(this,'easyPieChart',new EasyPieChart(this,instanceOptions))}})}}));
var tm_hash_module_seperator='||',tm_hash_module_param_seperator='|';function process_tm_hashchange(hash){if((hash.indexOf(tm_hash_module_seperator,0))!==-1){modules=hash.split(tm_hash_module_seperator);for(var i=0;i
';$item.on('click','.tm_pb_ajax_more',function(event){var $this=$(this),$result=$item.find('.tm-posts_listing .row'),pages=$item.data('pages'),data=new Object();event.preventDefault();if($this.hasClass('in-progress')){return}
data.page=$item.data('page');data.atts=$item.data('atts');data.action='tm_pb_load_more';$this.addClass('in-progress').after(loader);$.ajax({url:window.tm_pb_custom.ajaxurl,type:'post',dataType:'json',data:data,error:function(){$this.removeClass('in-progress').next('.tm-pb-spinner').remove()}}).done(function(response){$result.append(response.data.result);$item.data('page',response.data.page);$this.removeClass('in-progress').next('.tm-pb-spinner').remove();if(response.data.page==pages){$this.addClass('btn-hidden')}})})});if($('.tm_pb_row').length){$('.tm_pb_row').each(function(){var $this_row=$(this),row_class='';row_class=tm_get_column_types($this_row.find('>.tm_pb_column'));if(''!==row_class&&(-1!==row_class.indexOf('1-4')||'_4col'===row_class)){$this_row.addClass('tm_pb_row'+row_class)}
if($this_row.find('.tm_pb_row_inner').length){$this_row.find('.tm_pb_row_inner').each(function(){var $this_row_inner=$(this);row_class=tm_get_column_types($this_row_inner.find('.tm_pb_column'));if(''!==row_class&&-1!==row_class.indexOf('1-4')){$this_row_inner.addClass('tm_pb_row'+row_class)}})}})}
function tm_get_column_types($columns){var row_class='';if($columns.length){$columns.each(function(){var $this_column=$(this),column_type=$this_column.attr('class').split('tm_pb_column_')[1],column_type_clean=column_type.split(' ',1)[0],column_type_updated=column_type_clean.replace('_','-').trim();row_class+='_'+column_type_updated});row_class='_1-4_1-4_1-4_1-4'===row_class?'_4col':row_class}
return row_class}
$tm_top_menu.find('li').hover(function(){if(!$(this).closest('li.mega-menu').length||$(this).hasClass('mega-menu')){$(this).addClass('tm-show-dropdown');$(this).removeClass('tm-hover').addClass('tm-hover')}},function(){var $this_el=$(this);$this_el.removeClass('tm-show-dropdown');setTimeout(function(){if(!$this_el.hasClass('tm-show-dropdown')){$this_el.removeClass('tm-hover')}},200)});$tm_top_menu.find('.menu-item-has-children > a').on('touchstart',function(){tm_parent_menu_longpress_start=new Date().getTime()}).on('touchend',function(){var tm_parent_menu_longpress_end=new Date().getTime()
if(tm_parent_menu_longpress_end>=tm_parent_menu_longpress_start+tm_parent_menu_longpress_limit){tm_parent_menu_click=!0}else{tm_parent_menu_click=!1;var $tm_parent_menu=$(this).parent('li');if($tm_parent_menu.hasClass('tm-hover')){$tm_parent_menu.trigger('mouseleave')}else{$tm_parent_menu.trigger('mouseenter')}}
tm_parent_menu_longpress_start=0}).click(function(){if(tm_parent_menu_click){return!0}
return!1});$tm_top_menu.find('li.mega-menu').each(function(){var $li_mega_menu=$(this),$li_mega_menu_item=$li_mega_menu.children('ul').children('li'),li_mega_menu_item_count=$li_mega_menu_item.length;if(li_mega_menu_item_count<4){$li_mega_menu.addClass('mega-menu-parent mega-menu-parent-'+li_mega_menu_item_count)}});$tm_sticky_image.each(function(){var $this_el=$(this),$row=$this_el.closest('.tm_pb_row'),$section=$row.closest('.tm_pb_section'),$column=$this_el.closest('.tm_pb_column'),sticky_class='tm_pb_section_sticky',sticky_mobile_class='tm_pb_section_sticky_mobile';if(!$row.is(':last-child')){return!0}
if(!$this_el.is(':last-child')){return!0}
if(!$section.hasClass(sticky_class)){$section.addClass(sticky_class)}
$column.addClass('tm_pb_row_sticky');if(!$section.hasClass(sticky_mobile_class)&&$column.is(':last-child')){$section.addClass(sticky_mobile_class)}});if(tm_is_mobile_device){$('.tm_pb_section_video_bg').each(function(){var $this_el=$(this);$this_el.css('visibility','hidden').closest('.tm_pb_preload').removeClass('tm_pb_preload')});$('body').addClass('tm_mobile_device');if(!tm_is_ipad){$('body').addClass('tm_mobile_device_not_ipad')}}
if($tm_pb_video_section.length){$tm_pb_video_section.find('video').mediaelementplayer({pauseOtherPlayers:!1,success:function(mediaElement,domObject){mediaElement.addEventListener('loadeddata',function(){tm_pb_resize_section_video_bg($(domObject));tm_pb_center_video($(domObject))},!1);mediaElement.addEventListener('canplay',function(){$(domObject).closest('.tm_pb_preload').removeClass('tm_pb_preload')},!1)}})}
if($tm_post_gallery.length){var magnificPopup=$.magnificPopup.instance;$('body').on('swiperight','.mfp-container',function(){magnificPopup.prev()});$('body').on('swipeleft','.mfp-container',function(){magnificPopup.next()});$tm_post_gallery.each(function(){$(this).magnificPopup({delegate:'a',type:'image',removalDelay:500,gallery:{enabled:!0,navigateByImgClick:!0},mainClass:'mfp-fade',zoom:{enabled:!0,duration:500,opener:function(element){return element.find('img')}}})});$tm_post_gallery.find('a').unbind('click')}
if($tm_lightbox_image.length){$tm_lightbox_image.unbind('click');$tm_lightbox_image.bind('click');$tm_lightbox_image.magnificPopup({type:'image',removalDelay:500,mainClass:'mfp-fade',zoom:{enabled:!0,duration:500,opener:function(element){return element.find('img')}}})}
if($tm_pb_slider.length){$tm_pb_slider.each(function(){var $this_slider=$(this),tm_slider_settings={fade_speed:700,slide:!$this_slider.hasClass('tm_pb_gallery')?'.tm_pb_slide':'.tm_pb_gallery_item'}
if($this_slider.hasClass('tm_pb_slider_no_arrows'))
tm_slider_settings.use_arrows=!1;if($this_slider.hasClass('tm_pb_slider_no_pagination'))
tm_slider_settings.use_controls=!1;if($this_slider.hasClass('tm_slider_auto')){var tm_slider_autospeed_class_value=/tm_slider_speed_(\d+)/g;tm_slider_settings.slideshow=!0;tm_slider_autospeed=tm_slider_autospeed_class_value.exec($this_slider.attr('class'));tm_slider_settings.slideshow_speed=tm_slider_autospeed[1]}
if($this_slider.parent().hasClass('tm_pb_video_slider')){tm_slider_settings.controls_below=!0;tm_slider_settings.append_controls_to=$this_slider.parent();setTimeout(function(){$('.tm_pb_preload').removeClass('tm_pb_preload')},500)}
if($this_slider.hasClass('tm_pb_slider_carousel'))
tm_slider_settings.use_carousel=!0;$this_slider.tm_pb_simple_slider(tm_slider_settings)})}
$tm_pb_carousel=$('.tm_pb_carousel');if($tm_pb_carousel.length){$tm_pb_carousel.each(function(){var $this_carousel=$(this),tm_carousel_settings={fade_speed:1000};$this_carousel.tm_pb_simple_carousel(tm_carousel_settings)})}
if($tm_pb_fullwidth_portfolio.length){function set_fullwidth_portfolio_columns($the_portfolio,carousel_mode){var columns,$portfolio_items=$the_portfolio.find('.tm_pb_portfolio_items'),portfolio_items_width=$portfolio_items.width(),$the_portfolio_items=$portfolio_items.find('.tm_pb_portfolio_item'),portfolio_item_count=$the_portfolio_items.length;if(portfolio_items_width>=1600){columns=5}else if(portfolio_items_width>=1024){columns=4}else if(portfolio_items_width>=768){columns=3}else if(portfolio_items_width>=480){columns=2}else{columns=1}
portfolio_item_width=portfolio_items_width/columns;portfolio_item_height=portfolio_item_width*.75;if(carousel_mode){$portfolio_items.css({'height':portfolio_item_height})}
$the_portfolio_items.css({'height':portfolio_item_height});if(columns===$portfolio_items.data('portfolio-columns')){return}
if($the_portfolio.data('columns_setting_up')){return}
$the_portfolio.data('columns_setting_up',!0);var portfolio_item_width_percentage=(100/columns)+'%';$the_portfolio_items.css({'width':portfolio_item_width_percentage});$portfolio_items.removeClass('columns-'+$portfolio_items.data('portfolio-columns'));$portfolio_items.addClass('columns-'+columns);$portfolio_items.data('portfolio-columns',columns);if(!carousel_mode){return $the_portfolio.data('columns_setting_up',!1)}
if($portfolio_items.find('.tm_pb_carousel_group').length){$the_portfolio_items.appendTo($portfolio_items);$portfolio_items.find('.tm_pb_carousel_group').remove()}
var the_portfolio_items=$portfolio_items.data('items'),$carousel_group=$('').appendTo($portfolio_items);$the_portfolio_items.data('position','');if(the_portfolio_items.length<=columns){$portfolio_items.find('.tm-pb-slider-arrows').hide()}else{$portfolio_items.find('.tm-pb-slider-arrows').show()}
for(position=1,x=0;x
$carousel.find('.tm_pb_carousel_group .tm_pb_portfolio_item').length&&!$carousel.hasClass('tm_carousel_hovered')){tm_carousel_timer=setTimeout(function(){$carousel.find('.tm-pb-arrow-next').click()},$carousel.data('auto-rotate-speed'));$carousel.data('tm_carousel_timer',tm_carousel_timer)}}
$tm_pb_fullwidth_portfolio.each(function(){var $the_portfolio=$(this),$portfolio_items=$the_portfolio.find('.tm_pb_portfolio_items');$portfolio_items.data('items',$portfolio_items.find('.tm_pb_portfolio_item').toArray());$the_portfolio.data('columns_setting_up',!1);if($the_portfolio.hasClass('tm_pb_fullwidth_portfolio_carousel')){$portfolio_items.prepend('');set_fullwidth_portfolio_columns($the_portfolio,!0);tm_carousel_auto_rotate($the_portfolio);$the_portfolio.on('swiperight',function(){$(this).find('.tm-pb-arrow-prev').click()});$the_portfolio.on('swipeleft',function(){$(this).find('.tm-pb-arrow-next').click()});$the_portfolio.hover(function(){$(this).addClass('tm_carousel_hovered');if(typeof $(this).data('tm_carousel_timer')!='undefined'){clearInterval($(this).data('tm_carousel_timer'))}},function(){$(this).removeClass('tm_carousel_hovered');tm_carousel_auto_rotate($(this))});$the_portfolio.data('carouseling',!1);$the_portfolio.on('click','.tm-pb-slider-arrows a',function(e){var $the_portfolio=$(this).parents('.tm_pb_fullwidth_portfolio'),$portfolio_items=$the_portfolio.find('.tm_pb_portfolio_items'),$the_portfolio_items=$portfolio_items.find('.tm_pb_portfolio_item'),$active_carousel_group=$portfolio_items.find('.tm_pb_carousel_group.active'),slide_duration=700,items=$portfolio_items.data('items'),columns=$portfolio_items.data('portfolio-columns'),item_width=$active_carousel_group.innerWidth()/columns,original_item_width=(100/columns)+'%';e.preventDefault();if($the_portfolio.data('carouseling')){return}
$the_portfolio.data('carouseling',!0);$active_carousel_group.children().each(function(){$(this).css({'width':$(this).innerWidth()+1,'position':'absolute','left':($(this).innerWidth()*($(this).data('position')-1))})});if($(this).hasClass('tm-pb-arrow-next')){var $next_carousel_group,current_position=1,next_position=1,active_items_start=items.indexOf($active_carousel_group.children().first()[0]),active_items_end=active_items_start+columns,next_items_start=active_items_end,next_items_end=next_items_start+columns;$next_carousel_group=$('').insertAfter($active_carousel_group);$next_carousel_group.css({'width':$active_carousel_group.innerWidth()}).show();for(x=0,total=0;;x++,total++){if(total>=active_items_start&&total
=next_items_start&&totalcolumns){break}
if(x>=(items.length-1)){x=-1}}
sorted=$portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function(a,b){var el_a_position=parseInt($(a).data('next_position'));var el_b_position=parseInt($(b).data('next_position'));return(el_a_positionel_b_position)?1:0});$(sorted).show().appendTo($next_carousel_group);$next_carousel_group.children().each(function(){$(this).css({'width':item_width,'position':'absolute','left':(item_width*($(this).data('next_position')-1))})});$active_carousel_group.animate({left:'-100%'},{duration:slide_duration,complete:function(){$portfolio_items.find('.delayed_container_append').each(function(){$(this).css({'width':item_width,'position':'absolute','left':(item_width*($(this).data('next_position')-1))});$(this).appendTo($next_carousel_group)});$active_carousel_group.removeClass('active');$active_carousel_group.children().each(function(){position=$(this).data('position');current_position=$(this).data('current_position');$(this).removeClass('position_'+position+' '+'changing_position current_position current_position_'+current_position);$(this).data('position','');$(this).data('current_position','');$(this).hide();$(this).css({'position':'','width':'','left':''});$(this).appendTo($portfolio_items)});$active_carousel_group.remove();tm_carousel_auto_rotate($the_portfolio)}});$next_carousel_group.addClass('active').css({'position':'absolute','top':0,left:'100%'});$next_carousel_group.animate({left:'0%'},{duration:slide_duration,complete:function(){setTimeout(function(){$next_carousel_group.removeClass('next').addClass('active').css({'position':'','width':'','top':'','left':''});$next_carousel_group.find('.delayed_container_append_dup').remove();$next_carousel_group.find('.changing_position').each(function(index){position=$(this).data('position');current_position=$(this).data('current_position');next_position=$(this).data('next_position');$(this).removeClass('container_append delayed_container_append position_'+position+' '+'changing_position current_position current_position_'+current_position+' next_position next_position_'+next_position);$(this).data('current_position','');$(this).data('next_position','');$(this).data('position',(index+1))});$next_carousel_group.children().css({'position':'','width':original_item_width,'left':''});$the_portfolio.data('carouseling',!1)},100)}})}else{var $prev_carousel_group,current_position=columns,prev_position=columns,columns_span=columns-1,active_items_start=items.indexOf($active_carousel_group.children().last()[0]),active_items_end=active_items_start-columns_span,prev_items_start=active_items_end-1,prev_items_end=prev_items_start-columns_span;$prev_carousel_group=$('').insertBefore($active_carousel_group);$prev_carousel_group.css({'left':'-'+$active_carousel_group.innerWidth(),'width':$active_carousel_group.innerWidth()}).show();for(x=(items.length-1),total=(items.length-1);;x--,total--){if(total<=active_items_start&&total>=active_items_end){$(items[x]).addClass('changing_position current_position current_position_'+current_position);$(items[x]).data('current_position',current_position);current_position--}
if(total<=prev_items_start&&total>=prev_items_end){$(items[x]).data('prev_position',prev_position);$(items[x]).addClass('changing_position prev_position prev_position_'+prev_position);if(!$(items[x]).hasClass('current_position')){$(items[x]).addClass('container_append')}else{$(items[x]).clone(!0).appendTo($active_carousel_group).addClass('delayed_container_append_dup').attr('id',$(items[x]).attr('id')+'-dup');$(items[x]).addClass('delayed_container_append')}
prev_position--}
if(prev_position<=0){break}
if(x==0){x=items.length}}
sorted=$portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function(a,b){var el_a_position=parseInt($(a).data('prev_position'));var el_b_position=parseInt($(b).data('prev_position'));return(el_a_position
el_b_position)?1:0});$(sorted).show().appendTo($prev_carousel_group);$prev_carousel_group.children().each(function(){$(this).css({'width':item_width,'position':'absolute','left':(item_width*($(this).data('prev_position')-1))})});$active_carousel_group.animate({left:'100%'},{duration:slide_duration,complete:function(){$portfolio_items.find('.delayed_container_append').reverse().each(function(){$(this).css({'width':item_width,'position':'absolute','left':(item_width*($(this).data('prev_position')-1))});$(this).prependTo($prev_carousel_group)});$active_carousel_group.removeClass('active');$active_carousel_group.children().each(function(){position=$(this).data('position');current_position=$(this).data('current_position');$(this).removeClass('position_'+position+' '+'changing_position current_position current_position_'+current_position);$(this).data('position','');$(this).data('current_position','');$(this).hide();$(this).css({'position':'','width':'','left':''});$(this).appendTo($portfolio_items)});$active_carousel_group.remove()}});$prev_carousel_group.addClass('active').css({'position':'absolute','top':0,left:'-100%'});$prev_carousel_group.animate({left:'0%'},{duration:slide_duration,complete:function(){setTimeout(function(){$prev_carousel_group.removeClass('prev').addClass('active').css({'position':'','width':'','top':'','left':''});$prev_carousel_group.find('.delayed_container_append_dup').remove();$prev_carousel_group.find('.changing_position').each(function(index){position=$(this).data('position');current_position=$(this).data('current_position');prev_position=$(this).data('prev_position');$(this).removeClass('container_append delayed_container_append position_'+position+' '+'changing_position current_position current_position_'+current_position+' prev_position prev_position_'+prev_position);$(this).data('current_position','');$(this).data('prev_position','');position=index+1;$(this).data('position',position);$(this).addClass('position_'+position)});$prev_carousel_group.children().css({'position':'','width':original_item_width,'left':''});$the_portfolio.data('carouseling',!1)},100)}})}
return!1})}else{set_fullwidth_portfolio_columns($the_portfolio,!1)}})}
function tm_audio_module_set(){if($('.tm_pb_audio_module .mejs-audio').length||$('.tm_audio_content .mejs-audio').length){$('.tm_audio_container').each(function(){var $this_player=$(this),$time_rail=$this_player.find('.mejs-time-rail'),$time_slider=$this_player.find('.mejs-time-slider');$time_rail.removeAttr('style');$time_slider.removeAttr('style');var $count_timer=$this_player.find('div.mejs-currenttime-container'),player_width=$this_player.width(),controls_play_width=$this_player.find('.mejs-play').outerWidth(),time_width=$this_player.find('.mejs-currenttime-container').outerWidth(),volume_icon_width=$this_player.find('.mejs-volume-button').outerWidth(),volume_bar_width=$this_player.find('.mejs-horizontal-volume-slider').outerWidth(),new_time_rail_width;$count_timer.addClass('custom');$this_player.find('.mejs-controls div.mejs-duration-container').replaceWith($count_timer);new_time_rail_width=player_width-(controls_play_width+time_width+volume_icon_width+volume_bar_width+100);if(0 a.active').data('category-slug'),container_width=$the_portfolio.find('.tm_pb_portfolio_items').innerWidth(),item_width=$the_portfolio.find('.tm_pb_portfolio_item').outerWidth(!0),last_item_margin=item_width-$the_portfolio.find('.tm_pb_portfolio_item').outerWidth(),columns_count=Math.round((container_width+last_item_margin)/item_width),counter=1,first_in_row=1;$the_portfolio.find('.tm_pb_portfolio_item').removeClass('last_in_row first_in_row');$the_portfolio.find('.tm_pb_portfolio_item').each(function(){var $this_el=$(this);if(!$this_el.hasClass('inactive')){if(first_in_row===counter){$this_el.addClass('first_in_row')}
if(0===counter%columns_count){$this_el.addClass('last_in_row');first_in_row=counter+1}
counter++}});if('all'===active_category){$the_portfolio_visible_items=$the_portfolio.find('.tm_pb_portfolio_item')}else{$the_portfolio_visible_items=$the_portfolio.find('.tm_pb_portfolio_item.project_category_'+active_category)}
var visible_grid_items=$the_portfolio_visible_items.length,posts_number=$the_portfolio.data('posts-number'),pages=Math.ceil(visible_grid_items/posts_number);set_filterable_grid_pages($the_portfolio,pages);var visible_grid_items=0;var _page=1;$the_portfolio.find('.tm_pb_portfolio_item').data('page','');$the_portfolio_visible_items.each(function(i){visible_grid_items++;if(0===parseInt(visible_grid_items%posts_number)){$(this).data('page',_page);_page++}else{$(this).data('page',_page)}});$the_portfolio_visible_items.filter(function(){return $(this).data('page')==1}).show();$the_portfolio_visible_items.filter(function(){return $(this).data('page')!=1}).hide()}
function set_filterable_grid_pages($the_portfolio,pages){$pagination=$the_portfolio.find('.tm_pb_portofolio_pagination');if(!$pagination.length){return}
$pagination.html('');if(pages<=1){return}
$pagination_list=$pagination.children('ul');$pagination_list.append(''+tm_pb_custom.prev+' ');for(var page=1;page<=pages;page++){var first_page_class=page===1?' active':'',last_page_class=page===pages?' last-page':'',hidden_page_class=page>=5?' style="display:none;"':'';$pagination_list.append(''+page+' ')}
$pagination_list.append(''+tm_pb_custom.next+' ')}
$tm_pb_filterable_portfolio.on('click','.tm_pb_portofolio_pagination a',function(e){e.preventDefault();var to_page=$(this).data('page'),$the_portfolio=$(this).parents('.tm_pb_filterable_portfolio'),$the_portfolio_items=$the_portfolio.find('.tm_pb_portfolio_items');tm_pb_smooth_scroll($the_portfolio,!1,800);if($(this).hasClass('page-prev')){to_page=parseInt($(this).parents('ul').find('a.active').data('page'))-1}else if($(this).hasClass('page-next')){to_page=parseInt($(this).parents('ul').find('a.active').data('page'))+1}
$(this).parents('ul').find('a').removeClass('active');$(this).parents('ul').find('a.page-'+to_page).addClass('active');var current_index=$(this).parents('ul').find('a.page-'+to_page).parent().index(),total_pages=$(this).parents('ul').find('li.page').length;$(this).parent().nextUntil('.page-'+(current_index+3)).show();$(this).parent().prevUntil('.page-'+(current_index-3)).show();$(this).parents('ul').find('li.page').each(function(i){if(!$(this).hasClass('prev')&&!$(this).hasClass('next')){if(i<(current_index-3)){$(this).hide()}else if(i>(current_index+1)){$(this).hide()}else{$(this).show()}
if(total_pages-current_index<=2&&total_pages-i<=5){$(this).show()}else if(current_index<=3&&i<=4){$(this).show()}}});if(to_page>1){$(this).parents('ul').find('li.prev').show()}else{$(this).parents('ul').find('li.prev').hide()}
if($(this).parents('ul').find('a.active').hasClass('last-page')){$(this).parents('ul').find('li.next').hide()}else{$(this).parents('ul').find('li.next').show()}
$the_portfolio.find('.tm_pb_portfolio_item').hide();$the_portfolio.find('.tm_pb_portfolio_item').filter(function(index){return $(this).data('page')===to_page}).show();setTimeout(function(){set_filterable_portfolio_hash($the_portfolio)},500)});function set_filterable_portfolio_hash($the_portfolio){if(!$the_portfolio.attr('id')){return}
var this_portfolio_state=[];this_portfolio_state.push($the_portfolio.attr('id'));this_portfolio_state.push($the_portfolio.find('.tm_pb_portfolio_filter > a.active').data('category-slug'));if($the_portfolio.find('.tm_pb_portofolio_pagination a.active').length){this_portfolio_state.push($the_portfolio.find('.tm_pb_portofolio_pagination a.active').data('page'))}else{this_portfolio_state.push(1)}
this_portfolio_state=this_portfolio_state.join(tm_hash_module_param_seperator);tm_set_hash(this_portfolio_state)}}
if($tm_pb_gallery.length){function set_gallery_grid_items($the_gallery){var $the_gallery_items_container=$the_gallery.find('.tm_pb_gallery_items'),$the_gallery_items=$the_gallery_items_container.find('.tm_pb_gallery_item');var total_grid_items=$the_gallery_items.length,posts_number=$the_gallery_items_container.data('per_page'),pages=Math.ceil(total_grid_items/posts_number);set_gallery_grid_pages($the_gallery,pages);var total_grid_items=0;var _page=1;$the_gallery_items.data('page','');$the_gallery_items.each(function(i){total_grid_items++;if(0===parseInt(total_grid_items%posts_number)){$(this).data('page',_page);_page++}else{$(this).data('page',_page)}});var visible_items=$the_gallery_items.filter(function(){return $(this).data('page')==1}).show();$the_gallery_items.filter(function(){return $(this).data('page')!=1}).hide()}
function set_gallery_grid_pages($the_gallery,pages){$pagination=$the_gallery.find('.tm_pb_gallery_pagination');if(!$pagination.length){return}
$pagination.html('');if(pages<=1){$pagination.hide();return}
$pagination_list=$pagination.children('ul');$pagination_list.append(''+tm_pb_custom.prev+' ');for(var page=1;page<=pages;page++){var first_page_class=page===1?' active':'',last_page_class=page===pages?' last-page':'',hidden_page_class=page>=5?' style="display:none;"':'';$pagination_list.append(''+page+' ')}
$pagination_list.append(''+tm_pb_custom.next+' ')}
function set_gallery_hash($the_gallery){if(!$the_gallery.attr('id')){return}
var this_gallery_state=[];this_gallery_state.push($the_gallery.attr('id'));if($the_gallery.find('.tm_pb_gallery_pagination a.active').length){this_gallery_state.push($the_gallery.find('.tm_pb_gallery_pagination a.active').data('page'))}else{this_gallery_state.push(1)}
this_gallery_state=this_gallery_state.join(tm_hash_module_param_seperator);tm_set_hash(this_gallery_state)}
$tm_pb_gallery.each(function(){var $the_gallery=$(this);if($the_gallery.hasClass('tm_pb_gallery_grid')){$the_gallery.show();set_gallery_grid_items($the_gallery);$the_gallery.on('tm_hashchange',function(event){var params=event.params;$the_gallery=$('#'+event.target.id);if(page_to=params[0]){if(!$the_gallery.find('.tm_pb_gallery_pagination a.page-'+page_to).hasClass('active')){$the_gallery.find('.tm_pb_gallery_pagination a.page-'+page_to).addClass('active').click()}}})}});$tm_pb_gallery.data('paginating',!1);$tm_pb_gallery.on('click','.tm_pb_gallery_pagination a',function(e){e.preventDefault();var to_page=$(this).data('page'),$the_gallery=$(this).parents('.tm_pb_gallery'),$the_gallery_items_container=$the_gallery.find('.tm_pb_gallery_items'),$the_gallery_items=$the_gallery_items_container.find('.tm_pb_gallery_item');if($the_gallery.data('paginating')){return}
$the_gallery.data('paginating',!0);if($(this).hasClass('page-prev')){to_page=parseInt($(this).parents('ul').find('a.active').data('page'))-1}else if($(this).hasClass('page-next')){to_page=parseInt($(this).parents('ul').find('a.active').data('page'))+1}
$(this).parents('ul').find('a').removeClass('active');$(this).parents('ul').find('a.page-'+to_page).addClass('active');var current_index=$(this).parents('ul').find('a.page-'+to_page).parent().index(),total_pages=$(this).parents('ul').find('li.page').length;$(this).parent().nextUntil('.page-'+(current_index+3)).show();$(this).parent().prevUntil('.page-'+(current_index-3)).show();$(this).parents('ul').find('li.page').each(function(i){if(!$(this).hasClass('prev')&&!$(this).hasClass('next')){if(i<(current_index-3)){$(this).hide()}else if(i>(current_index+1)){$(this).hide()}else{$(this).show()}
if(total_pages-current_index<=2&&total_pages-i<=5){$(this).show()}else if(current_index<=3&&i<=4){$(this).show()}}});if(to_page>1){$(this).parents('ul').find('li.prev').show()}else{$(this).parents('ul').find('li.prev').hide()}
if($(this).parents('ul').find('a.active').hasClass('last-page')){$(this).parents('ul').find('li.next').hide()}else{$(this).parents('ul').find('li.next').show()}
$the_gallery_items.hide();var visible_items=$the_gallery_items.filter(function(index){return $(this).data('page')===to_page}).show();$the_gallery.data('paginating',!1);setTimeout(function(){set_gallery_hash($the_gallery)},100);$('html, body').animate({scrollTop:$the_gallery.offset().top-200},200)})}
if($tm_pb_counter_amount.length){$tm_pb_counter_amount.each(function(){var $bar_item=$(this),bar_item_width=$bar_item.attr('data-width'),bar_item_padding=Math.ceil(parseFloat($bar_item.css('paddingLeft')))+Math.ceil(parseFloat($bar_item.css('paddingRight'))),$bar_item_text=$bar_item.children('.tm_pb_counter_amount_number'),bar_item_text_width=$bar_item_text.width()+bar_item_padding;$bar_item.css({'width':bar_item_width,'min-width':bar_item_text_width})})}
function tm_countdown_timer(timer){var end_date=parseInt(timer.data('end-timestamp')),current_date=new Date().getTime()/1000,seconds_left=(end_date-current_date);days=parseInt(seconds_left/86400);days=days>0?days:0;seconds_left=seconds_left%86400;hours=parseInt(seconds_left/3600);hours=hours>0?hours:0;seconds_left=seconds_left%3600;minutes=parseInt(seconds_left/60);minutes=minutes>0?minutes:0;seconds=parseInt(seconds_left%60);seconds=seconds>0?seconds:0;if(days==0){if(!timer.find('.days > .value').parent('.section').hasClass('zero')){timer.find('.days > .value').html('00').parent('.section').addClass('zero').next().addClass('zero')}}else{days_slice=days.toString().length>=2?days.toString().length:2;timer.find('.days > .value').html(('00'+days).slice(-days_slice))}
if(days==0&&hours==0){if(!timer.find('.hours > .value').parent('.section').hasClass('zero')){timer.find('.hours > .value').html('00').parent('.section').addClass('zero').next().addClass('zero')}}else{timer.find('.hours > .value').html(('0'+hours).slice(-2))}
if(days==0&&hours==0&&minutes==0){if(!timer.find('.minutes > .value').parent('.section').hasClass('zero')){timer.find('.minutes > .value').html('00').parent('.section').addClass('zero').next().addClass('zero')}}else{timer.find('.minutes > .value').html(('0'+minutes).slice(-2))}
if(days==0&&hours==0&&minutes==0&&seconds==0){if(!timer.find('.seconds > .value').parent('.section').hasClass('zero')){timer.find('.seconds > .value').html('00').parent('.section').addClass('zero')}}else{timer.find('.seconds > .value').html(('0'+seconds).slice(-2))}}
function tm_countdown_timer_labels(timer){if(timer.closest('.tm_pb_column_3_8').length||timer.closest('.tm_pb_column_1_4').length||timer.children('.tm_pb_countdown_timer_container').width()<=400){timer.find('.days .label').html(timer.find('.days').data('short'));timer.find('.hours .label').html(timer.find('.hours').data('short'));timer.find('.minutes .label').html(timer.find('.minutes').data('short'));timer.find('.seconds .label').html(timer.find('.seconds').data('short'))}else{timer.find('.days .label').html(timer.find('.days').data('full'));timer.find('.hours .label').html(timer.find('.hours').data('full'));timer.find('.minutes .label').html(timer.find('.minutes').data('full'));timer.find('.seconds .label').html(timer.find('.seconds').data('full'))}}
if($tm_pb_countdown_timer.length){$tm_pb_countdown_timer.each(function(){var timer=$(this);tm_countdown_timer_labels(timer);tm_countdown_timer(timer);setInterval(function(){tm_countdown_timer(timer)},1000)})}
if($tm_pb_tabs.length){$tm_pb_tabs.tm_pb_simple_slider({use_controls:!1,use_arrows:!1,slide:'.tm_pb_all_tabs > div',tabs_animation:!0}).on('tm_hashchange',function(event){var params=event.params;var $the_tabs=$('#'+event.target.id);var active_tab=params[0];if(!$the_tabs.find('.tm_pb_tabs_controls li').eq(active_tab).hasClass('tm_pb_tab_active')){$the_tabs.find('.tm_pb_tabs_controls li').eq(active_tab).click()}});$tm_pb_tabs_li.click(function(){var $this_el=$(this),$tabs_container=$this_el.closest('.tm_pb_tabs').data('tm_pb_simple_slider');if($tabs_container.tm_animation_running)return!1;$this_el.addClass('tm_pb_tab_active').siblings().removeClass('tm_pb_tab_active');$tabs_container.data('tm_pb_simple_slider').tm_slider_move_to($this_el.index());if($this_el.closest('.tm_pb_tabs').attr('id')){var tab_state=[];tab_state.push($this_el.closest('.tm_pb_tabs').attr('id'));tab_state.push($this_el.index());tab_state=tab_state.join(tm_hash_module_param_seperator);tm_set_hash(tab_state)}
return!1})}
if($tm_pb_map.length){google.maps.event.addDomListener(window,'load',function(){$tm_pb_map.each(function(){var $this_map_container=$(this),$this_map=$this_map_container.children('.tm_pb_map'),this_map_grayscale=$this_map_container.data('grayscale')||0,infowindow_active,marker_icon=$this_map.data('marker-icon')||[tm_pb_custom.builder_images_uri+'/marker.png',34,53,!1],map_style=$this_map.data('map-style');if(this_map_grayscale!==0){this_map_grayscale='-'+this_map_grayscale.toString()}
$this_map_container.data('map',new google.maps.Map($this_map[0],{zoom:parseInt($this_map.data('zoom')),center:new google.maps.LatLng(parseFloat($this_map.data('center-lat')),parseFloat($this_map.data('center-lng'))),mapTypeId:google.maps.MapTypeId.ROADMAP,scrollwheel:$this_map.data('mouse-wheel')=='on'?!0:!1,panControlOptions:{position:$this_map_container.is('.tm_beneath_transparent_nav')?google.maps.ControlPosition.LEFT_BOTTOM:google.maps.ControlPosition.LEFT_TOP},zoomControlOptions:{position:$this_map_container.is('.tm_beneath_transparent_nav')?google.maps.ControlPosition.LEFT_BOTTOM:google.maps.ControlPosition.LEFT_TOP},styles:map_style}));$this_map_container.data('bounds',new google.maps.LatLngBounds());$this_map_container.find('.tm_pb_map_pin').each(function(){var $this_marker=$(this),position=new google.maps.LatLng(parseFloat($this_marker.data('lat')),parseFloat($this_marker.data('lng')));$this_map_container.data('bounds').extend(position);var marker=new google.maps.Marker({position:position,map:$this_map_container.data('map'),title:$this_marker.data('title'),icon:{url:marker_icon[0],size:new google.maps.Size(marker_icon[1],marker_icon[2]),anchor:new google.maps.Point(marker_icon[1]/2,marker_icon[2])},animation:google.maps.Animation.DROP});if($this_marker.find('.infowindow').length){var infowindow=new google.maps.InfoWindow({content:$this_marker.html()});google.maps.event.addListener($this_map_container.data('map'),'click',function(){infowindow.close()});google.maps.event.addListener(marker,'click',function(){if(infowindow_active){infowindow_active.close()}
infowindow_active=infowindow;infowindow.open($this_map_container.data('map'),marker)})}});google.maps.event.addListener($this_map_container.data('map'),'bounds_changed',function(){if(!$this_map_container.data('map').getBounds().contains($this_map_container.data('bounds').getNorthEast())||!$this_map_container.data('map').getBounds().contains($this_map_container.data('bounds').getSouthWest())){$this_map_container.data('map').fitBounds($this_map_container.data('bounds'))}})})})}
if($tm_pb_shop.length){$tm_pb_shop.each(function(){var $this_el=$(this),icon=$this_el.data('icon')||'';if(icon===''){return!0}
$this_el.find('.tm_overlay').attr('data-icon',icon).addClass('tm_pb_inline_icon')})}
if($tm_pb_circle_counter.length){window.tm_pb_circle_counter_init=function($the_counter,animate){if(0===$the_counter.width()){return}
$the_counter.easyPieChart({animate:{duration:1800,enabled:!0},size:0!==$the_counter.width()?$the_counter.width():10,barColor:$the_counter.data('bar-bg-color'),trackColor:$the_counter.data('color')||'#000000',trackAlpha:$the_counter.data('alpha')||'0.1',lineWidth:$the_counter.data('circle-width')||'5',size:$the_counter.data('circle-size')||'110',scaleColor:!1,lineCap:$the_counter.data('bar-type')||'round',onStart:function(){$(this.el).find('.percent p').css({'visibility':'visible'})},onStep:function(from,to,percent){$(this.el).find('.percent-value').text(Math.round(parseInt(percent)))},onStop:function(from,to){$(this.el).find('.percent-value').text($(this.el).data('number-value'))}})}
window.tm_pb_reinit_circle_counters=function($tm_pb_circle_counter){$tm_pb_circle_counter.each(function(){var $the_counter=$(this);window.tm_pb_circle_counter_init($the_counter,!1);$the_counter.on('containerWidthChanged',function(event){$the_counter=$(event.target);$the_counter.find('canvas').remove();$the_counter.removeData('easyPieChart');window.tm_pb_circle_counter_init($the_counter,!0)})})}
window.tm_pb_reinit_circle_counters($tm_pb_circle_counter)}
if($tm_pb_number_counter.length){window.tm_pb_reinit_number_counters=function($tm_pb_number_counter){if($.fn.fitText){$tm_pb_number_counter.find('.percent').fitText(0.3)}
$tm_pb_number_counter.each(function(){var $this_counter=$(this);$this_counter.easyPieChart({animate:{duration:1800,enabled:!0},size:0,trackColor:!1,scaleColor:!1,lineWidth:0,onStart:function(){$(this.el).find('.percent').css({'visibility':'visible'})},onStep:function(from,to,percent){if(percent!=to)
$(this.el).find('.percent-value').text(Math.round(parseInt(percent)))},onStop:function(from,to){$(this.el).find('.percent-value').text($(this.el).data('number-value'))}})})}
window.tm_pb_reinit_number_counters($tm_pb_number_counter)}
function tm_apply_parallax(){var $this=$(this),element_top=$this.offset().top,window_top=$tm_window.scrollTop(),y_pos=(((window_top+$tm_window.height())-element_top)*0.3),main_position;main_position='translate(0, '+y_pos+'px)';$this.find('.tm_parallax_bg').css({'-webkit-transform':main_position,'-moz-transform':main_position,'-ms-transform':main_position,'transform':main_position})}
function tm_parallax_set_height(){var $this=$(this),bg_height;bg_height=($tm_window.height()*0.3+$this.innerHeight());$this.find('.tm_parallax_bg').css({'height':bg_height})}
$('.tm_pb_toggle_title').click(function(){var $this_heading=$(this),$module=$this_heading.closest('.tm_pb_toggle'),$section=$module.parents('.tm_pb_section'),$content=$module.find('.tm_pb_toggle_content'),$accordion=$module.closest('.tm_pb_accordion'),is_accordion=$accordion.length,is_accordion_toggling=$accordion.hasClass('tm_pb_accordion_toggling'),$accordion_active_toggle;if(is_accordion){if($module.hasClass('tm_pb_toggle_open')||is_accordion_toggling){return!1}
$accordion.addClass('tm_pb_accordion_toggling');$accordion_active_toggle=$module.siblings('.tm_pb_toggle_open')}
if($content.is(':animated')){return}
$content.slideToggle(700,function(){if($module.hasClass('tm_pb_toggle_close')){$module.removeClass('tm_pb_toggle_close').addClass('tm_pb_toggle_open')}else{$module.removeClass('tm_pb_toggle_open').addClass('tm_pb_toggle_close')}
if($section.hasClass('tm_pb_section_parallax')&&!$section.children().hasClass('tm_pb_parallax_css')){$.proxy(tm_parallax_set_height,$section)()}});if(is_accordion){$accordion_active_toggle.find('.tm_pb_toggle_content').slideToggle(700,function(){$accordion_active_toggle.removeClass('tm_pb_toggle_open').addClass('tm_pb_toggle_close');$accordion.removeClass('tm_pb_accordion_toggling')})}});var $tm_contact_container=$('.tm_pb_contact_form_container');if($tm_contact_container.length){$tm_contact_container.each(function(){var $this_contact_container=$(this),$tm_contact_form=$this_contact_container.find('form'),$tm_contact_submit=$this_contact_container.find('input.tm_pb_contact_submit'),$tm_inputs=$tm_contact_form.find('input[type=text],textarea'),tm_email_reg=/^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$/,redirect_url=typeof $this_contact_container.data('redirect_url')!=='undefined'?$this_contact_container.data('redirect_url'):'';$tm_contact_form.on('submit',function(event){var $this_contact_form=$(this),$this_inputs=$this_contact_form.find('.tm_pb_contact_form_input, .tm_pb_contact_captcha'),this_tm_contact_error=!1,$tm_contact_message=$this_contact_form.closest('.tm_pb_contact_form_container').find('.tm-pb-contact-message'),tm_message='',tm_fields_message='',$this_contact_container=$this_contact_form.closest('.tm_pb_contact_form_container'),$captcha_field=$this_contact_form.find('.tm_pb_contact_captcha'),form_unique_id=typeof $this_contact_container.data('form_unique_num')!=='undefined'?$this_contact_container.data('form_unique_num'):0,inputs_list=[];tm_message='';$this_inputs.removeClass('tm_contact_error');$this_inputs.each(function(){var $this_el=$(this),this_val=$this_el.val(),this_label=$this_el.siblings('label').text(),field_type=typeof $this_el.data('field_type')!=='undefined'?$this_el.data('field_type'):'text',required_mark=typeof $this_el.data('required_mark')!=='undefined'?$this_el.data('required_mark'):'not_required',original_id=typeof $this_el.data('original_id')!=='undefined'?$this_el.data('original_id'):'',field_name;if(typeof $this_el.attr('id')!=='undefined'){inputs_list.push({'field_id':$this_el.attr('id'),'original_id':original_id,'required_mark':required_mark,'field_type':field_type,'field_label':this_label})}
if('required'===required_mark&&(''===this_val||this_label===this_val||null===this_val)){$this_el.addClass('tm_contact_error');this_tm_contact_error=!0;field_name=$this_el.data('original_title');if(!field_name){field_name=$this_el.attr('name')}
tm_fields_message+=''+field_name+' '}
if('email'===field_type&&''!==this_val&&this_label!==this_val&&!tm_email_reg.test(this_val)){$this_el.addClass('tm_contact_error');this_tm_contact_error=!0;if(!tm_email_reg.test(this_val)){tm_message+=''+tm_pb_custom.invalid+' '}}});if($captcha_field.length&&''!==$captcha_field.val()){var first_digit=parseInt($captcha_field.data('first_digit')),second_digit=parseInt($captcha_field.data('second_digit'));if(parseInt($captcha_field.val())!==first_digit+second_digit){tm_message+=''+tm_pb_custom.wrong_captcha+' ';this_tm_contact_error=!0;first_digit=Math.floor((Math.random()*15)+1);second_digit=Math.floor((Math.random()*15)+1);$captcha_field.data('first_digit',first_digit);$captcha_field.data('second_digit',second_digit);$this_contact_form.find('.tm_pb_contact_captcha_question').empty().append(first_digit+' + '+second_digit)}}
if(!this_tm_contact_error){var $href=$(this).attr('action'),form_data=$(this).serializeArray();form_data.push({'name':'tm_pb_contact_email_fields_'+form_unique_id,'value':JSON.stringify(inputs_list)});$this_contact_container.fadeTo('fast',0.2).load($href+' #'+$this_contact_form.closest('.tm_pb_contact_form_container').attr('id'),form_data,function(responseText){if(''!==redirect_url&&!$(responseText).find('.tm_pb_contact_error_text').length){window.location.href=redirect_url}
$this_contact_container.fadeTo('fast',1)})}
tm_message+=' ';if(''!==tm_fields_message){if(tm_message!=''){tm_message=''+tm_pb_custom.contact_error_message+'
'+tm_message}
tm_fields_message='';tm_fields_message=''+tm_pb_custom.fill_message+'
'+tm_fields_message;tm_message=tm_fields_message+tm_message}
if(tm_message!=''){$tm_contact_message.html(tm_message)}
event.preventDefault()})})}
$('.tm_pb_video .tm_pb_video_overlay, .tm_pb_video_wrap .tm_pb_video_overlay').click(function(){var $this=$(this),$video_image=$this.closest('.tm_pb_video_overlay');$video_image.fadeTo(500,0,function(){var $image=$(this);$image.css('display','none')});return!1});if($tm_pb_video[0]){$tm_pb_video.each(function(){var $this=$(this),$video_tag=$('video',$this),autoPlay=$video_tag.data('autoplay');if(autoPlay){$this.waypoint(function(direction){if($video_tag.get(0).paused){$video_tag.get(0).play()}},{offset:'bottom-in-view'})}})}
function tm_pb_resize_section_video_bg($video){$element=typeof $video!=='undefined'?$video.closest('.tm_pb_section_video_bg'):$('.tm_pb_section_video_bg');$element.each(function(){var $this_el=$(this),ratio=(typeof $this_el.attr('data-ratio')!=='undefined')?$this_el.attr('data-ratio'):$this_el.find('video').attr('width')/$this_el.find('video').attr('height'),$video_elements=$this_el.find('.mejs-video, video, object').css('margin',0),$container=$this_el.closest('.tm_pb_section_video').length?$this_el.closest('.tm_pb_section_video'):$this_el.closest('.tm_pb_slides'),body_width=$container.width(),container_height=$container.innerHeight(),width,height;if(typeof $this_el.attr('data-ratio')=='undefined')
$this_el.attr('data-ratio',ratio);if(body_width/container_height li');if(dropdown_offset.left>(window_width-dropdown_width)){$parents.addClass('tm-reverse-direction-nav')}})}
tm_fix_nav_direction();tm_pb_form_placeholders_init($('.tm_pb_newsletter_form'));$('.tm_pb_fullwidth_menu ul.nav').each(function(i){i++;tm_duplicate_menu($(this),$(this).parents('.tm_pb_row').find('div .mobile_nav'),'mobile_menu'+i,'tm_mobile_menu')});window.tm_fix_testimonial_inner_width=function(){var window_width=$(window).width();if(window_width>767){$('.tm_pb_testimonial').each(function(){if(!$(this).is(':visible')){return}
var $testimonial=$(this),testimonial_width=$testimonial.width(),$portrait=$testimonial.find('.tm_pb_testimonial_portrait'),portrait_width=$portrait.width(),$testimonial_inner=$testimonial.find('.tm_pb_testimonial_description_inner'),$outer_column=$testimonial.closest('.tm_pb_column'),testimonial_inner_width=testimonial_width,subtract=!($outer_column.hasClass('tm_pb_column_1_3')||$outer_column.hasClass('tm_pb_column_1_4')||$outer_column.hasClass('tm_pb_column_3_8'))?portrait_width+31:0;$testimonial_inner.width(testimonial_inner_width-subtract)})}else{$('.tm_pb_testimonial_description_inner').removeAttr('style')}}
window.tm_fix_testimonial_inner_width();window.tm_reinint_waypoint_modules=function(){if($.fn.waypoint){var $tm_pb_circle_counter=$('.tm_pb_circle_counter_bar'),$tm_pb_number_counter=$('.tm_pb_number_counter');$('.tm_pb_counter_container, .tm-waypoint').waypoint({offset:'75%',handler:function(){$(this.element).addClass('tm-animated')}});if($tm_pb_circle_counter.length){$tm_pb_circle_counter.each(function(){var $this_counter=$(this);if(!$this_counter.is(':visible')){return}
$this_counter.waypoint({offset:'65%',handler:function(){$this_counter.data('easyPieChart').update($this_counter.data('number-value'))}})})}
if($tm_pb_number_counter.length){$tm_pb_number_counter.each(function(){var $this_counter=$(this);$this_counter.waypoint({offset:'75%',handler:function(){$this_counter.data('easyPieChart').update($this_counter.data('number-value'))}})})}}}
window.tm_calc_fullscreen_section=function(){var $tm_window=$(window),$body=$('body'),$wpadminbar=$('#wpadminbar'),tm_is_vertical_nav=$body.hasClass('tm_vertical_nav'),$this_section=$(this),this_section_index=$this_section.index('.tm_pb_fullwidth_header'),$header=$this_section.children('.tm_pb_fullwidth_header_container'),$header_content=$header.children('.header-content-container'),$header_image=$header.children('.header-image-container'),sectionHeight=$tm_window.height(),$wpadminbar=$('#wpadminbar'),$top_header=$('#top-header'),$main_header=$('#main-header'),tm_header_height,secondary_nav_height;secondary_nav_height=$top_header.length&&$top_header.is(':visible')?$top_header.innerHeight():0;tm_header_height=$main_header.length?$main_header.innerHeight()+secondary_nav_height:0;var calc_header_offset=($wpadminbar.length)?tm_header_height+$wpadminbar.innerHeight()-1:tm_header_height-1;if($body.hasClass('tm_vertical_nav')){if($tm_window.width()>=980&&$top_header.length){sectionHeight-=$top_header.height()}
if($wpadminbar.length){sectionHeight-=$wpadminbar.height()}}else{if($body.hasClass('tm_hide_nav')){if($wpadminbar.length){sectionHeight-=$wpadminbar.height()}
if($tm_window.width()<981&&!$body.hasClass('tm_transparent_nav')){sectionHeight-=$('#main-header').height()}}else{if($this_section.offset().top<=calc_header_offset+3){if(tm_is_vertical_nav){var $top_header=$('#top-header'),top_header_height=($top_header.length&&0===$this_section.index('.tm_pb_fullscreen'))?$top_header.height():0,wpadminbar_height=($wpadminbar.length&&0===$this_section.index('.tm_pb_fullscreen'))?$wpadminbar.height():0,calc_header_offset_vertical=wpadminbar_height+top_header_height;sectionHeight-=calc_header_offset_vertical}else{sectionHeight-=calc_header_offset}}}}
if($body.hasClass('tm_transparent_nav')&&$body.hasClass('tm_hide_nav')&&0===this_section_index){$this_section.css('padding-top','')}
$this_section.css('min-height',sectionHeight+'px');$header.css('min-height',sectionHeight+'px');if($header.hasClass('center')&&$header_content.hasClass('bottom')&&$header_image.hasClass('bottom')){$header.addClass('bottom-bottom')}
if($header.hasClass('center')&&$header_content.hasClass('center')&&$header_image.hasClass('center')){$header.addClass('center-center')}
if($header.hasClass('center')&&$header_content.hasClass('center')&&$header_image.hasClass('bottom')){$header.addClass('center-bottom');var contentHeight=sectionHeight-$header_image.outerHeight(!0);if(contentHeight>0){$header_content.css('min-height',contentHeight+'px')}}
if($header.hasClass('center')&&$header_content.hasClass('bottom')&&$header_image.hasClass('center')){$header.addClass('bottom-center')}
if(($header.hasClass('left')||$header.hasClass('right'))&&!$header_content.length&&$header_image.length){$header.css('justify-content','flex-end')}
if($header.hasClass('center')&&$header_content.hasClass('bottom')&&!$header_image.length){$header_content.find('.header-content').css('margin-bottom',80+'px')}
if($header_content.hasClass('bottom')&&$header_image.hasClass('center')){$header_image.find('.header-image').css('margin-bottom',80+'px');$header_image.css('align-self','flex-end')}}
$(window).resize(function(){var window_width=$tm_window.width(),tm_container_css_width=$tm_container.css('width'),tm_container_width_in_pixel=(typeof tm_container_css_width!=='undefined')?tm_container_css_width.substr(-1,1)!=='%':'',tm_container_actual_width=(tm_container_width_in_pixel)?$tm_container.width():(($tm_container.width()/100)*window_width),containerWidthChanged=tm_container_width!==tm_container_actual_width;tm_pb_resize_section_video_bg();tm_pb_center_video();tm_fix_slider_height();tm_fix_nav_direction();$tm_pb_fullwidth_portfolio.each(function(){set_container_height=$(this).hasClass('tm_pb_fullwidth_portfolio_carousel')?!0:!1;set_fullwidth_portfolio_columns($(this),set_container_height)});if(containerWidthChanged){$('.container-width-change-notify').trigger('containerWidthChanged');setTimeout(function(){$tm_pb_filterable_portfolio.each(function(){set_filterable_grid_items($(this))});$tm_pb_gallery.each(function(){if($(this).hasClass('tm_pb_gallery_grid')){set_gallery_grid_items($(this))}})},100);tm_container_width=tm_container_actual_width;etRecalculateOffset=!0;if($tm_pb_circle_counter.length){$tm_pb_circle_counter.each(function(){var $this_counter=$(this);if(!$this_counter.is(':visible')){return}
$this_counter.data('easyPieChart').update($this_counter.data('number-value'))})}
if($tm_pb_countdown_timer.length){$tm_pb_countdown_timer.each(function(){var timer=$(this);tm_countdown_timer_labels(timer)})}}
window.tm_fix_testimonial_inner_width();tm_audio_module_set()});$(window).ready(function(){if($.fn.fitVids){$('.tm_pb_slide_video').fitVids();$('.tm_pb_module').fitVids({customSelector:"iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"})}
tm_fix_video_wmode('.fluid-width-video-wrapper');tm_fix_slider_height()});$(window).load(function(){tm_fix_fullscreen_section();$('section.tm_pb_fullscreen').each(function(){var $this_section=$(this);$.proxy(tm_calc_fullscreen_section,$this_section)();$tm_window.on('resize',$.proxy(tm_calc_fullscreen_section,$this_section))});$('.tm_pb_fullwidth_header_scroll a').click(function(event){event.preventDefault();var $this_section=$(this).parents('section'),is_next_fullscreen=$this_section.next().hasClass('tm_pb_fullscreen'),$wpadminbar=$('#wpadminbar'),wpadminbar_height=($wpadminbar.length&&!is_next_fullscreen)?$wpadminbar.height():0,main_header_height=is_next_fullscreen||!tm_is_fixed_nav?0:$main_header.height(),top_header_height=is_next_fullscreen||!tm_is_fixed_nav?0:$top_header.height(),section_bottom=$this_section.offset().top+$this_section.outerHeight(!0)-(wpadminbar_height+top_header_height+main_header_height);if($this_section.length){$('html, body').animate({scrollTop:section_bottom},800);if(!$('#main-header').hasClass('tm-fixed-header')&&$('body').hasClass('tm_fixed_nav')&&$(window).width()>980){setTimeout(function(){var section_offset_top=$this_section.offset().top,section_height=$this_section.outerHeight(!0),main_header_height=is_next_fullscreen?0:$main_header.height(),section_bottom=section_offset_top+section_height-(main_header_height+top_header_height+wpadminbar_height);$('html, body').animate({scrollTop:section_bottom},280,'linear')},780)}}});setTimeout(function(){$('.tm_pb_preload').removeClass('tm_pb_preload')},500);if($.fn.hashchange){$(window).hashchange(function(){var hash=window.location.hash.substring(1);process_tm_hashchange(hash)});$(window).hashchange()}
if($tm_pb_parallax.length&&!tm_is_mobile_device){$tm_pb_parallax.each(function(){if($(this).hasClass('tm_pb_parallax_css')){return}
var $this_parent=$(this).parent();$.proxy(tm_parallax_set_height,$this_parent)();$.proxy(tm_apply_parallax,$this_parent)();$tm_window.on('scroll',$.proxy(tm_apply_parallax,$this_parent));$tm_window.on('resize',$.proxy(tm_parallax_set_height,$this_parent));$tm_window.on('resize',$.proxy(tm_apply_parallax,$this_parent));$this_parent.find('.tm-learn-more .heading-more').click(function(){setTimeout(function(){$.proxy(tm_parallax_set_height,$this_parent)()},300)})})}
tm_audio_module_set();window.tm_reinint_waypoint_modules()});if($('.tm_section_specialty').length){$('.tm_section_specialty').each(function(){var this_row=$(this).find('.tm_pb_row');this_row.find('>.tm_pb_column:not(.tm_pb_specialty_column)').addClass('tm_pb_column_single')})}
if($('.tm_pb_section_parallax').length&&$('.tm_pb_map').length){$('body').addClass('parallax-map-support')}
$('.tm_pb_widget_area '+tm_pb_custom.widget_search_selector).each(function(){var $search_wrap=$(this),$search_input_submit=$search_wrap.find('input[type="submit"]'),search_input_submit_text=$search_input_submit.attr('value'),$search_button=$search_wrap.find('button'),search_button_text=$search_button.text(),has_submit_button=$search_input_submit.length||$search_button.length?!0:!1,min_column_width=150;if(!$search_wrap.find('input[type="text"]').length&&!$search_wrap.find('input[type="search"]').length){return}
if(!has_submit_button){$search_wrap.addClass('tm-no-submit-button')}
if($search_wrap.width()<150){$search_wrap.addClass('tm-narrow-wrapper')}
if($search_input_submit.length&&(typeof search_input_submit_text=='undefined'||search_input_submit_text==='')){$search_input_submit.remove();$search_wrap.addClass('tm-no-submit-button')}
if($search_button.length&&(typeof search_button_text=='undefined'||search_button_text==='')){$search_button.remove();$search_wrap.addClass('tm-no-submit-button')}});if($('.tm_pb_search').length){$('.tm_pb_search').each(function(){var $this_module=$(this),$input_field=$this_module.find('.tm_pb_s'),$button=$this_module.find('.tm_pb_searchsubmit'),input_padding=$this_module.hasClass('tm_pb_text_align_right')?'paddingLeft':'paddingRight',disabled_button=$this_module.hasClass('tm_pb_hide_search_button');if($button.innerHeight()>$input_field.innerHeight()){$input_field.height($button.innerHeight())}
if(!disabled_button){$input_field.css(input_padding,$button.innerWidth()+10)}})}
if($('.tm_pb_comments_module').length){$('.tm_pb_comments_module').each(function(){var $comments_module=$(this),$comments_module_button=$comments_module.find('.comment-reply-link');if($comments_module_button.length){$comments_module_button.addClass('tm_pb_button');if(typeof $comments_module.data('icon')!=='undefined'){$comments_module_button.attr('data-icon',$comments_module.data('icon'));$comments_module_button.addClass('tm_pb_custom_button_icon')}}})}
if($('.tm_pb_swiper')[0]){$('.tm_pb_swiper').each(function(){var $this=$(this),settings=$this.data('settings'),pagination=('on'===settings.pagination)?!0:!1,navigateButton=('on'===settings.navigateButton)?!0:!1,autoplay=('on'===settings.autoplay)?3500:!1,centeredSlides=('on'===settings.centeredSlides)?!0:!1,spaceBetweenSlides=settings.spaceBetweenSlides||0,slidesPerView=settings.slidesPerView,swiperContainer=$('.swiper-container',$this),swiper=new Swiper(swiperContainer,{slidesPerView:+slidesPerView,autoplay:autoplay,centeredSlides:centeredSlides,mousewheelControl:!1,paginationClickable:!0,spaceBetween:+spaceBetweenSlides,speed:500,nextButton:(navigateButton)?$('.swiper-button-next',$this):null,prevButton:(navigateButton)?$('.swiper-button-prev',$this):null,pagination:(pagination)?$('.swiper-pagination',$this):null,onInit:function(){if(!navigateButton){$('.swiper-button-next, .swiper-button-prev',$this).remove()}
if(!pagination){$('.swiper-pagination',$this).remove()}},breakpoints:{1200:{slidesPerView:Math.floor(slidesPerView*0.75),spaceBetween:Math.floor(spaceBetweenSlides*0.75)},992:{slidesPerView:Math.floor(slidesPerView*0.5),spaceBetween:Math.floor(spaceBetweenSlides*0.5)},769:{slidesPerView:(0!==Math.floor(slidesPerView*0.25))?Math.floor(slidesPerView*0.25):1},}})});$(window).on('load',loadHandler);function loadHandler(){$('.tm_pb_swiper').css({'opacity':'1'})}}});
/**
* Swiper 3.3.1
* Most modern mobile touch slider and framework with hardware accelerated transitions
*
* http://www.idangero.us/swiper/
*
* Copyright 2016, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us/
*
* Licensed under MIT
*
* Released on: February 7, 2016
*/
(function () {
'use strict';
var $;
/*===========================
Swiper
===========================*/
var Swiper = function (container, params) {
if (!(this instanceof Swiper)) return new Swiper(container, params);
var defaults = {
direction: 'horizontal',
touchEventsTarget: 'container',
initialSlide: 0,
speed: 300,
// autoplay
autoplay: false,
autoplayDisableOnInteraction: true,
autoplayStopOnLast: false,
// To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
iOSEdgeSwipeDetection: false,
iOSEdgeSwipeThreshold: 20,
// Free mode
freeMode: false,
freeModeMomentum: true,
freeModeMomentumRatio: 1,
freeModeMomentumBounce: true,
freeModeMomentumBounceRatio: 1,
freeModeSticky: false,
freeModeMinimumVelocity: 0.02,
// Autoheight
autoHeight: false,
// Set wrapper width
setWrapperSize: false,
// Virtual Translate
virtualTranslate: false,
// Effects
effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
coverflow: {
rotate: 50,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows : true
},
flip: {
slideShadows : true,
limitRotation: true
},
cube: {
slideShadows: true,
shadow: true,
shadowOffset: 20,
shadowScale: 0.94
},
fade: {
crossFade: false
},
// Parallax
parallax: false,
// Scrollbar
scrollbar: null,
scrollbarHide: true,
scrollbarDraggable: false,
scrollbarSnapOnRelease: false,
// Keyboard Mousewheel
keyboardControl: false,
mousewheelControl: false,
mousewheelReleaseOnEdges: false,
mousewheelInvert: false,
mousewheelForceToAxis: false,
mousewheelSensitivity: 1,
// Hash Navigation
hashnav: false,
// Breakpoints
breakpoints: undefined,
// Slides grid
spaceBetween: 0,
slidesPerView: 1,
slidesPerColumn: 1,
slidesPerColumnFill: 'column',
slidesPerGroup: 1,
centeredSlides: false,
slidesOffsetBefore: 0, // in px
slidesOffsetAfter: 0, // in px
// Round length
roundLengths: false,
// Touches
touchRatio: 1,
touchAngle: 45,
simulateTouch: true,
shortSwipes: true,
longSwipes: true,
longSwipesRatio: 0.5,
longSwipesMs: 300,
followFinger: true,
onlyExternal: false,
threshold: 0,
touchMoveStopPropagation: true,
// Unique Navigation Elements
uniqueNavElements: true,
// Pagination
pagination: null,
paginationElement: 'span',
paginationClickable: false,
paginationHide: false,
paginationBulletRender: null,
paginationProgressRender: null,
paginationFractionRender: null,
paginationCustomRender: null,
paginationType: 'bullets', // 'bullets' or 'progress' or 'fraction' or 'custom'
// Resistance
resistance: true,
resistanceRatio: 0.85,
// Next/prev buttons
nextButton: null,
prevButton: null,
// Progress
watchSlidesProgress: false,
watchSlidesVisibility: false,
// Cursor
grabCursor: false,
// Clicks
preventClicks: true,
preventClicksPropagation: true,
slideToClickedSlide: false,
// Lazy Loading
lazyLoading: false,
lazyLoadingInPrevNext: false,
lazyLoadingInPrevNextAmount: 1,
lazyLoadingOnTransitionStart: false,
// Images
preloadImages: true,
updateOnImagesReady: true,
// loop
loop: false,
loopAdditionalSlides: 0,
loopedSlides: null,
// Control
control: undefined,
controlInverse: false,
controlBy: 'slide', //or 'container'
// Swiping/no swiping
allowSwipeToPrev: true,
allowSwipeToNext: true,
swipeHandler: null, //'.swipe-handler',
noSwiping: true,
noSwipingClass: 'swiper-no-swiping',
// NS
slideClass: 'swiper-slide',
slideActiveClass: 'swiper-slide-active',
slideVisibleClass: 'swiper-slide-visible',
slideDuplicateClass: 'swiper-slide-duplicate',
slideNextClass: 'swiper-slide-next',
slidePrevClass: 'swiper-slide-prev',
wrapperClass: 'swiper-wrapper',
bulletClass: 'swiper-pagination-bullet',
bulletActiveClass: 'swiper-pagination-bullet-active',
buttonDisabledClass: 'swiper-button-disabled',
paginationCurrentClass: 'swiper-pagination-current',
paginationTotalClass: 'swiper-pagination-total',
paginationHiddenClass: 'swiper-pagination-hidden',
paginationProgressbarClass: 'swiper-pagination-progressbar',
// Observer
observer: false,
observeParents: false,
// Accessibility
a11y: false,
prevSlideMessage: 'Previous slide',
nextSlideMessage: 'Next slide',
firstSlideMessage: 'This is the first slide',
lastSlideMessage: 'This is the last slide',
paginationBulletMessage: 'Go to slide {{index}}',
// Callbacks
runCallbacksOnInit: true
/*
Callbacks:
onInit: function (swiper)
onDestroy: function (swiper)
onClick: function (swiper, e)
onTap: function (swiper, e)
onDoubleTap: function (swiper, e)
onSliderMove: function (swiper, e)
onSlideChangeStart: function (swiper)
onSlideChangeEnd: function (swiper)
onTransitionStart: function (swiper)
onTransitionEnd: function (swiper)
onImagesReady: function (swiper)
onProgress: function (swiper, progress)
onTouchStart: function (swiper, e)
onTouchMove: function (swiper, e)
onTouchMoveOpposite: function (swiper, e)
onTouchEnd: function (swiper, e)
onReachBeginning: function (swiper)
onReachEnd: function (swiper)
onSetTransition: function (swiper, duration)
onSetTranslate: function (swiper, translate)
onAutoplayStart: function (swiper)
onAutoplayStop: function (swiper),
onLazyImageLoad: function (swiper, slide, image)
onLazyImageReady: function (swiper, slide, image)
*/
};
var initialVirtualTranslate = params && params.virtualTranslate;
params = params || {};
var originalParams = {};
for (var param in params) {
if (typeof params[param] === 'object' && params[param] !== null && !(params[param].nodeType || params[param] === window || params[param] === document || (typeof Dom7 !== 'undefined' && params[param] instanceof Dom7) || (typeof jQuery !== 'undefined' && params[param] instanceof jQuery))) {
originalParams[param] = {};
for (var deepParam in params[param]) {
originalParams[param][deepParam] = params[param][deepParam];
}
}
else {
originalParams[param] = params[param];
}
}
for (var def in defaults) {
if (typeof params[def] === 'undefined') {
params[def] = defaults[def];
}
else if (typeof params[def] === 'object') {
for (var deepDef in defaults[def]) {
if (typeof params[def][deepDef] === 'undefined') {
params[def][deepDef] = defaults[def][deepDef];
}
}
}
}
// Swiper
var s = this;
// Params
s.params = params;
s.originalParams = originalParams;
// Classname
s.classNames = [];
/*=========================
Dom Library and plugins
===========================*/
if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined'){
$ = Dom7;
}
if (typeof $ === 'undefined') {
if (typeof Dom7 === 'undefined') {
$ = window.Dom7 || window.Zepto || window.jQuery;
}
else {
$ = Dom7;
}
if (!$) return;
}
// Export it to Swiper instance
s.$ = $;
/*=========================
Breakpoints
===========================*/
s.currentBreakpoint = undefined;
s.getActiveBreakpoint = function () {
//Get breakpoint for window width
if (!s.params.breakpoints) return false;
var breakpoint = false;
var points = [], point;
for ( point in s.params.breakpoints ) {
if (s.params.breakpoints.hasOwnProperty(point)) {
points.push(point);
}
}
points.sort(function (a, b) {
return parseInt(a, 10) > parseInt(b, 10);
});
for (var i = 0; i < points.length; i++) {
point = points[i];
if (point >= window.innerWidth && !breakpoint) {
breakpoint = point;
}
}
return breakpoint || 'max';
};
s.setBreakpoint = function () {
//Set breakpoint for window width and update parameters
var breakpoint = s.getActiveBreakpoint();
if (breakpoint && s.currentBreakpoint !== breakpoint) {
var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
var needsReLoop = s.params.loop && (breakPointsParams.slidesPerView !== s.params.slidesPerView);
for ( var param in breakPointsParams ) {
s.params[param] = breakPointsParams[param];
}
s.currentBreakpoint = breakpoint;
if(needsReLoop && s.destroyLoop) {
s.reLoop(true);
}
}
};
// Set breakpoint on load
if (s.params.breakpoints) {
s.setBreakpoint();
}
/*=========================
Preparation - Define Container, Wrapper and Pagination
===========================*/
s.container = $(container);
if (s.container.length === 0) return;
if (s.container.length > 1) {
var swipers = [];
s.container.each(function () {
var container = this;
swipers.push(new Swiper(this, params));
});
return swipers;
}
// Save instance in container HTML Element and in data
s.container[0].swiper = s;
s.container.data('swiper', s);
s.classNames.push('swiper-container-' + s.params.direction);
if (s.params.freeMode) {
s.classNames.push('swiper-container-free-mode');
}
if (!s.support.flexbox) {
s.classNames.push('swiper-container-no-flexbox');
s.params.slidesPerColumn = 1;
}
if (s.params.autoHeight) {
s.classNames.push('swiper-container-autoheight');
}
// Enable slides progress when required
if (s.params.parallax || s.params.watchSlidesVisibility) {
s.params.watchSlidesProgress = true;
}
// Coverflow / 3D
if (['cube', 'coverflow', 'flip'].indexOf(s.params.effect) >= 0) {
if (s.support.transforms3d) {
s.params.watchSlidesProgress = true;
s.classNames.push('swiper-container-3d');
}
else {
s.params.effect = 'slide';
}
}
if (s.params.effect !== 'slide') {
s.classNames.push('swiper-container-' + s.params.effect);
}
if (s.params.effect === 'cube') {
s.params.resistanceRatio = 0;
s.params.slidesPerView = 1;
s.params.slidesPerColumn = 1;
s.params.slidesPerGroup = 1;
s.params.centeredSlides = false;
s.params.spaceBetween = 0;
s.params.virtualTranslate = true;
s.params.setWrapperSize = false;
}
if (s.params.effect === 'fade' || s.params.effect === 'flip') {
s.params.slidesPerView = 1;
s.params.slidesPerColumn = 1;
s.params.slidesPerGroup = 1;
s.params.watchSlidesProgress = true;
s.params.spaceBetween = 0;
s.params.setWrapperSize = false;
if (typeof initialVirtualTranslate === 'undefined') {
s.params.virtualTranslate = true;
}
}
// Grab Cursor
if (s.params.grabCursor && s.support.touch) {
s.params.grabCursor = false;
}
// Wrapper
s.wrapper = s.container.children('.' + s.params.wrapperClass);
// Pagination
if (s.params.pagination) {
s.paginationContainer = $(s.params.pagination);
if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
s.paginationContainer = s.container.find(s.params.pagination);
}
if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
s.paginationContainer.addClass('swiper-pagination-clickable');
}
else {
s.params.paginationClickable = false;
}
s.paginationContainer.addClass('swiper-pagination-' + s.params.paginationType);
}
// Next/Prev Buttons
if (s.params.nextButton || s.params.prevButton) {
if (s.params.nextButton) {
s.nextButton = $(s.params.nextButton);
if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
s.nextButton = s.container.find(s.params.nextButton);
}
}
if (s.params.prevButton) {
s.prevButton = $(s.params.prevButton);
if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
s.prevButton = s.container.find(s.params.prevButton);
}
}
}
// Is Horizontal
s.isHorizontal = function () {
return s.params.direction === 'horizontal';
};
// s.isH = isH;
// RTL
s.rtl = s.isHorizontal() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');
if (s.rtl) {
s.classNames.push('swiper-container-rtl');
}
// Wrong RTL support
if (s.rtl) {
s.wrongRTL = s.wrapper.css('display') === '-webkit-box';
}
// Columns
if (s.params.slidesPerColumn > 1) {
s.classNames.push('swiper-container-multirow');
}
// Check for Android
if (s.device.android) {
s.classNames.push('swiper-container-android');
}
// Add classes
s.container.addClass(s.classNames.join(' '));
// Translate
s.translate = 0;
// Progress
s.progress = 0;
// Velocity
s.velocity = 0;
/*=========================
Locks, unlocks
===========================*/
s.lockSwipeToNext = function () {
s.params.allowSwipeToNext = false;
};
s.lockSwipeToPrev = function () {
s.params.allowSwipeToPrev = false;
};
s.lockSwipes = function () {
s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;
};
s.unlockSwipeToNext = function () {
s.params.allowSwipeToNext = true;
};
s.unlockSwipeToPrev = function () {
s.params.allowSwipeToPrev = true;
};
s.unlockSwipes = function () {
s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;
};
/*=========================
Round helper
===========================*/
function round(a) {
return Math.floor(a);
}
/*=========================
Set grab cursor
===========================*/
if (s.params.grabCursor) {
s.container[0].style.cursor = 'move';
s.container[0].style.cursor = '-webkit-grab';
s.container[0].style.cursor = '-moz-grab';
s.container[0].style.cursor = 'grab';
}
/*=========================
Update on Images Ready
===========================*/
s.imagesToLoad = [];
s.imagesLoaded = 0;
s.loadImage = function (imgElement, src, srcset, checkForComplete, callback) {
var image;
function onReady () {
if (callback) callback();
}
if (!imgElement.complete || !checkForComplete) {
if (src) {
image = new window.Image();
image.onload = onReady;
image.onerror = onReady;
if (srcset) {
image.srcset = srcset;
}
if (src) {
image.src = src;
}
} else {
onReady();
}
} else {//image already loaded...
onReady();
}
};
s.preloadImages = function () {
s.imagesToLoad = s.container.find('img');
function _onReady() {
if (typeof s === 'undefined' || s === null) return;
if (s.imagesLoaded !== undefined) s.imagesLoaded++;
if (s.imagesLoaded === s.imagesToLoad.length) {
if (s.params.updateOnImagesReady) s.update();
s.emit('onImagesReady', s);
}
}
for (var i = 0; i < s.imagesToLoad.length; i++) {
s.loadImage(s.imagesToLoad[i], (s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src')), (s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset')), true, _onReady);
}
};
/*=========================
Autoplay
===========================*/
s.autoplayTimeoutId = undefined;
s.autoplaying = false;
s.autoplayPaused = false;
function autoplay() {
s.autoplayTimeoutId = setTimeout(function () {
if (s.params.loop) {
s.fixLoop();
s._slideNext();
s.emit('onAutoplay', s);
}
else {
if (!s.isEnd) {
s._slideNext();
s.emit('onAutoplay', s);
}
else {
if (!params.autoplayStopOnLast) {
s._slideTo(0);
s.emit('onAutoplay', s);
}
else {
s.stopAutoplay();
}
}
}
}, s.params.autoplay);
}
s.startAutoplay = function () {
if (typeof s.autoplayTimeoutId !== 'undefined') return false;
if (!s.params.autoplay) return false;
if (s.autoplaying) return false;
s.autoplaying = true;
s.emit('onAutoplayStart', s);
autoplay();
};
s.stopAutoplay = function (internal) {
if (!s.autoplayTimeoutId) return;
if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
s.autoplaying = false;
s.autoplayTimeoutId = undefined;
s.emit('onAutoplayStop', s);
};
s.pauseAutoplay = function (speed) {
if (s.autoplayPaused) return;
if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
s.autoplayPaused = true;
if (speed === 0) {
s.autoplayPaused = false;
autoplay();
}
else {
s.wrapper.transitionEnd(function () {
if (!s) return;
s.autoplayPaused = false;
if (!s.autoplaying) {
s.stopAutoplay();
}
else {
autoplay();
}
});
}
};
/*=========================
Min/Max Translate
===========================*/
s.minTranslate = function () {
return (-s.snapGrid[0]);
};
s.maxTranslate = function () {
return (-s.snapGrid[s.snapGrid.length - 1]);
};
/*=========================
Slider/slides sizes
===========================*/
s.updateAutoHeight = function () {
// Update Height
var slide = s.slides.eq(s.activeIndex)[0];
if (typeof slide !== 'undefined') {
var newHeight = slide.offsetHeight;
if (newHeight) s.wrapper.css('height', newHeight + 'px');
}
};
s.updateContainerSize = function () {
var width, height;
if (typeof s.params.width !== 'undefined') {
width = s.params.width;
}
else {
width = s.container[0].clientWidth;
}
if (typeof s.params.height !== 'undefined') {
height = s.params.height;
}
else {
height = s.container[0].clientHeight;
}
if (width === 0 && s.isHorizontal() || height === 0 && !s.isHorizontal()) {
return;
}
//Subtract paddings
width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);
height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);
// Store values
s.width = width;
s.height = height;
s.size = s.isHorizontal() ? s.width : s.height;
};
s.updateSlidesSize = function () {
s.slides = s.wrapper.children('.' + s.params.slideClass);
s.snapGrid = [];
s.slidesGrid = [];
s.slidesSizesGrid = [];
var spaceBetween = s.params.spaceBetween,
slidePosition = -s.params.slidesOffsetBefore,
i,
prevSlideSize = 0,
index = 0;
if (typeof s.size === 'undefined') return;
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
}
s.virtualSize = -spaceBetween;
// reset margins
if (s.rtl) s.slides.css({marginLeft: '', marginTop: ''});
else s.slides.css({marginRight: '', marginBottom: ''});
var slidesNumberEvenToRows;
if (s.params.slidesPerColumn > 1) {
if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {
slidesNumberEvenToRows = s.slides.length;
}
else {
slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;
}
if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {
slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);
}
}
// Calc slides
var slideSize;
var slidesPerColumn = s.params.slidesPerColumn;
var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);
for (i = 0; i < s.slides.length; i++) {
slideSize = 0;
var slide = s.slides.eq(i);
if (s.params.slidesPerColumn > 1) {
// Set slides order
var newSlideOrderIndex;
var column, row;
if (s.params.slidesPerColumnFill === 'column') {
column = Math.floor(i / slidesPerColumn);
row = i - column * slidesPerColumn;
if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn-1)) {
if (++row >= slidesPerColumn) {
row = 0;
column++;
}
}
newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
slide
.css({
'-webkit-box-ordinal-group': newSlideOrderIndex,
'-moz-box-ordinal-group': newSlideOrderIndex,
'-ms-flex-order': newSlideOrderIndex,
'-webkit-order': newSlideOrderIndex,
'order': newSlideOrderIndex
});
}
else {
row = Math.floor(i / slidesPerRow);
column = i - row * slidesPerRow;
}
slide
.css({
'margin-top': (row !== 0 && s.params.spaceBetween) && (s.params.spaceBetween + 'px')
})
.attr('data-swiper-column', column)
.attr('data-swiper-row', row);
}
if (slide.css('display') === 'none') continue;
if (s.params.slidesPerView === 'auto') {
slideSize = s.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
if (s.params.roundLengths) slideSize = round(slideSize);
}
else {
slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;
if (s.params.roundLengths) slideSize = round(slideSize);
if (s.isHorizontal()) {
s.slides[i].style.width = slideSize + 'px';
}
else {
s.slides[i].style.height = slideSize + 'px';
}
}
s.slides[i].swiperSlideSize = slideSize;
s.slidesSizesGrid.push(slideSize);
if (s.params.centeredSlides) {
slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
s.slidesGrid.push(slidePosition);
}
else {
if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
s.slidesGrid.push(slidePosition);
slidePosition = slidePosition + slideSize + spaceBetween;
}
s.virtualSize += slideSize + spaceBetween;
prevSlideSize = slideSize;
index ++;
}
s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;
var newSlidesGrid;
if (
s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {
s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
}
if (!s.support.flexbox || s.params.setWrapperSize) {
if (s.isHorizontal()) s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
else s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'});
}
if (s.params.slidesPerColumn > 1) {
s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;
s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;
s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
if (s.params.centeredSlides) {
newSlidesGrid = [];
for (i = 0; i < s.snapGrid.length; i++) {
if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);
}
s.snapGrid = newSlidesGrid;
}
}
// Remove last grid elements depending on width
if (!s.params.centeredSlides) {
newSlidesGrid = [];
for (i = 0; i < s.snapGrid.length; i++) {
if (s.snapGrid[i] <= s.virtualSize - s.size) {
newSlidesGrid.push(s.snapGrid[i]);
}
}
s.snapGrid = newSlidesGrid;
if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
s.snapGrid.push(s.virtualSize - s.size);
}
}
if (s.snapGrid.length === 0) s.snapGrid = [0];
if (s.params.spaceBetween !== 0) {
if (s.isHorizontal()) {
if (s.rtl) s.slides.css({marginLeft: spaceBetween + 'px'});
else s.slides.css({marginRight: spaceBetween + 'px'});
}
else s.slides.css({marginBottom: spaceBetween + 'px'});
}
if (s.params.watchSlidesProgress) {
s.updateSlidesOffset();
}
};
s.updateSlidesOffset = function () {
for (var i = 0; i < s.slides.length; i++) {
s.slides[i].swiperSlideOffset = s.isHorizontal() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;
}
};
/*=========================
Slider/slides progress
===========================*/
s.updateSlidesProgress = function (translate) {
if (typeof translate === 'undefined') {
translate = s.translate || 0;
}
if (s.slides.length === 0) return;
if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();
var offsetCenter = -translate;
if (s.rtl) offsetCenter = translate;
// Visible Slides
s.slides.removeClass(s.params.slideVisibleClass);
for (var i = 0; i < s.slides.length; i++) {
var slide = s.slides[i];
var slideProgress = (offsetCenter - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);
if (s.params.watchSlidesVisibility) {
var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
var slideAfter = slideBefore + s.slidesSizesGrid[i];
var isVisible =
(slideBefore >= 0 && slideBefore < s.size) ||
(slideAfter > 0 && slideAfter <= s.size) ||
(slideBefore <= 0 && slideAfter >= s.size);
if (isVisible) {
s.slides.eq(i).addClass(s.params.slideVisibleClass);
}
}
slide.progress = s.rtl ? -slideProgress : slideProgress;
}
};
s.updateProgress = function (translate) {
if (typeof translate === 'undefined') {
translate = s.translate || 0;
}
var translatesDiff = s.maxTranslate() - s.minTranslate();
var wasBeginning = s.isBeginning;
var wasEnd = s.isEnd;
if (translatesDiff === 0) {
s.progress = 0;
s.isBeginning = s.isEnd = true;
}
else {
s.progress = (translate - s.minTranslate()) / (translatesDiff);
s.isBeginning = s.progress <= 0;
s.isEnd = s.progress >= 1;
}
if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);
if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);
if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);
s.emit('onProgress', s, s.progress);
};
s.updateActiveIndex = function () {
var translate = s.rtl ? s.translate : -s.translate;
var newActiveIndex, i, snapIndex;
for (i = 0; i < s.slidesGrid.length; i ++) {
if (typeof s.slidesGrid[i + 1] !== 'undefined') {
if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {
newActiveIndex = i;
}
else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {
newActiveIndex = i + 1;
}
}
else {
if (translate >= s.slidesGrid[i]) {
newActiveIndex = i;
}
}
}
// Normalize slideIndex
if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;
// for (i = 0; i < s.slidesGrid.length; i++) {
// if (- translate >= s.slidesGrid[i]) {
// newActiveIndex = i;
// }
// }
snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);
if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;
if (newActiveIndex === s.activeIndex) {
return;
}
s.snapIndex = snapIndex;
s.previousIndex = s.activeIndex;
s.activeIndex = newActiveIndex;
s.updateClasses();
};
/*=========================
Classes
===========================*/
s.updateClasses = function () {
s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass);
var activeSlide = s.slides.eq(s.activeIndex);
// Active classes
activeSlide.addClass(s.params.slideActiveClass);
// Next Slide
var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
if (s.params.loop && nextSlide.length === 0) {
s.slides.eq(0).addClass(s.params.slideNextClass);
}
// Prev Slide
var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
if (s.params.loop && prevSlide.length === 0) {
s.slides.eq(-1).addClass(s.params.slidePrevClass);
}
// Pagination
if (s.paginationContainer && s.paginationContainer.length > 0) {
// Current/Total
var current,
total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
if (s.params.loop) {
current = Math.ceil((s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup);
if (current > s.slides.length - 1 - s.loopedSlides * 2) {
current = current - (s.slides.length - s.loopedSlides * 2);
}
if (current > total - 1) current = current - total;
if (current < 0 && s.params.paginationType !== 'bullets') current = total + current;
}
else {
if (typeof s.snapIndex !== 'undefined') {
current = s.snapIndex;
}
else {
current = s.activeIndex || 0;
}
}
// Types
if (s.params.paginationType === 'bullets' && s.bullets && s.bullets.length > 0) {
s.bullets.removeClass(s.params.bulletActiveClass);
if (s.paginationContainer.length > 1) {
s.bullets.each(function () {
if ($(this).index() === current) $(this).addClass(s.params.bulletActiveClass);
});
}
else {
s.bullets.eq(current).addClass(s.params.bulletActiveClass);
}
}
if (s.params.paginationType === 'fraction') {
s.paginationContainer.find('.' + s.params.paginationCurrentClass).text(current + 1);
s.paginationContainer.find('.' + s.params.paginationTotalClass).text(total);
}
if (s.params.paginationType === 'progress') {
var scale = (current + 1) / total,
scaleX = scale,
scaleY = 1;
if (!s.isHorizontal()) {
scaleY = scale;
scaleX = 1;
}
s.paginationContainer.find('.' + s.params.paginationProgressbarClass).transform('translate3d(0,0,0) scaleX(' + scaleX + ') scaleY(' + scaleY + ')').transition(s.params.speed);
}
if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
// Next/active buttons
if (!s.params.loop) {
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
if (s.isBeginning) {
s.prevButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
}
else {
s.prevButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
}
}
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
if (s.isEnd) {
s.nextButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
}
else {
s.nextButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
}
}
}
};
/*=========================
Pagination
===========================*/
s.updatePagination = function () {
if (!s.params.pagination) return;
if (s.paginationContainer && s.paginationContainer.length > 0) {
var paginationHTML = '';
if (s.params.paginationType === 'bullets') {
var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
for (var i = 0; i < numberOfBullets; i++) {
if (s.params.paginationBulletRender) {
paginationHTML += s.params.paginationBulletRender(i, s.params.bulletClass);
}
else {
paginationHTML += '<' + s.params.paginationElement+' class="' + s.params.bulletClass + '">' + s.params.paginationElement + '>';
}
}
s.paginationContainer.html(paginationHTML);
s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);
if (s.params.paginationClickable && s.params.a11y && s.a11y) {
s.a11y.initPagination();
}
}
if (s.params.paginationType === 'fraction') {
if (s.params.paginationFractionRender) {
paginationHTML = s.params.paginationFractionRender(s, s.params.paginationCurrentClass, s.params.paginationTotalClass);
}
else {
paginationHTML =
'' +
' / ' +
'';
}
s.paginationContainer.html(paginationHTML);
}
if (s.params.paginationType === 'progress') {
if (s.params.paginationProgressRender) {
paginationHTML = s.params.paginationProgressRender(s, s.params.paginationProgressbarClass);
}
else {
paginationHTML = '';
}
s.paginationContainer.html(paginationHTML);
}
if (s.params.paginationType !== 'custom') {
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
};
/*=========================
Common update method
===========================*/
s.update = function (updateTranslate) {
s.updateContainerSize();
s.updateSlidesSize();
s.updateProgress();
s.updatePagination();
s.updateClasses();
if (s.params.scrollbar && s.scrollbar) {
s.scrollbar.set();
}
function forceSetTranslate() {
newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
s.setWrapperTranslate(newTranslate);
s.updateActiveIndex();
s.updateClasses();
}
if (updateTranslate) {
var translated, newTranslate;
if (s.controller && s.controller.spline) {
s.controller.spline = undefined;
}
if (s.params.freeMode) {
forceSetTranslate();
if (s.params.autoHeight) {
s.updateAutoHeight();
}
}
else {
if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
translated = s.slideTo(s.slides.length - 1, 0, false, true);
}
else {
translated = s.slideTo(s.activeIndex, 0, false, true);
}
if (!translated) {
forceSetTranslate();
}
}
}
else if (s.params.autoHeight) {
s.updateAutoHeight();
}
};
/*=========================
Resize Handler
===========================*/
s.onResize = function (forceUpdatePagination) {
//Breakpoints
if (s.params.breakpoints) {
s.setBreakpoint();
}
// Disable locks on resize
var allowSwipeToPrev = s.params.allowSwipeToPrev;
var allowSwipeToNext = s.params.allowSwipeToNext;
s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;
s.updateContainerSize();
s.updateSlidesSize();
if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination) s.updatePagination();
if (s.params.scrollbar && s.scrollbar) {
s.scrollbar.set();
}
if (s.controller && s.controller.spline) {
s.controller.spline = undefined;
}
var slideChangedBySlideTo = false;
if (s.params.freeMode) {
var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
s.setWrapperTranslate(newTranslate);
s.updateActiveIndex();
s.updateClasses();
if (s.params.autoHeight) {
s.updateAutoHeight();
}
}
else {
s.updateClasses();
if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
}
else {
slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
}
}
if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
s.lazy.load();
}
// Return locks after resize
s.params.allowSwipeToPrev = allowSwipeToPrev;
s.params.allowSwipeToNext = allowSwipeToNext;
};
/*=========================
Events
===========================*/
//Define Touch Events
var desktopEvents = ['mousedown', 'mousemove', 'mouseup'];
if (window.navigator.pointerEnabled) desktopEvents = ['pointerdown', 'pointermove', 'pointerup'];
else if (window.navigator.msPointerEnabled) desktopEvents = ['MSPointerDown', 'MSPointerMove', 'MSPointerUp'];
s.touchEvents = {
start : s.support.touch || !s.params.simulateTouch ? 'touchstart' : desktopEvents[0],
move : s.support.touch || !s.params.simulateTouch ? 'touchmove' : desktopEvents[1],
end : s.support.touch || !s.params.simulateTouch ? 'touchend' : desktopEvents[2]
};
// WP8 Touch Events Fix
if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {
(s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);
}
// Attach/detach events
s.initEvents = function (detach) {
var actionDom = detach ? 'off' : 'on';
var action = detach ? 'removeEventListener' : 'addEventListener';
var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container[0] : s.wrapper[0];
var target = s.support.touch ? touchEventsTarget : document;
var moveCapture = s.params.nested ? true : false;
//Touch Events
if (s.browser.ie) {
touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
target[action](s.touchEvents.move, s.onTouchMove, moveCapture);
target[action](s.touchEvents.end, s.onTouchEnd, false);
}
else {
if (s.support.touch) {
touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);
touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, false);
}
if (params.simulateTouch && !s.device.ios && !s.device.android) {
touchEventsTarget[action]('mousedown', s.onTouchStart, false);
document[action]('mousemove', s.onTouchMove, moveCapture);
document[action]('mouseup', s.onTouchEnd, false);
}
}
window[action]('resize', s.onResize);
// Next, Prev, Index
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.nextButton[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.prevButton[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.pagination && s.params.paginationClickable) {
s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
}
// Prevent Links Clicks
if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
};
s.attachEvents = function () {
s.initEvents();
};
s.detachEvents = function () {
s.initEvents(true);
};
/*=========================
Handle Clicks
===========================*/
// Prevent Clicks
s.allowClick = true;
s.preventClicks = function (e) {
if (!s.allowClick) {
if (s.params.preventClicks) e.preventDefault();
if (s.params.preventClicksPropagation && s.animating) {
e.stopPropagation();
e.stopImmediatePropagation();
}
}
};
// Clicks
s.onClickNext = function (e) {
e.preventDefault();
if (s.isEnd && !s.params.loop) return;
s.slideNext();
};
s.onClickPrev = function (e) {
e.preventDefault();
if (s.isBeginning && !s.params.loop) return;
s.slidePrev();
};
s.onClickIndex = function (e) {
e.preventDefault();
var index = $(this).index() * s.params.slidesPerGroup;
if (s.params.loop) index = index + s.loopedSlides;
s.slideTo(index);
};
/*=========================
Handle Touches
===========================*/
function findElementInEvent(e, selector) {
var el = $(e.target);
if (!el.is(selector)) {
if (typeof selector === 'string') {
el = el.parents(selector);
}
else if (selector.nodeType) {
var found;
el.parents().each(function (index, _el) {
if (_el === selector) found = selector;
});
if (!found) return undefined;
else return selector;
}
}
if (el.length === 0) {
return undefined;
}
return el[0];
}
s.updateClickedSlide = function (e) {
var slide = findElementInEvent(e, '.' + s.params.slideClass);
var slideFound = false;
if (slide) {
for (var i = 0; i < s.slides.length; i++) {
if (s.slides[i] === slide) slideFound = true;
}
}
if (slide && slideFound) {
s.clickedSlide = slide;
s.clickedIndex = $(slide).index();
}
else {
s.clickedSlide = undefined;
s.clickedIndex = undefined;
return;
}
if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {
var slideToIndex = s.clickedIndex,
realIndex,
duplicatedSlides;
if (s.params.loop) {
if (s.animating) return;
realIndex = $(s.clickedSlide).attr('data-swiper-slide-index');
if (s.params.centeredSlides) {
if ((slideToIndex < s.loopedSlides - s.params.slidesPerView/2) || (slideToIndex > s.slides.length - s.loopedSlides + s.params.slidesPerView/2)) {
s.fixLoop();
slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.swiper-slide-duplicate)').eq(0).index();
setTimeout(function () {
s.slideTo(slideToIndex);
}, 0);
}
else {
s.slideTo(slideToIndex);
}
}
else {
if (slideToIndex > s.slides.length - s.params.slidesPerView) {
s.fixLoop();
slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.swiper-slide-duplicate)').eq(0).index();
setTimeout(function () {
s.slideTo(slideToIndex);
}, 0);
}
else {
s.slideTo(slideToIndex);
}
}
}
else {
s.slideTo(slideToIndex);
}
}
};
var isTouched,
isMoved,
allowTouchCallbacks,
touchStartTime,
isScrolling,
currentTranslate,
startTranslate,
allowThresholdMove,
// Form elements to match
formElements = 'input, select, textarea, button',
// Last click time
lastClickTime = Date.now(), clickTimeout,
//Velocities
velocities = [],
allowMomentumBounce;
// Animating Flag
s.animating = false;
// Touches information
s.touches = {
startX: 0,
startY: 0,
currentX: 0,
currentY: 0,
diff: 0
};
// Touch handlers
var isTouchEvent, startMoving;
s.onTouchStart = function (e) {
if (e.originalEvent) e = e.originalEvent;
isTouchEvent = e.type === 'touchstart';
if (!isTouchEvent && 'which' in e && e.which === 3) return;
if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {
s.allowClick = true;
return;
}
if (s.params.swipeHandler) {
if (!findElementInEvent(e, s.params.swipeHandler)) return;
}
var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
// Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
if(s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {
return;
}
isTouched = true;
isMoved = false;
allowTouchCallbacks = true;
isScrolling = undefined;
startMoving = undefined;
s.touches.startX = startX;
s.touches.startY = startY;
touchStartTime = Date.now();
s.allowClick = true;
s.updateContainerSize();
s.swipeDirection = undefined;
if (s.params.threshold > 0) allowThresholdMove = false;
if (e.type !== 'touchstart') {
var preventDefault = true;
if ($(e.target).is(formElements)) preventDefault = false;
if (document.activeElement && $(document.activeElement).is(formElements)) {
document.activeElement.blur();
}
if (preventDefault) {
e.preventDefault();
}
}
s.emit('onTouchStart', s, e);
};
s.onTouchMove = function (e) {
if (e.originalEvent) e = e.originalEvent;
if (isTouchEvent && e.type === 'mousemove') return;
if (e.preventedByNestedSwiper) {
s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
return;
}
if (s.params.onlyExternal) {
// isMoved = true;
s.allowClick = false;
if (isTouched) {
s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
touchStartTime = Date.now();
}
return;
}
if (isTouchEvent && document.activeElement) {
if (e.target === document.activeElement && $(e.target).is(formElements)) {
isMoved = true;
s.allowClick = false;
return;
}
}
if (allowTouchCallbacks) {
s.emit('onTouchMove', s, e);
}
if (e.targetTouches && e.targetTouches.length > 1) return;
s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
if (typeof isScrolling === 'undefined') {
var touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;
isScrolling = s.isHorizontal() ? touchAngle > s.params.touchAngle : (90 - touchAngle > s.params.touchAngle);
}
if (isScrolling) {
s.emit('onTouchMoveOpposite', s, e);
}
if (typeof startMoving === 'undefined' && s.browser.ieTouch) {
if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {
startMoving = true;
}
}
if (!isTouched) return;
if (isScrolling) {
isTouched = false;
return;
}
if (!startMoving && s.browser.ieTouch) {
return;
}
s.allowClick = false;
s.emit('onSliderMove', s, e);
e.preventDefault();
if (s.params.touchMoveStopPropagation && !s.params.nested) {
e.stopPropagation();
}
if (!isMoved) {
if (params.loop) {
s.fixLoop();
}
startTranslate = s.getWrapperTranslate();
s.setWrapperTransition(0);
if (s.animating) {
s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');
}
if (s.params.autoplay && s.autoplaying) {
if (s.params.autoplayDisableOnInteraction) {
s.stopAutoplay();
}
else {
s.pauseAutoplay();
}
}
allowMomentumBounce = false;
//Grab Cursor
if (s.params.grabCursor) {
s.container[0].style.cursor = 'move';
s.container[0].style.cursor = '-webkit-grabbing';
s.container[0].style.cursor = '-moz-grabbin';
s.container[0].style.cursor = 'grabbing';
}
}
isMoved = true;
var diff = s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
diff = diff * s.params.touchRatio;
if (s.rtl) diff = -diff;
s.swipeDirection = diff > 0 ? 'prev' : 'next';
currentTranslate = diff + startTranslate;
var disableParentSwiper = true;
if ((diff > 0 && currentTranslate > s.minTranslate())) {
disableParentSwiper = false;
if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);
}
else if (diff < 0 && currentTranslate < s.maxTranslate()) {
disableParentSwiper = false;
if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);
}
if (disableParentSwiper) {
e.preventedByNestedSwiper = true;
}
// Directions locks
if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {
currentTranslate = startTranslate;
}
if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {
currentTranslate = startTranslate;
}
if (!s.params.followFinger) return;
// Threshold
if (s.params.threshold > 0) {
if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {
if (!allowThresholdMove) {
allowThresholdMove = true;
s.touches.startX = s.touches.currentX;
s.touches.startY = s.touches.currentY;
currentTranslate = startTranslate;
s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
return;
}
}
else {
currentTranslate = startTranslate;
return;
}
}
// Update active index in free mode
if (s.params.freeMode || s.params.watchSlidesProgress) {
s.updateActiveIndex();
}
if (s.params.freeMode) {
//Velocity
if (velocities.length === 0) {
velocities.push({
position: s.touches[s.isHorizontal() ? 'startX' : 'startY'],
time: touchStartTime
});
}
velocities.push({
position: s.touches[s.isHorizontal() ? 'currentX' : 'currentY'],
time: (new window.Date()).getTime()
});
}
// Update progress
s.updateProgress(currentTranslate);
// Update translate
s.setWrapperTranslate(currentTranslate);
};
s.onTouchEnd = function (e) {
if (e.originalEvent) e = e.originalEvent;
if (allowTouchCallbacks) {
s.emit('onTouchEnd', s, e);
}
allowTouchCallbacks = false;
if (!isTouched) return;
//Return Grab Cursor
if (s.params.grabCursor && isMoved && isTouched) {
s.container[0].style.cursor = 'move';
s.container[0].style.cursor = '-webkit-grab';
s.container[0].style.cursor = '-moz-grab';
s.container[0].style.cursor = 'grab';
}
// Time diff
var touchEndTime = Date.now();
var timeDiff = touchEndTime - touchStartTime;
// Tap, doubleTap, Click
if (s.allowClick) {
s.updateClickedSlide(e);
s.emit('onTap', s, e);
if (timeDiff < 300 && (touchEndTime - lastClickTime) > 300) {
if (clickTimeout) clearTimeout(clickTimeout);
clickTimeout = setTimeout(function () {
if (!s) return;
if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {
s.paginationContainer.toggleClass(s.params.paginationHiddenClass);
}
s.emit('onClick', s, e);
}, 300);
}
if (timeDiff < 300 && (touchEndTime - lastClickTime) < 300) {
if (clickTimeout) clearTimeout(clickTimeout);
s.emit('onDoubleTap', s, e);
}
}
lastClickTime = Date.now();
setTimeout(function () {
if (s) s.allowClick = true;
}, 0);
if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {
isTouched = isMoved = false;
return;
}
isTouched = isMoved = false;
var currentPos;
if (s.params.followFinger) {
currentPos = s.rtl ? s.translate : -s.translate;
}
else {
currentPos = -currentTranslate;
}
if (s.params.freeMode) {
if (currentPos < -s.minTranslate()) {
s.slideTo(s.activeIndex);
return;
}
else if (currentPos > -s.maxTranslate()) {
if (s.slides.length < s.snapGrid.length) {
s.slideTo(s.snapGrid.length - 1);
}
else {
s.slideTo(s.slides.length - 1);
}
return;
}
if (s.params.freeModeMomentum) {
if (velocities.length > 1) {
var lastMoveEvent = velocities.pop(), velocityEvent = velocities.pop();
var distance = lastMoveEvent.position - velocityEvent.position;
var time = lastMoveEvent.time - velocityEvent.time;
s.velocity = distance / time;
s.velocity = s.velocity / 2;
if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {
s.velocity = 0;
}
// this implies that the user stopped moving a finger then released.
// There would be no events with distance zero, so the last event is stale.
if (time > 150 || (new window.Date().getTime() - lastMoveEvent.time) > 300) {
s.velocity = 0;
}
} else {
s.velocity = 0;
}
velocities.length = 0;
var momentumDuration = 1000 * s.params.freeModeMomentumRatio;
var momentumDistance = s.velocity * momentumDuration;
var newPosition = s.translate + momentumDistance;
if (s.rtl) newPosition = - newPosition;
var doBounce = false;
var afterBouncePosition;
var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;
if (newPosition < s.maxTranslate()) {
if (s.params.freeModeMomentumBounce) {
if (newPosition + s.maxTranslate() < -bounceAmount) {
newPosition = s.maxTranslate() - bounceAmount;
}
afterBouncePosition = s.maxTranslate();
doBounce = true;
allowMomentumBounce = true;
}
else {
newPosition = s.maxTranslate();
}
}
else if (newPosition > s.minTranslate()) {
if (s.params.freeModeMomentumBounce) {
if (newPosition - s.minTranslate() > bounceAmount) {
newPosition = s.minTranslate() + bounceAmount;
}
afterBouncePosition = s.minTranslate();
doBounce = true;
allowMomentumBounce = true;
}
else {
newPosition = s.minTranslate();
}
}
else if (s.params.freeModeSticky) {
var j = 0,
nextSlide;
for (j = 0; j < s.snapGrid.length; j += 1) {
if (s.snapGrid[j] > -newPosition) {
nextSlide = j;
break;
}
}
if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {
newPosition = s.snapGrid[nextSlide];
} else {
newPosition = s.snapGrid[nextSlide - 1];
}
if (!s.rtl) newPosition = - newPosition;
}
//Fix duration
if (s.velocity !== 0) {
if (s.rtl) {
momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);
}
else {
momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
}
}
else if (s.params.freeModeSticky) {
s.slideReset();
return;
}
if (s.params.freeModeMomentumBounce && doBounce) {
s.updateProgress(afterBouncePosition);
s.setWrapperTransition(momentumDuration);
s.setWrapperTranslate(newPosition);
s.onTransitionStart();
s.animating = true;
s.wrapper.transitionEnd(function () {
if (!s || !allowMomentumBounce) return;
s.emit('onMomentumBounce', s);
s.setWrapperTransition(s.params.speed);
s.setWrapperTranslate(afterBouncePosition);
s.wrapper.transitionEnd(function () {
if (!s) return;
s.onTransitionEnd();
});
});
} else if (s.velocity) {
s.updateProgress(newPosition);
s.setWrapperTransition(momentumDuration);
s.setWrapperTranslate(newPosition);
s.onTransitionStart();
if (!s.animating) {
s.animating = true;
s.wrapper.transitionEnd(function () {
if (!s) return;
s.onTransitionEnd();
});
}
} else {
s.updateProgress(newPosition);
}
s.updateActiveIndex();
}
if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {
s.updateProgress();
s.updateActiveIndex();
}
return;
}
// Find current slide
var i, stopIndex = 0, groupSize = s.slidesSizesGrid[0];
for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {
if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {
if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {
stopIndex = i;
groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];
}
}
else {
if (currentPos >= s.slidesGrid[i]) {
stopIndex = i;
groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];
}
}
}
// Find current slide size
var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;
if (timeDiff > s.params.longSwipesMs) {
// Long touches
if (!s.params.longSwipes) {
s.slideTo(s.activeIndex);
return;
}
if (s.swipeDirection === 'next') {
if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);
else s.slideTo(stopIndex);
}
if (s.swipeDirection === 'prev') {
if (ratio > (1 - s.params.longSwipesRatio)) s.slideTo(stopIndex + s.params.slidesPerGroup);
else s.slideTo(stopIndex);
}
}
else {
// Short swipes
if (!s.params.shortSwipes) {
s.slideTo(s.activeIndex);
return;
}
if (s.swipeDirection === 'next') {
s.slideTo(stopIndex + s.params.slidesPerGroup);
}
if (s.swipeDirection === 'prev') {
s.slideTo(stopIndex);
}
}
};
/*=========================
Transitions
===========================*/
s._slideTo = function (slideIndex, speed) {
return s.slideTo(slideIndex, speed, true, true);
};
s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
if (typeof runCallbacks === 'undefined') runCallbacks = true;
if (typeof slideIndex === 'undefined') slideIndex = 0;
if (slideIndex < 0) slideIndex = 0;
s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);
if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;
var translate = - s.snapGrid[s.snapIndex];
// Stop autoplay
if (s.params.autoplay && s.autoplaying) {
if (internal || !s.params.autoplayDisableOnInteraction) {
s.pauseAutoplay(speed);
}
else {
s.stopAutoplay();
}
}
// Update progress
s.updateProgress(translate);
// Normalize slideIndex
for (var i = 0; i < s.slidesGrid.length; i++) {
if (- Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {
slideIndex = i;
}
}
// Directions locks
if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {
return false;
}
if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {
if ((s.activeIndex || 0) !== slideIndex ) return false;
}
// Update Index
if (typeof speed === 'undefined') speed = s.params.speed;
s.previousIndex = s.activeIndex || 0;
s.activeIndex = slideIndex;
if ((s.rtl && -translate === s.translate) || (!s.rtl && translate === s.translate)) {
// Update Height
if (s.params.autoHeight) {
s.updateAutoHeight();
}
s.updateClasses();
if (s.params.effect !== 'slide') {
s.setWrapperTranslate(translate);
}
return false;
}
s.updateClasses();
s.onTransitionStart(runCallbacks);
if (speed === 0) {
s.setWrapperTranslate(translate);
s.setWrapperTransition(0);
s.onTransitionEnd(runCallbacks);
}
else {
s.setWrapperTranslate(translate);
s.setWrapperTransition(speed);
if (!s.animating) {
s.animating = true;
s.wrapper.transitionEnd(function () {
if (!s) return;
s.onTransitionEnd(runCallbacks);
});
}
}
return true;
};
s.onTransitionStart = function (runCallbacks) {
if (typeof runCallbacks === 'undefined') runCallbacks = true;
if (s.params.autoHeight) {
s.updateAutoHeight();
}
if (s.lazy) s.lazy.onTransitionStart();
if (runCallbacks) {
s.emit('onTransitionStart', s);
if (s.activeIndex !== s.previousIndex) {
s.emit('onSlideChangeStart', s);
if (s.activeIndex > s.previousIndex) {
s.emit('onSlideNextStart', s);
}
else {
s.emit('onSlidePrevStart', s);
}
}
}
};
s.onTransitionEnd = function (runCallbacks) {
s.animating = false;
s.setWrapperTransition(0);
if (typeof runCallbacks === 'undefined') runCallbacks = true;
if (s.lazy) s.lazy.onTransitionEnd();
if (runCallbacks) {
s.emit('onTransitionEnd', s);
if (s.activeIndex !== s.previousIndex) {
s.emit('onSlideChangeEnd', s);
if (s.activeIndex > s.previousIndex) {
s.emit('onSlideNextEnd', s);
}
else {
s.emit('onSlidePrevEnd', s);
}
}
}
if (s.params.hashnav && s.hashnav) {
s.hashnav.setHash();
}
};
s.slideNext = function (runCallbacks, speed, internal) {
if (s.params.loop) {
if (s.animating) return false;
s.fixLoop();
var clientLeft = s.container[0].clientLeft;
return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
}
else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
};
s._slideNext = function (speed) {
return s.slideNext(true, speed, true);
};
s.slidePrev = function (runCallbacks, speed, internal) {
if (s.params.loop) {
if (s.animating) return false;
s.fixLoop();
var clientLeft = s.container[0].clientLeft;
return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
}
else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
};
s._slidePrev = function (speed) {
return s.slidePrev(true, speed, true);
};
s.slideReset = function (runCallbacks, speed, internal) {
return s.slideTo(s.activeIndex, speed, runCallbacks);
};
/*=========================
Translate/transition helpers
===========================*/
s.setWrapperTransition = function (duration, byController) {
s.wrapper.transition(duration);
if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
s.effects[s.params.effect].setTransition(duration);
}
if (s.params.parallax && s.parallax) {
s.parallax.setTransition(duration);
}
if (s.params.scrollbar && s.scrollbar) {
s.scrollbar.setTransition(duration);
}
if (s.params.control && s.controller) {
s.controller.setTransition(duration, byController);
}
s.emit('onSetTransition', s, duration);
};
s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {
var x = 0, y = 0, z = 0;
if (s.isHorizontal()) {
x = s.rtl ? -translate : translate;
}
else {
y = translate;
}
if (s.params.roundLengths) {
x = round(x);
y = round(y);
}
if (!s.params.virtualTranslate) {
if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');
else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');
}
s.translate = s.isHorizontal() ? x : y;
// Check if we need to update progress
var progress;
var translatesDiff = s.maxTranslate() - s.minTranslate();
if (translatesDiff === 0) {
progress = 0;
}
else {
progress = (translate - s.minTranslate()) / (translatesDiff);
}
if (progress !== s.progress) {
s.updateProgress(translate);
}
if (updateActiveIndex) s.updateActiveIndex();
if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
s.effects[s.params.effect].setTranslate(s.translate);
}
if (s.params.parallax && s.parallax) {
s.parallax.setTranslate(s.translate);
}
if (s.params.scrollbar && s.scrollbar) {
s.scrollbar.setTranslate(s.translate);
}
if (s.params.control && s.controller) {
s.controller.setTranslate(s.translate, byController);
}
s.emit('onSetTranslate', s, s.translate);
};
s.getTranslate = function (el, axis) {
var matrix, curTransform, curStyle, transformMatrix;
// automatic axis detection
if (typeof axis === 'undefined') {
axis = 'x';
}
if (s.params.virtualTranslate) {
return s.rtl ? -s.translate : s.translate;
}
curStyle = window.getComputedStyle(el, null);
if (window.WebKitCSSMatrix) {
curTransform = curStyle.transform || curStyle.webkitTransform;
if (curTransform.split(',').length > 6) {
curTransform = curTransform.split(', ').map(function(a){
return a.replace(',','.');
}).join(', ');
}
// Some old versions of Webkit choke when 'none' is passed; pass
// empty string instead in this case
transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
}
else {
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
matrix = transformMatrix.toString().split(',');
}
if (axis === 'x') {
//Latest Chrome and webkits Fix
if (window.WebKitCSSMatrix)
curTransform = transformMatrix.m41;
//Crazy IE10 Matrix
else if (matrix.length === 16)
curTransform = parseFloat(matrix[12]);
//Normal Browsers
else
curTransform = parseFloat(matrix[4]);
}
if (axis === 'y') {
//Latest Chrome and webkits Fix
if (window.WebKitCSSMatrix)
curTransform = transformMatrix.m42;
//Crazy IE10 Matrix
else if (matrix.length === 16)
curTransform = parseFloat(matrix[13]);
//Normal Browsers
else
curTransform = parseFloat(matrix[5]);
}
if (s.rtl && curTransform) curTransform = -curTransform;
return curTransform || 0;
};
s.getWrapperTranslate = function (axis) {
if (typeof axis === 'undefined') {
axis = s.isHorizontal() ? 'x' : 'y';
}
return s.getTranslate(s.wrapper[0], axis);
};
/*=========================
Observer
===========================*/
s.observers = [];
function initObserver(target, options) {
options = options || {};
// create an observer instance
var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
var observer = new ObserverFunc(function (mutations) {
mutations.forEach(function (mutation) {
s.onResize(true);
s.emit('onObserverUpdate', s, mutation);
});
});
observer.observe(target, {
attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
childList: typeof options.childList === 'undefined' ? true : options.childList,
characterData: typeof options.characterData === 'undefined' ? true : options.characterData
});
s.observers.push(observer);
}
s.initObservers = function () {
if (s.params.observeParents) {
var containerParents = s.container.parents();
for (var i = 0; i < containerParents.length; i++) {
initObserver(containerParents[i]);
}
}
// Observe container
initObserver(s.container[0], {childList: false});
// Observe wrapper
initObserver(s.wrapper[0], {attributes: false});
};
s.disconnectObservers = function () {
for (var i = 0; i < s.observers.length; i++) {
s.observers[i].disconnect();
}
s.observers = [];
};
/*=========================
Loop
===========================*/
// Create looped slides
s.createLoop = function () {
// Remove duplicated slides
s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
var slides = s.wrapper.children('.' + s.params.slideClass);
if(s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length;
s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);
s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;
if (s.loopedSlides > slides.length) {
s.loopedSlides = slides.length;
}
var prependSlides = [], appendSlides = [], i;
slides.each(function (index, el) {
var slide = $(this);
if (index < s.loopedSlides) appendSlides.push(el);
if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);
slide.attr('data-swiper-slide-index', index);
});
for (i = 0; i < appendSlides.length; i++) {
s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
}
for (i = prependSlides.length - 1; i >= 0; i--) {
s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
}
};
s.destroyLoop = function () {
s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
s.slides.removeAttr('data-swiper-slide-index');
};
s.reLoop = function (updatePosition) {
var oldIndex = s.activeIndex - s.loopedSlides;
s.destroyLoop();
s.createLoop();
s.updateSlidesSize();
if (updatePosition) {
s.slideTo(oldIndex + s.loopedSlides, 0, false);
}
};
s.fixLoop = function () {
var newIndex;
//Fix For Negative Oversliding
if (s.activeIndex < s.loopedSlides) {
newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;
newIndex = newIndex + s.loopedSlides;
s.slideTo(newIndex, 0, false, true);
}
//Fix For Positive Oversliding
else if ((s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2) || (s.activeIndex > s.slides.length - s.params.slidesPerView * 2)) {
newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;
newIndex = newIndex + s.loopedSlides;
s.slideTo(newIndex, 0, false, true);
}
};
/*=========================
Append/Prepend/Remove Slides
===========================*/
s.appendSlide = function (slides) {
if (s.params.loop) {
s.destroyLoop();
}
if (typeof slides === 'object' && slides.length) {
for (var i = 0; i < slides.length; i++) {
if (slides[i]) s.wrapper.append(slides[i]);
}
}
else {
s.wrapper.append(slides);
}
if (s.params.loop) {
s.createLoop();
}
if (!(s.params.observer && s.support.observer)) {
s.update(true);
}
};
s.prependSlide = function (slides) {
if (s.params.loop) {
s.destroyLoop();
}
var newActiveIndex = s.activeIndex + 1;
if (typeof slides === 'object' && slides.length) {
for (var i = 0; i < slides.length; i++) {
if (slides[i]) s.wrapper.prepend(slides[i]);
}
newActiveIndex = s.activeIndex + slides.length;
}
else {
s.wrapper.prepend(slides);
}
if (s.params.loop) {
s.createLoop();
}
if (!(s.params.observer && s.support.observer)) {
s.update(true);
}
s.slideTo(newActiveIndex, 0, false);
};
s.removeSlide = function (slidesIndexes) {
if (s.params.loop) {
s.destroyLoop();
s.slides = s.wrapper.children('.' + s.params.slideClass);
}
var newActiveIndex = s.activeIndex,
indexToRemove;
if (typeof slidesIndexes === 'object' && slidesIndexes.length) {
for (var i = 0; i < slidesIndexes.length; i++) {
indexToRemove = slidesIndexes[i];
if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
if (indexToRemove < newActiveIndex) newActiveIndex--;
}
newActiveIndex = Math.max(newActiveIndex, 0);
}
else {
indexToRemove = slidesIndexes;
if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
if (indexToRemove < newActiveIndex) newActiveIndex--;
newActiveIndex = Math.max(newActiveIndex, 0);
}
if (s.params.loop) {
s.createLoop();
}
if (!(s.params.observer && s.support.observer)) {
s.update(true);
}
if (s.params.loop) {
s.slideTo(newActiveIndex + s.loopedSlides, 0, false);
}
else {
s.slideTo(newActiveIndex, 0, false);
}
};
s.removeAllSlides = function () {
var slidesIndexes = [];
for (var i = 0; i < s.slides.length; i++) {
slidesIndexes.push(i);
}
s.removeSlide(slidesIndexes);
};
/*=========================
Effects
===========================*/
s.effects = {
fade: {
setTranslate: function () {
for (var i = 0; i < s.slides.length; i++) {
var slide = s.slides.eq(i);
var offset = slide[0].swiperSlideOffset;
var tx = -offset;
if (!s.params.virtualTranslate) tx = tx - s.translate;
var ty = 0;
if (!s.isHorizontal()) {
ty = tx;
tx = 0;
}
var slideOpacity = s.params.fade.crossFade ?
Math.max(1 - Math.abs(slide[0].progress), 0) :
1 + Math.min(Math.max(slide[0].progress, -1), 0);
slide
.css({
opacity: slideOpacity
})
.transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');
}
},
setTransition: function (duration) {
s.slides.transition(duration);
if (s.params.virtualTranslate && duration !== 0) {
var eventTriggered = false;
s.slides.transitionEnd(function () {
if (eventTriggered) return;
if (!s) return;
eventTriggered = true;
s.animating = false;
var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
for (var i = 0; i < triggerEvents.length; i++) {
s.wrapper.trigger(triggerEvents[i]);
}
});
}
}
},
flip: {
setTranslate: function () {
for (var i = 0; i < s.slides.length; i++) {
var slide = s.slides.eq(i);
var progress = slide[0].progress;
if (s.params.flip.limitRotation) {
progress = Math.max(Math.min(slide[0].progress, 1), -1);
}
var offset = slide[0].swiperSlideOffset;
var rotate = -180 * progress,
rotateY = rotate,
rotateX = 0,
tx = -offset,
ty = 0;
if (!s.isHorizontal()) {
ty = tx;
tx = 0;
rotateX = -rotateY;
rotateY = 0;
}
else if (s.rtl) {
rotateY = -rotateY;
}
slide[0].style.zIndex = -Math.abs(Math.round(progress)) + s.slides.length;
if (s.params.flip.slideShadows) {
//Set shadows
var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = $('
');
slide.append(shadowBefore);
}
if (shadowAfter.length === 0) {
shadowAfter = $('
');
slide.append(shadowAfter);
}
if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
}
slide
.transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');
}
},
setTransition: function (duration) {
s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
if (s.params.virtualTranslate && duration !== 0) {
var eventTriggered = false;
s.slides.eq(s.activeIndex).transitionEnd(function () {
if (eventTriggered) return;
if (!s) return;
if (!$(this).hasClass(s.params.slideActiveClass)) return;
eventTriggered = true;
s.animating = false;
var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
for (var i = 0; i < triggerEvents.length; i++) {
s.wrapper.trigger(triggerEvents[i]);
}
});
}
}
},
cube: {
setTranslate: function () {
var wrapperRotate = 0, cubeShadow;
if (s.params.cube.shadow) {
if (s.isHorizontal()) {
cubeShadow = s.wrapper.find('.swiper-cube-shadow');
if (cubeShadow.length === 0) {
cubeShadow = $('
');
s.wrapper.append(cubeShadow);
}
cubeShadow.css({height: s.width + 'px'});
}
else {
cubeShadow = s.container.find('.swiper-cube-shadow');
if (cubeShadow.length === 0) {
cubeShadow = $('
');
s.container.append(cubeShadow);
}
}
}
for (var i = 0; i < s.slides.length; i++) {
var slide = s.slides.eq(i);
var slideAngle = i * 90;
var round = Math.floor(slideAngle / 360);
if (s.rtl) {
slideAngle = -slideAngle;
round = Math.floor(-slideAngle / 360);
}
var progress = Math.max(Math.min(slide[0].progress, 1), -1);
var tx = 0, ty = 0, tz = 0;
if (i % 4 === 0) {
tx = - round * 4 * s.size;
tz = 0;
}
else if ((i - 1) % 4 === 0) {
tx = 0;
tz = - round * 4 * s.size;
}
else if ((i - 2) % 4 === 0) {
tx = s.size + round * 4 * s.size;
tz = s.size;
}
else if ((i - 3) % 4 === 0) {
tx = - s.size;
tz = 3 * s.size + s.size * 4 * round;
}
if (s.rtl) {
tx = -tx;
}
if (!s.isHorizontal()) {
ty = tx;
tx = 0;
}
var transform = 'rotateX(' + (s.isHorizontal() ? 0 : -slideAngle) + 'deg) rotateY(' + (s.isHorizontal() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
if (progress <= 1 && progress > -1) {
wrapperRotate = i * 90 + progress * 90;
if (s.rtl) wrapperRotate = -i * 90 - progress * 90;
}
slide.transform(transform);
if (s.params.cube.slideShadows) {
//Set shadows
var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = $('
');
slide.append(shadowBefore);
}
if (shadowAfter.length === 0) {
shadowAfter = $('
');
slide.append(shadowAfter);
}
if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
}
}
s.wrapper.css({
'-webkit-transform-origin': '50% 50% -' + (s.size / 2) + 'px',
'-moz-transform-origin': '50% 50% -' + (s.size / 2) + 'px',
'-ms-transform-origin': '50% 50% -' + (s.size / 2) + 'px',
'transform-origin': '50% 50% -' + (s.size / 2) + 'px'
});
if (s.params.cube.shadow) {
if (s.isHorizontal()) {
cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + (-s.width / 2) + 'px) rotateX(90deg) rotateZ(0deg) scale(' + (s.params.cube.shadowScale) + ')');
}
else {
var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
var scale1 = s.params.cube.shadowScale,
scale2 = s.params.cube.shadowScale / multiplier,
offset = s.params.cube.shadowOffset;
cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + (-s.height / 2 / scale2) + 'px) rotateX(-90deg)');
}
}
var zFactor = (s.isSafari || s.isUiWebView) ? (-s.size / 2) : 0;
s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (s.isHorizontal() ? 0 : wrapperRotate) + 'deg) rotateY(' + (s.isHorizontal() ? -wrapperRotate : 0) + 'deg)');
},
setTransition: function (duration) {
s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
if (s.params.cube.shadow && !s.isHorizontal()) {
s.container.find('.swiper-cube-shadow').transition(duration);
}
}
},
coverflow: {
setTranslate: function () {
var transform = s.translate;
var center = s.isHorizontal() ? -transform + s.width / 2 : -transform + s.height / 2;
var rotate = s.isHorizontal() ? s.params.coverflow.rotate: -s.params.coverflow.rotate;
var translate = s.params.coverflow.depth;
//Each slide offset from center
for (var i = 0, length = s.slides.length; i < length; i++) {
var slide = s.slides.eq(i);
var slideSize = s.slidesSizesGrid[i];
var slideOffset = slide[0].swiperSlideOffset;
var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;
var rotateY = s.isHorizontal() ? rotate * offsetMultiplier : 0;
var rotateX = s.isHorizontal() ? 0 : rotate * offsetMultiplier;
// var rotateZ = 0
var translateZ = -translate * Math.abs(offsetMultiplier);
var translateY = s.isHorizontal() ? 0 : s.params.coverflow.stretch * (offsetMultiplier);
var translateX = s.isHorizontal() ? s.params.coverflow.stretch * (offsetMultiplier) : 0;
//Fix for ultra small values
if (Math.abs(translateX) < 0.001) translateX = 0;
if (Math.abs(translateY) < 0.001) translateY = 0;
if (Math.abs(translateZ) < 0.001) translateZ = 0;
if (Math.abs(rotateY) < 0.001) rotateY = 0;
if (Math.abs(rotateX) < 0.001) rotateX = 0;
var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';
slide.transform(slideTransform);
slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
if (s.params.coverflow.slideShadows) {
//Set shadows
var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = $('
');
slide.append(shadowBefore);
}
if (shadowAfter.length === 0) {
shadowAfter = $('
');
slide.append(shadowAfter);
}
if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
if (shadowAfter.length) shadowAfter[0].style.opacity = (-offsetMultiplier) > 0 ? -offsetMultiplier : 0;
}
}
//Set correct perspective for IE10
if (s.browser.ie) {
var ws = s.wrapper[0].style;
ws.perspectiveOrigin = center + 'px 50%';
}
},
setTransition: function (duration) {
s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
}
}
};
/*=========================
Images Lazy Loading
===========================*/
s.lazy = {
initialImageLoaded: false,
loadImageInSlide: function (index, loadInDuplicate) {
if (typeof index === 'undefined') return;
if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true;
if (s.slides.length === 0) return;
var slide = s.slides.eq(index);
var img = slide.find('.swiper-lazy:not(.swiper-lazy-loaded):not(.swiper-lazy-loading)');
if (slide.hasClass('swiper-lazy') && !slide.hasClass('swiper-lazy-loaded') && !slide.hasClass('swiper-lazy-loading')) {
img = img.add(slide[0]);
}
if (img.length === 0) return;
img.each(function () {
var _img = $(this);
_img.addClass('swiper-lazy-loading');
var background = _img.attr('data-background');
var src = _img.attr('data-src'),
srcset = _img.attr('data-srcset');
s.loadImage(_img[0], (src || background), srcset, false, function () {
if (background) {
_img.css('background-image', 'url("' + background + '")');
_img.removeAttr('data-background');
}
else {
if (srcset) {
_img.attr('srcset', srcset);
_img.removeAttr('data-srcset');
}
if (src) {
_img.attr('src', src);
_img.removeAttr('data-src');
}
}
_img.addClass('swiper-lazy-loaded').removeClass('swiper-lazy-loading');
slide.find('.swiper-lazy-preloader, .preloader').remove();
if (s.params.loop && loadInDuplicate) {
var slideOriginalIndex = slide.attr('data-swiper-slide-index');
if (slide.hasClass(s.params.slideDuplicateClass)) {
var originalSlide = s.wrapper.children('[data-swiper-slide-index="' + slideOriginalIndex + '"]:not(.' + s.params.slideDuplicateClass + ')');
s.lazy.loadImageInSlide(originalSlide.index(), false);
}
else {
var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + slideOriginalIndex + '"]');
s.lazy.loadImageInSlide(duplicatedSlide.index(), false);
}
}
s.emit('onLazyImageReady', s, slide[0], _img[0]);
});
s.emit('onLazyImageLoad', s, slide[0], _img[0]);
});
},
load: function () {
var i;
if (s.params.watchSlidesVisibility) {
s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {
s.lazy.loadImageInSlide($(this).index());
});
}
else {
if (s.params.slidesPerView > 1) {
for (i = s.activeIndex; i < s.activeIndex + s.params.slidesPerView ; i++) {
if (s.slides[i]) s.lazy.loadImageInSlide(i);
}
}
else {
s.lazy.loadImageInSlide(s.activeIndex);
}
}
if (s.params.lazyLoadingInPrevNext) {
if (s.params.slidesPerView > 1 || (s.params.lazyLoadingInPrevNextAmount && s.params.lazyLoadingInPrevNextAmount > 1)) {
var amount = s.params.lazyLoadingInPrevNextAmount;
var spv = s.params.slidesPerView;
var maxIndex = Math.min(s.activeIndex + spv + Math.max(amount, spv), s.slides.length);
var minIndex = Math.max(s.activeIndex - Math.max(spv, amount), 0);
// Next Slides
for (i = s.activeIndex + s.params.slidesPerView; i < maxIndex; i++) {
if (s.slides[i]) s.lazy.loadImageInSlide(i);
}
// Prev Slides
for (i = minIndex; i < s.activeIndex ; i++) {
if (s.slides[i]) s.lazy.loadImageInSlide(i);
}
}
else {
var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);
if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());
var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);
if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());
}
}
},
onTransitionStart: function () {
if (s.params.lazyLoading) {
if (s.params.lazyLoadingOnTransitionStart || (!s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded)) {
s.lazy.load();
}
}
},
onTransitionEnd: function () {
if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {
s.lazy.load();
}
}
};
/*=========================
Scrollbar
===========================*/
s.scrollbar = {
isTouched: false,
setDragPosition: function (e) {
var sb = s.scrollbar;
var x = 0, y = 0;
var translate;
var pointerPosition = s.isHorizontal() ?
((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageX : e.pageX || e.clientX) :
((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageY : e.pageY || e.clientY) ;
var position = (pointerPosition) - sb.track.offset()[s.isHorizontal() ? 'left' : 'top'] - sb.dragSize / 2;
var positionMin = -s.minTranslate() * sb.moveDivider;
var positionMax = -s.maxTranslate() * sb.moveDivider;
if (position < positionMin) {
position = positionMin;
}
else if (position > positionMax) {
position = positionMax;
}
position = -position / sb.moveDivider;
s.updateProgress(position);
s.setWrapperTranslate(position, true);
},
dragStart: function (e) {
var sb = s.scrollbar;
sb.isTouched = true;
e.preventDefault();
e.stopPropagation();
sb.setDragPosition(e);
clearTimeout(sb.dragTimeout);
sb.track.transition(0);
if (s.params.scrollbarHide) {
sb.track.css('opacity', 1);
}
s.wrapper.transition(100);
sb.drag.transition(100);
s.emit('onScrollbarDragStart', s);
},
dragMove: function (e) {
var sb = s.scrollbar;
if (!sb.isTouched) return;
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
sb.setDragPosition(e);
s.wrapper.transition(0);
sb.track.transition(0);
sb.drag.transition(0);
s.emit('onScrollbarDragMove', s);
},
dragEnd: function (e) {
var sb = s.scrollbar;
if (!sb.isTouched) return;
sb.isTouched = false;
if (s.params.scrollbarHide) {
clearTimeout(sb.dragTimeout);
sb.dragTimeout = setTimeout(function () {
sb.track.css('opacity', 0);
sb.track.transition(400);
}, 1000);
}
s.emit('onScrollbarDragEnd', s);
if (s.params.scrollbarSnapOnRelease) {
s.slideReset();
}
},
enableDraggable: function () {
var sb = s.scrollbar;
var target = s.support.touch ? sb.track : document;
$(sb.track).on(s.touchEvents.start, sb.dragStart);
$(target).on(s.touchEvents.move, sb.dragMove);
$(target).on(s.touchEvents.end, sb.dragEnd);
},
disableDraggable: function () {
var sb = s.scrollbar;
var target = s.support.touch ? sb.track : document;
$(sb.track).off(s.touchEvents.start, sb.dragStart);
$(target).off(s.touchEvents.move, sb.dragMove);
$(target).off(s.touchEvents.end, sb.dragEnd);
},
set: function () {
if (!s.params.scrollbar) return;
var sb = s.scrollbar;
sb.track = $(s.params.scrollbar);
if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
sb.track = s.container.find(s.params.scrollbar);
}
sb.drag = sb.track.find('.swiper-scrollbar-drag');
if (sb.drag.length === 0) {
sb.drag = $('
');
sb.track.append(sb.drag);
}
sb.drag[0].style.width = '';
sb.drag[0].style.height = '';
sb.trackSize = s.isHorizontal() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;
sb.divider = s.size / s.virtualSize;
sb.moveDivider = sb.divider * (sb.trackSize / s.size);
sb.dragSize = sb.trackSize * sb.divider;
if (s.isHorizontal()) {
sb.drag[0].style.width = sb.dragSize + 'px';
}
else {
sb.drag[0].style.height = sb.dragSize + 'px';
}
if (sb.divider >= 1) {
sb.track[0].style.display = 'none';
}
else {
sb.track[0].style.display = '';
}
if (s.params.scrollbarHide) {
sb.track[0].style.opacity = 0;
}
},
setTranslate: function () {
if (!s.params.scrollbar) return;
var diff;
var sb = s.scrollbar;
var translate = s.translate || 0;
var newPos;
var newSize = sb.dragSize;
newPos = (sb.trackSize - sb.dragSize) * s.progress;
if (s.rtl && s.isHorizontal()) {
newPos = -newPos;
if (newPos > 0) {
newSize = sb.dragSize - newPos;
newPos = 0;
}
else if (-newPos + sb.dragSize > sb.trackSize) {
newSize = sb.trackSize + newPos;
}
}
else {
if (newPos < 0) {
newSize = sb.dragSize + newPos;
newPos = 0;
}
else if (newPos + sb.dragSize > sb.trackSize) {
newSize = sb.trackSize - newPos;
}
}
if (s.isHorizontal()) {
if (s.support.transforms3d) {
sb.drag.transform('translate3d(' + (newPos) + 'px, 0, 0)');
}
else {
sb.drag.transform('translateX(' + (newPos) + 'px)');
}
sb.drag[0].style.width = newSize + 'px';
}
else {
if (s.support.transforms3d) {
sb.drag.transform('translate3d(0px, ' + (newPos) + 'px, 0)');
}
else {
sb.drag.transform('translateY(' + (newPos) + 'px)');
}
sb.drag[0].style.height = newSize + 'px';
}
if (s.params.scrollbarHide) {
clearTimeout(sb.timeout);
sb.track[0].style.opacity = 1;
sb.timeout = setTimeout(function () {
sb.track[0].style.opacity = 0;
sb.track.transition(400);
}, 1000);
}
},
setTransition: function (duration) {
if (!s.params.scrollbar) return;
s.scrollbar.drag.transition(duration);
}
};
/*=========================
Controller
===========================*/
s.controller = {
LinearSpline: function (x, y) {
this.x = x;
this.y = y;
this.lastIndex = x.length - 1;
// Given an x value (x2), return the expected y2 value:
// (x1,y1) is the known point before given value,
// (x3,y3) is the known point after given value.
var i1, i3;
var l = this.x.length;
this.interpolate = function (x2) {
if (!x2) return 0;
// Get the indexes of x1 and x3 (the array indexes before and after given x2):
i3 = binarySearch(this.x, x2);
i1 = i3 - 1;
// We have our indexes i1 & i3, so we can calculate already:
// y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
return ((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1]) + this.y[i1];
};
var binarySearch = (function() {
var maxIndex, minIndex, guess;
return function(array, val) {
minIndex = -1;
maxIndex = array.length;
while (maxIndex - minIndex > 1)
if (array[guess = maxIndex + minIndex >> 1] <= val) {
minIndex = guess;
} else {
maxIndex = guess;
}
return maxIndex;
};
})();
},
//xxx: for now i will just save one spline function to to
getInterpolateFunction: function(c){
if(!s.controller.spline) s.controller.spline = s.params.loop ?
new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) :
new s.controller.LinearSpline(s.snapGrid, c.snapGrid);
},
setTranslate: function (translate, byController) {
var controlled = s.params.control;
var multiplier, controlledTranslate;
function setControlledTranslate(c) {
// this will create an Interpolate function based on the snapGrids
// x is the Grid of the scrolled scroller and y will be the controlled scroller
// it makes sense to create this only once and recall it for the interpolation
// the function does a lot of value caching for performance
translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate;
if (s.params.controlBy === 'slide') {
s.controller.getInterpolateFunction(c);
// i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
// but it did not work out
controlledTranslate = -s.controller.spline.interpolate(-translate);
}
if(!controlledTranslate || s.params.controlBy === 'container'){
multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());
controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();
}
if (s.params.controlInverse) {
controlledTranslate = c.maxTranslate() - controlledTranslate;
}
c.updateProgress(controlledTranslate);
c.setWrapperTranslate(controlledTranslate, false, s);
c.updateActiveIndex();
}
if (s.isArray(controlled)) {
for (var i = 0; i < controlled.length; i++) {
if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
setControlledTranslate(controlled[i]);
}
}
}
else if (controlled instanceof Swiper && byController !== controlled) {
setControlledTranslate(controlled);
}
},
setTransition: function (duration, byController) {
var controlled = s.params.control;
var i;
function setControlledTransition(c) {
c.setWrapperTransition(duration, s);
if (duration !== 0) {
c.onTransitionStart();
c.wrapper.transitionEnd(function(){
if (!controlled) return;
if (c.params.loop && s.params.controlBy === 'slide') {
c.fixLoop();
}
c.onTransitionEnd();
});
}
}
if (s.isArray(controlled)) {
for (i = 0; i < controlled.length; i++) {
if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
setControlledTransition(controlled[i]);
}
}
}
else if (controlled instanceof Swiper && byController !== controlled) {
setControlledTransition(controlled);
}
}
};
/*=========================
Hash Navigation
===========================*/
s.hashnav = {
init: function () {
if (!s.params.hashnav) return;
s.hashnav.initialized = true;
var hash = document.location.hash.replace('#', '');
if (!hash) return;
var speed = 0;
for (var i = 0, length = s.slides.length; i < length; i++) {
var slide = s.slides.eq(i);
var slideHash = slide.attr('data-hash');
if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) {
var index = slide.index();
s.slideTo(index, speed, s.params.runCallbacksOnInit, true);
}
}
},
setHash: function () {
if (!s.hashnav.initialized || !s.params.hashnav) return;
document.location.hash = s.slides.eq(s.activeIndex).attr('data-hash') || '';
}
};
/*=========================
Keyboard Control
===========================*/
function handleKeyboard(e) {
if (e.originalEvent) e = e.originalEvent; //jquery fix
var kc = e.keyCode || e.charCode;
// Directions locks
if (!s.params.allowSwipeToNext && (s.isHorizontal() && kc === 39 || !s.isHorizontal() && kc === 40)) {
return false;
}
if (!s.params.allowSwipeToPrev && (s.isHorizontal() && kc === 37 || !s.isHorizontal() && kc === 38)) {
return false;
}
if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
return;
}
if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
return;
}
if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
var inView = false;
//Check that swiper should be inside of visible area of window
if (s.container.parents('.swiper-slide').length > 0 && s.container.parents('.swiper-slide-active').length === 0) {
return;
}
var windowScroll = {
left: window.pageXOffset,
top: window.pageYOffset
};
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var swiperOffset = s.container.offset();
if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;
var swiperCoord = [
[swiperOffset.left, swiperOffset.top],
[swiperOffset.left + s.width, swiperOffset.top],
[swiperOffset.left, swiperOffset.top + s.height],
[swiperOffset.left + s.width, swiperOffset.top + s.height]
];
for (var i = 0; i < swiperCoord.length; i++) {
var point = swiperCoord[i];
if (
point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth &&
point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight
) {
inView = true;
}
}
if (!inView) return;
}
if (s.isHorizontal()) {
if (kc === 37 || kc === 39) {
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
}
if ((kc === 39 && !s.rtl) || (kc === 37 && s.rtl)) s.slideNext();
if ((kc === 37 && !s.rtl) || (kc === 39 && s.rtl)) s.slidePrev();
}
else {
if (kc === 38 || kc === 40) {
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
}
if (kc === 40) s.slideNext();
if (kc === 38) s.slidePrev();
}
}
s.disableKeyboardControl = function () {
s.params.keyboardControl = false;
$(document).off('keydown', handleKeyboard);
};
s.enableKeyboardControl = function () {
s.params.keyboardControl = true;
$(document).on('keydown', handleKeyboard);
};
/*=========================
Mousewheel Control
===========================*/
s.mousewheel = {
event: false,
lastScrollTime: (new window.Date()).getTime()
};
if (s.params.mousewheelControl) {
try {
new window.WheelEvent('wheel');
s.mousewheel.event = 'wheel';
} catch (e) {
if (window.WheelEvent || (s.container[0] && 'wheel' in s.container[0])) {
s.mousewheel.event = 'wheel';
}
}
if (!s.mousewheel.event && window.WheelEvent) {
}
if (!s.mousewheel.event && document.onmousewheel !== undefined) {
s.mousewheel.event = 'mousewheel';
}
if (!s.mousewheel.event) {
s.mousewheel.event = 'DOMMouseScroll';
}
}
function handleMousewheel(e) {
if (e.originalEvent) e = e.originalEvent; //jquery fix
var we = s.mousewheel.event;
var delta = 0;
var rtlFactor = s.rtl ? -1 : 1;
//WebKits
if (we === 'mousewheel') {
if (s.params.mousewheelForceToAxis) {
if (s.isHorizontal()) {
if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX * rtlFactor;
else return;
}
else {
if (Math.abs(e.wheelDeltaY) > Math.abs(e.wheelDeltaX)) delta = e.wheelDeltaY;
else return;
}
}
else {
delta = Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY) ? - e.wheelDeltaX * rtlFactor : - e.wheelDeltaY;
}
}
//Old FireFox
else if (we === 'DOMMouseScroll') delta = -e.detail;
//New FireFox
else if (we === 'wheel') {
if (s.params.mousewheelForceToAxis) {
if (s.isHorizontal()) {
if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) delta = -e.deltaX * rtlFactor;
else return;
}
else {
if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) delta = -e.deltaY;
else return;
}
}
else {
delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? - e.deltaX * rtlFactor : - e.deltaY;
}
}
if (delta === 0) return;
if (s.params.mousewheelInvert) delta = -delta;
if (!s.params.freeMode) {
if ((new window.Date()).getTime() - s.mousewheel.lastScrollTime > 60) {
if (delta < 0) {
if ((!s.isEnd || s.params.loop) && !s.animating) s.slideNext();
else if (s.params.mousewheelReleaseOnEdges) return true;
}
else {
if ((!s.isBeginning || s.params.loop) && !s.animating) s.slidePrev();
else if (s.params.mousewheelReleaseOnEdges) return true;
}
}
s.mousewheel.lastScrollTime = (new window.Date()).getTime();
}
else {
//Freemode or scrollContainer:
var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity;
var wasBeginning = s.isBeginning,
wasEnd = s.isEnd;
if (position >= s.minTranslate()) position = s.minTranslate();
if (position <= s.maxTranslate()) position = s.maxTranslate();
s.setWrapperTransition(0);
s.setWrapperTranslate(position);
s.updateProgress();
s.updateActiveIndex();
if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) {
s.updateClasses();
}
if (s.params.freeModeSticky) {
clearTimeout(s.mousewheel.timeout);
s.mousewheel.timeout = setTimeout(function () {
s.slideReset();
}, 300);
}
else {
if (s.params.lazyLoading && s.lazy) {
s.lazy.load();
}
}
// Return page scroll on edge positions
if (position === 0 || position === s.maxTranslate()) return;
}
if (s.params.autoplay) s.stopAutoplay();
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
return false;
}
s.disableMousewheelControl = function () {
if (!s.mousewheel.event) return false;
s.container.off(s.mousewheel.event, handleMousewheel);
return true;
};
s.enableMousewheelControl = function () {
if (!s.mousewheel.event) return false;
s.container.on(s.mousewheel.event, handleMousewheel);
return true;
};
/*=========================
Parallax
===========================*/
function setParallaxTransform(el, progress) {
el = $(el);
var p, pX, pY;
var rtlFactor = s.rtl ? -1 : 1;
p = el.attr('data-swiper-parallax') || '0';
pX = el.attr('data-swiper-parallax-x');
pY = el.attr('data-swiper-parallax-y');
if (pX || pY) {
pX = pX || '0';
pY = pY || '0';
}
else {
if (s.isHorizontal()) {
pX = p;
pY = '0';
}
else {
pY = p;
pX = '0';
}
}
if ((pX).indexOf('%') >= 0) {
pX = parseInt(pX, 10) * progress * rtlFactor + '%';
}
else {
pX = pX * progress * rtlFactor + 'px' ;
}
if ((pY).indexOf('%') >= 0) {
pY = parseInt(pY, 10) * progress + '%';
}
else {
pY = pY * progress + 'px' ;
}
el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
}
s.parallax = {
setTranslate: function () {
s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){
setParallaxTransform(this, s.progress);
});
s.slides.each(function () {
var slide = $(this);
slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
var progress = Math.min(Math.max(slide[0].progress, -1), 1);
setParallaxTransform(this, progress);
});
});
},
setTransition: function (duration) {
if (typeof duration === 'undefined') duration = s.params.speed;
s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){
var el = $(this);
var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;
if (duration === 0) parallaxDuration = 0;
el.transition(parallaxDuration);
});
}
};
/*=========================
Plugins API. Collect all and init all plugins
===========================*/
s._plugins = [];
for (var plugin in s.plugins) {
var p = s.plugins[plugin](s, s.params[plugin]);
if (p) s._plugins.push(p);
}
// Method to call all plugins event/method
s.callPlugins = function (eventName) {
for (var i = 0; i < s._plugins.length; i++) {
if (eventName in s._plugins[i]) {
s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
}
}
};
/*=========================
Events/Callbacks/Plugins Emitter
===========================*/
function normalizeEventName (eventName) {
if (eventName.indexOf('on') !== 0) {
if (eventName[0] !== eventName[0].toUpperCase()) {
eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);
}
else {
eventName = 'on' + eventName;
}
}
return eventName;
}
s.emitterEventListeners = {
};
s.emit = function (eventName) {
// Trigger callbacks
if (s.params[eventName]) {
s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
}
var i;
// Trigger events
if (s.emitterEventListeners[eventName]) {
for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
}
}
// Trigger plugins
if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
};
s.on = function (eventName, handler) {
eventName = normalizeEventName(eventName);
if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];
s.emitterEventListeners[eventName].push(handler);
return s;
};
s.off = function (eventName, handler) {
var i;
eventName = normalizeEventName(eventName);
if (typeof handler === 'undefined') {
// Remove all handlers for such event
s.emitterEventListeners[eventName] = [];
return s;
}
if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;
for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
if(s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);
}
return s;
};
s.once = function (eventName, handler) {
eventName = normalizeEventName(eventName);
var _handler = function () {
handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
s.off(eventName, _handler);
};
s.on(eventName, _handler);
return s;
};
// Accessibility tools
s.a11y = {
makeFocusable: function ($el) {
$el.attr('tabIndex', '0');
return $el;
},
addRole: function ($el, role) {
$el.attr('role', role);
return $el;
},
addLabel: function ($el, label) {
$el.attr('aria-label', label);
return $el;
},
disable: function ($el) {
$el.attr('aria-disabled', true);
return $el;
},
enable: function ($el) {
$el.attr('aria-disabled', false);
return $el;
},
onEnterKey: function (event) {
if (event.keyCode !== 13) return;
if ($(event.target).is(s.params.nextButton)) {
s.onClickNext(event);
if (s.isEnd) {
s.a11y.notify(s.params.lastSlideMessage);
}
else {
s.a11y.notify(s.params.nextSlideMessage);
}
}
else if ($(event.target).is(s.params.prevButton)) {
s.onClickPrev(event);
if (s.isBeginning) {
s.a11y.notify(s.params.firstSlideMessage);
}
else {
s.a11y.notify(s.params.prevSlideMessage);
}
}
if ($(event.target).is('.' + s.params.bulletClass)) {
$(event.target)[0].click();
}
},
liveRegion: $(' '),
notify: function (message) {
var notification = s.a11y.liveRegion;
if (notification.length === 0) return;
notification.html('');
notification.html(message);
},
init: function () {
// Setup accessibility
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.a11y.makeFocusable(s.nextButton);
s.a11y.addRole(s.nextButton, 'button');
s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
}
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.a11y.makeFocusable(s.prevButton);
s.a11y.addRole(s.prevButton, 'button');
s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
}
$(s.container).append(s.a11y.liveRegion);
},
initPagination: function () {
if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {
s.bullets.each(function () {
var bullet = $(this);
s.a11y.makeFocusable(bullet);
s.a11y.addRole(bullet, 'button');
s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));
});
}
},
destroy: function () {
if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();
}
};
/*=========================
Init/Destroy
===========================*/
s.init = function () {
if (s.params.loop) s.createLoop();
s.updateContainerSize();
s.updateSlidesSize();
s.updatePagination();
if (s.params.scrollbar && s.scrollbar) {
s.scrollbar.set();
if (s.params.scrollbarDraggable) {
s.scrollbar.enableDraggable();
}
}
if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
if (!s.params.loop) s.updateProgress();
s.effects[s.params.effect].setTranslate();
}
if (s.params.loop) {
s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);
}
else {
s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);
if (s.params.initialSlide === 0) {
if (s.parallax && s.params.parallax) s.parallax.setTranslate();
if (s.lazy && s.params.lazyLoading) {
s.lazy.load();
s.lazy.initialImageLoaded = true;
}
}
}
s.attachEvents();
if (s.params.observer && s.support.observer) {
s.initObservers();
}
if (s.params.preloadImages && !s.params.lazyLoading) {
s.preloadImages();
}
if (s.params.autoplay) {
s.startAutoplay();
}
if (s.params.keyboardControl) {
if (s.enableKeyboardControl) s.enableKeyboardControl();
}
if (s.params.mousewheelControl) {
if (s.enableMousewheelControl) s.enableMousewheelControl();
}
if (s.params.hashnav) {
if (s.hashnav) s.hashnav.init();
}
if (s.params.a11y && s.a11y) s.a11y.init();
s.emit('onInit', s);
};
// Cleanup dynamic styles
s.cleanupStyles = function () {
// Container
s.container.removeClass(s.classNames.join(' ')).removeAttr('style');
// Wrapper
s.wrapper.removeAttr('style');
// Slides
if (s.slides && s.slides.length) {
s.slides
.removeClass([
s.params.slideVisibleClass,
s.params.slideActiveClass,
s.params.slideNextClass,
s.params.slidePrevClass
].join(' '))
.removeAttr('style')
.removeAttr('data-swiper-column')
.removeAttr('data-swiper-row');
}
// Pagination/Bullets
if (s.paginationContainer && s.paginationContainer.length) {
s.paginationContainer.removeClass(s.params.paginationHiddenClass);
}
if (s.bullets && s.bullets.length) {
s.bullets.removeClass(s.params.bulletActiveClass);
}
// Buttons
if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
// Scrollbar
if (s.params.scrollbar && s.scrollbar) {
if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');
if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');
}
};
// Destroy
s.destroy = function (deleteInstance, cleanupStyles) {
// Detach evebts
s.detachEvents();
// Stop autoplay
s.stopAutoplay();
// Disable draggable
if (s.params.scrollbar && s.scrollbar) {
if (s.params.scrollbarDraggable) {
s.scrollbar.disableDraggable();
}
}
// Destroy loop
if (s.params.loop) {
s.destroyLoop();
}
// Cleanup styles
if (cleanupStyles) {
s.cleanupStyles();
}
// Disconnect observer
s.disconnectObservers();
// Disable keyboard/mousewheel
if (s.params.keyboardControl) {
if (s.disableKeyboardControl) s.disableKeyboardControl();
}
if (s.params.mousewheelControl) {
if (s.disableMousewheelControl) s.disableMousewheelControl();
}
// Disable a11y
if (s.params.a11y && s.a11y) s.a11y.destroy();
// Destroy callback
s.emit('onDestroy');
// Delete instance
if (deleteInstance !== false) s = null;
};
s.init();
// Return swiper instance
return s;
};
/*==================================================
Prototype
====================================================*/
Swiper.prototype = {
isSafari: (function () {
var ua = navigator.userAgent.toLowerCase();
return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);
})(),
isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),
isArray: function (arr) {
return Object.prototype.toString.apply(arr) === '[object Array]';
},
/*==================================================
Browser
====================================================*/
browser: {
ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
ieTouch: (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1) || (window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1)
},
/*==================================================
Devices
====================================================*/
device: (function () {
var ua = navigator.userAgent;
var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
return {
ios: ipad || iphone || ipod,
android: android
};
})(),
/*==================================================
Feature Detection
====================================================*/
support: {
touch : (window.Modernizr && Modernizr.touch === true) || (function () {
return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);
})(),
transforms3d : (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {
var div = document.createElement('div').style;
return ('webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div);
})(),
flexbox: (function () {
var div = document.createElement('div').style;
var styles = ('alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient').split(' ');
for (var i = 0; i < styles.length; i++) {
if (styles[i] in div) return true;
}
})(),
observer: (function () {
return ('MutationObserver' in window || 'WebkitMutationObserver' in window);
})()
},
/*==================================================
Plugins
====================================================*/
plugins: {}
};
/*===========================
Get Dom libraries
===========================*/
var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7'];
for (var i = 0; i < swiperDomPlugins.length; i++) {
if (window[swiperDomPlugins[i]]) {
addLibraryPlugin(window[swiperDomPlugins[i]]);
}
}
// Required DOM Plugins
var domLib;
if (typeof Dom7 === 'undefined') {
domLib = window.Dom7 || window.Zepto || window.jQuery;
}
else {
domLib = Dom7;
}
/*===========================
Add .swiper plugin from Dom libraries
===========================*/
function addLibraryPlugin(lib) {
lib.fn.swiper = function (params) {
var firstInstance;
lib(this).each(function () {
var s = new Swiper(this, params);
if (!firstInstance) firstInstance = s;
});
return firstInstance;
};
}
if (domLib) {
if (!('transitionEnd' in domLib.fn)) {
domLib.fn.transitionEnd = function (callback) {
var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
i, j, dom = this;
function fireCallBack(e) {
/*jshint validthis:true */
if (e.target !== this) return;
callback.call(this, e);
for (i = 0; i < events.length; i++) {
dom.off(events[i], fireCallBack);
}
}
if (callback) {
for (i = 0; i < events.length; i++) {
dom.on(events[i], fireCallBack);
}
}
return this;
};
}
if (!('transform' in domLib.fn)) {
domLib.fn.transform = function (transform) {
for (var i = 0; i < this.length; i++) {
var elStyle = this[i].style;
elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;
}
return this;
};
}
if (!('transition' in domLib.fn)) {
domLib.fn.transition = function (duration) {
if (typeof duration !== 'string') {
duration = duration + 'ms';
}
for (var i = 0; i < this.length; i++) {
var elStyle = this[i].style;
elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
}
return this;
};
}
}
window.Swiper = Swiper;
})();
/*===========================
Swiper AMD Export
===========================*/
if (typeof(module) !== 'undefined')
{
module.exports = window.Swiper;
}
else if (typeof define === 'function' && define.amd) {
define([], function () {
'use strict';
return window.Swiper;
});
};
/*!
* FitText.js 1.2
*
* Copyright 2011, Dave Rupert http://daverupert.com
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Date: Thu May 05 14:23:00 2011 -0600
*/
(function($){$.fn.fitText=function(kompressor,options){var compressor=kompressor||1,settings=$.extend({'minFontSize':Number.NEGATIVE_INFINITY,'maxFontSize':$(this).css('font-size')},options);return this.each(function(){var $this=$(this);var resizer=function(){$this.css('font-size',Math.max(Math.min($this.width()/(compressor*10),parseFloat(settings.maxFontSize)),parseFloat(settings.minFontSize)))};resizer();$(window).on('resize.fittext orientationchange.fittext',resizer)})}})(jQuery);
(function($,CherryJsCore){var methods={init:function(options){var settings={call:function(){}};return this.each(function(){var $this=$(this),$window=$(window),popupSettings=$this.data('popup-settings'),popupsLocalStorageData=getLocalStorageData()||{},popupAvailable=popupsLocalStorageData[popupSettings.id]||'enable',$showAgainCheck=$('.cherry-popup-show-again-check',$this),$subscribeForm=$('.cherry-popup-subscribe',$this),cherrySubscribeFormAjax=null,subscribeFormAjaxId='cherry_subscribe_form_ajax',$subscribeFormMessage=null,$loginForm=$('.cherry-popup-login',$this),cherryLoginFormAjax=null,loginFormAjaxId='cherry_login_form_ajax',$loginFormMessage=null,$registerForm=$('.cherry-popup-register',$this),cherryRegisterFormAjax=null;registerFormAjaxId='cherry_register_form_ajax',$registerFormMessage=null;if(options){$.extend(settings,options)}(function(){if('disable'===popupAvailable){$this.remove();return!1}
if(!popupsLocalStorageData.hasOwnProperty(popupSettings.id)){popupsLocalStorageData[popupSettings.id]='enable'}
setLocalStorageData(popupsLocalStorageData);switch(popupSettings.use){case 'open-page':addOpenEventsFunction();break;case 'close-page':addCloseEventsFunction();break}
customEventsFunction();if('false'===popupSettings['show-once']){checkEvents()}else{$showAgainCheck.remove();popupsLocalStorageData[popupSettings.id]='disable';setLocalStorageData(popupsLocalStorageData)}
closePopupEvent();if($subscribeForm[0]){subscribeFormInit()}
if($loginForm[0]){loginFormInit()}
if($registerForm[0]){registerFormInit()}})();function addOpenEventsFunction(){switch(popupSettings['open-appear-event']){case 'page-load':pageLoadEvent(popupSettings['load-open-delay']);break;case 'user-inactive':userInactiveEvent(popupSettings['inactive-time']);break;case 'scroll-page':scrollPageEvent(popupSettings['page-scrolling-value']);break}}
function addCloseEventsFunction(){switch(popupSettings['close-appear-event']){case 'outside-viewport':viewportLeaveEvent();break;case 'page-focusout':pageFocusoutEvent();break}}
function customEventsFunction(){var eventType=popupSettings['custom-event-type'],selector=popupSettings['popup-selector'];if(''===selector){return!1}
switch(eventType){case 'click':$(document).on('click',selector,function(event){event.preventDefault();showPopup()})
break;case 'hover':$(document).on('mouseenter',selector,function(event){showPopup()})
break}}
function closePopupEvent(){var timeout=null;$this.on('click','.cherry-popup-close-button',function(event){var button=event.currentTarget;$this.toggleClass('hide-animation show-animation');clearTimeout(timeout);timeout=setTimeout(function(){hidePopup()},300)});$this.on('click','.cherry-popup-overlay',function(event){var overlay=event.currentTarget;$this.toggleClass('hide-animation show-animation');clearTimeout(timeout);timeout=setTimeout(function(){hidePopup()},300)});$this.on('click','.cherry-popup-close-label',function(event){var overlay=event.currentTarget;$this.toggleClass('hide-animation show-animation');clearTimeout(timeout);timeout=setTimeout(function(){hidePopup()},300)});$(document).on('keyup',function(event){if(!$this.hasClass('show-animation')){return!1}
if(27==event.keyCode&&$this.hasClass('show-animation')){$this.toggleClass('hide-animation show-animation');clearTimeout(timeout);timeout=setTimeout(function(){hidePopup()},300)}})}
function checkEvents(){$this.on('click','.cherry-popup-show-again-check',function(event){var check=event.currentTarget,popupsLocalStorageData=getLocalStorageData()||{};if(!$(check).hasClass('checked')){$(check).addClass('checked');popupsLocalStorageData[popupSettings.id]='disable'}else{$(check).removeClass('checked');popupsLocalStorageData[popupSettings.id]='enable'}
setLocalStorageData(popupsLocalStorageData)})}
function showPopup(){var $popupList=$('.cherry-popup');$popupList.each(function(){var $popup=$(this),timeout=null;if($popup.hasClass('show-animation')){$popup.toggleClass('hide-animation show-animation');clearTimeout(timeout);timeout=setTimeout(function(){$popup.toggleClass('waiting-status hide-animation')},300)}});$this.removeClass('waiting-status');$this.addClass('show-animation');if($('.cherry-popup-login__input-user',$loginForm)[0]){$('.cherry-popup-login__input-user',$loginForm).focus()}
if($('.cherry-popup-register__input-login',$registerForm)[0]){$('.cherry-popup-register__input-login',$registerForm).focus()}}
function hidePopup(){$this.toggleClass('waiting-status hide-animation')}
function pageLoadEvent(openDelay){var delay=+openDelay||0;delay=delay*1000;$(document).on('ready',function(){setTimeout(function(){showPopup()},delay)})}
function userInactiveEvent(inactiveDelay){var delay=+inactiveDelay||0,isInactive=!0;delay=delay*1000;setTimeout(function(){if(isInactive){showPopup()}},delay);$(document).on('click focus resize keyup scroll',function(){isInactive=!1})}
function scrollPageEvent(scrollingValue){var scrolledValue=+scrollingValue||0;$(window).on('scroll.cherryPopupScrollEvent resize.cherryPopupResizeEvent',function(){var $window=$(window),windowHeight=$window.height(),documentHeight=$(document).height(),scrolledHeight=documentHeight-windowHeight,scrolledProgress=Math.max(0,Math.min(1,$window.scrollTop()/scrolledHeight))*100;if(scrolledProgress>=scrolledValue){$(window).off('scroll.cherryPopupScrollEvent resize.cherryPopupResizeEvent');showPopup()}}).trigger('scroll.cherryPopupScrollEvent')}
function viewportLeaveEvent(){var pageY=0;$(document).on('mouseleave','body',function(event){if(!$('.open-page-type')[0]){pageY=event.pageY-$window.scrollTop();if(0>pageY){showPopup()}}})}
function pageFocusoutEvent(){$(window).on('blur',function(){if(!$('.open-page-type')[0]){showPopup()}})}
function subscribeFormInit(){$subscribeFormMessage=$('.cherry-popup-subscribe__message',$subscribeForm);cherrySubscribeFormAjax=new CherryJsCore.CherryAjaxHandler({handlerId:subscribeFormAjaxId,successCallback:subscribeFormAjaxSuccessCallback});$subscribeForm.on('click','.cherry-popup-subscribe__submit',subscribeFormAjax)}
function subscribeFormAjax(){var $input=$('.cherry-popup-subscribe__input',$subscribeForm),inputValue=$input.val();cherrySubscribeFormAjax.sendData({'mail':inputValue})}
function subscribeFormAjaxSuccessCallback(data){var successType=data.type,message=data.message||'',timeout=null;if('success'===successType){$subscribeFormMessage.addClass('success-type')}
$('span',$subscribeFormMessage).html(message);$subscribeFormMessage.slideDown(300);timeout=setTimeout(function(){$subscribeFormMessage.slideUp(300,function(){$subscribeFormMessage.removeClass('success-type');clearTimeout(timeout)})},6000)}
function loginFormInit(){$loginFormMessage=$('.cherry-popup-login__message',$loginForm);cherryLoginFormAjax=new CherryJsCore.CherryAjaxHandler({handlerId:loginFormAjaxId,successCallback:loginFormAjaxSuccessCallback});$loginForm.on('click','.cherry-popup-login__login-in',loginFormAjax);$loginForm.on('keyup','.cherry-popup-login__input-user, .cherry-popup-login__input-pass',function(event){if(13==(event.keyCode?event.keyCode:event.which)){loginFormAjax()}});$loginForm.on('click','.cherry-popup-login__remember',function(){$(this).toggleClass('checked')})}
function loginFormAjax(){var user=$('.cherry-popup-login__input-user',$loginForm).val(),pass=$('.cherry-popup-login__input-pass',$loginForm).val(),$remember=$('.cherry-popup-login__remember',$loginForm),data={'user':user,'pass':pass,'remember':$remember.hasClass('checked')?'true':'false'};$('.cherry-popup-spinner',$loginForm).css({'display':'block'});cherryLoginFormAjax.sendData(data)}
function loginFormAjaxSuccessCallback(data){var successType=data.type,message=data.message||'',timeout=null;$('.cherry-popup-spinner',$loginForm).css({'display':'none'});if('success'===successType){$loginFormMessage.addClass('success-type');window.location.reload()}
$('span',$loginFormMessage).html(message);$loginFormMessage.slideDown(300)}
function registerFormInit(){$registerFormMessage=$('.cherry-popup-register__message',$registerForm);cherryRegisterFormAjax=new CherryJsCore.CherryAjaxHandler({handlerId:registerFormAjaxId,successCallback:registerFormAjaxSuccessCallback});$registerForm.on('click','.cherry-popup-register__sign-up',registerFormAjax);$registerForm.on('keyup','.cherry-popup-register__input-login, .cherry-popup-login__input-mail',function(event){if(13==(event.keyCode?event.keyCode:event.which)){registerFormAjax()}})}
function registerFormAjax(){var login=$('.cherry-popup-register__input-login',$registerForm).val(),mail=$('.cherry-popup-login__input-mail',$registerForm).val(),data={'login':login,'mail':mail};$('.cherry-popup-spinner',$registerForm).css({'display':'block'});cherryRegisterFormAjax.sendData(data)}
function registerFormAjaxSuccessCallback(data){var $registerFormMessage=$('.cherry-popup-register__message',$registerForm),successType=data.type,message=data.message||'',timeout=null;$('.cherry-popup-spinner',$registerForm).css({'display':'none'});if('success'===successType){$registerFormMessage.addClass('success-type')}
$('span',$registerFormMessage).html(message);$registerFormMessage.slideDown(300)}
function getLocalStorageData(){try{return JSON.parse(localStorage.getItem('popupsLocalStorageData'))}catch(e){return!1}}
function setLocalStorageData(object){try{localStorage.setItem('popupsLocalStorageData',JSON.stringify(object))}catch(e){return!1}}})},destroy:function(){},update:function(){}};$.fn.cherryPopupsPlugin=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if('object'===typeof method||!method){return methods.init.apply(this,arguments)}else{$.error('Method with name '+method+' is not exist for jQuery.cherryPopupsPlugin')}}})(jQuery,window.CherryJsCore);
(function($,CherryJsCore){'use strict';CherryJsCore.utilites.namespace('cherryPopupsFrontScripts');CherryJsCore.cherryPopupsFrontScripts={init:function(){if($('.cherry-popup-wrapper')[0]){$('.cherry-popup-wrapper').cherryPopupsPlugin()}}};CherryJsCore.cherryPopupsFrontScripts.init()}(jQuery,window.CherryJsCore));
/*! This file is auto-generated */
!function(a){a.fn.hoverIntent=function(e,t,n){var o,r,v,i,u={interval:100,sensitivity:6,timeout:0};u="object"==typeof e?a.extend(u,e):a.isFunction(t)?a.extend(u,{over:e,out:t,selector:n}):a.extend(u,{over:e,out:e,selector:t});function s(e){o=e.pageX,r=e.pageY}function h(e){var t=a.extend({},e),n=this;n.hoverIntent_t&&(n.hoverIntent_t=clearTimeout(n.hoverIntent_t)),"mouseenter"===e.type?(v=t.pageX,i=t.pageY,a(n).on("mousemove.hoverIntent",s),n.hoverIntent_s||(n.hoverIntent_t=setTimeout(function(){I(t,n)},u.interval))):(a(n).off("mousemove.hoverIntent",s),n.hoverIntent_s&&(n.hoverIntent_t=setTimeout(function(){!function(e,t){t.hoverIntent_t=clearTimeout(t.hoverIntent_t),t.hoverIntent_s=!1,u.out.apply(t,[e])}(t,n)},u.timeout)))}var I=function(e,t){if(t.hoverIntent_t=clearTimeout(t.hoverIntent_t),Math.sqrt((v-o)*(v-o)+(i-r)*(i-r))'+'%3$s '+'%4$s'+'',child_wrap:'',child:''+'%3$s '+''+' '};function Menu(options){var defaults,settings,self=this;defaults={id:'',href:'',title:'···',children:{},templates:{},container:null};settings=$.extend(defaults,options);self.id=settings.id;self.href=settings.href;self.title=settings.title;self.children=settings.children;self.templates=settings.templates;self.$container=settings.container;self.node=null;self.attachedNode=null;self.options={};self.visible=!0}
Menu.prototype.set=function(child){if(!1===child instanceof Menu){throw new Error('Invalid argument type')}
this.children[child.id]=child;return this};Menu.prototype.push=function(child){return this.set(child)};Menu.prototype.get=function(id){var menuItem=null;this.map(id,function(_,child){menuItem=child;return child});return menuItem};Menu.prototype.map=function(id,callback,children){var menuItem={id:id},self=this;if(typeof id!=='string'){menuItem=id}
children=children||this.children;if(0>=children.length){return menuItem}
Object.keys(children).forEach(function(index){child=children[index];if(menuItem.id===child.id){children[menuItem.id]=callback(child)}else{if(child.children&&0