/**
 * animOnScroll
 */!function(a){"use strict";function c(){var c=b.clientHeight,d=a.innerHeight;return c<d?d:c}function d(){return a.pageYOffset||b.scrollTop}function e(a){var b=0,c=0;do isNaN(a.offsetTop)||(b+=a.offsetTop),isNaN(a.offsetLeft)||(c+=a.offsetLeft);while(a=a.offsetParent);return{top:b,left:c}}function f(a,b){var f=a.offsetHeight,g=d(),h=g+c(),i=e(a).top,j=i+f,b=b||0;return i+f*b<=h&&j-f*b>=g}function g(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function h(a,b){this.el=a,this.options=g(this.defaults,b),this._init()}var b=a.document.documentElement;h.prototype={defaults:{minDuration:0,maxDuration:0,viewportFactor:0},_init:function(){this.items=Array.prototype.slice.call(document.querySelectorAll("#"+this.el.id+" > li")),this.itemsCount=this.items.length,this.itemsRenderedCount=0,this.didScroll=!1;var b=this;imagesLoaded(this.el,function(){new Masonry(b.el,{itemSelector:"li",transitionDuration:0}),Modernizr.cssanimations&&(b.items.forEach(function(a,c){f(a)&&(b._checkTotalRendered(),classie.add(a,"shown"))}),a.addEventListener("scroll",function(){b._onScrollFn()},!1),a.addEventListener("resize",function(){b._resizeHandler()},!1))})},_onScrollFn:function(){var a=this;this.didScroll||(this.didScroll=!0,setTimeout(function(){a._scrollPage()},60))},_scrollPage:function(){var a=this;this.items.forEach(function(b,e){classie.has(b,"shown")||classie.has(b,"animate")||!f(b,a.options.viewportFactor)||setTimeout(function(){var e=d()+c()/2;if(a.el.style.WebkitPerspectiveOrigin="50% "+e+"px",a.el.style.MozPerspectiveOrigin="50% "+e+"px",a.el.style.perspectiveOrigin="50% "+e+"px",a._checkTotalRendered(),a.options.minDuration&&a.options.maxDuration){var f=Math.random()*(a.options.maxDuration-a.options.minDuration)+a.options.minDuration+"s";b.style.WebkitAnimationDuration=f,b.style.MozAnimationDuration=f,b.style.animationDuration=f}classie.add(b,"animate")},25)}),this.didScroll=!1},_resizeHandler:function(){function b(){a._scrollPage(),a.resizeTimeout=null}var a=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(b,1e3)},_checkTotalRendered:function(){++this.itemsRenderedCount,this.itemsRenderedCount===this.itemsCount&&a.removeEventListener("scroll",this._onScrollFn)}},a.AnimOnScroll=h}(window);