(function(n){var f=-1,r=-1,e=function(t){var f=1,e=n(t),u=null,r=[];return e.each(function(){var t=n(this),e=t.offset().top-i(t.css("margin-top")),o=r.length>0?r[r.length-1]:null;o===null?r.push(t):Math.floor(Math.abs(u-e))<=f?r[r.length-1]=o.add(t):r.push(t);u=e}),r},i=function(n){return parseFloat(n)||0},t=n.fn.matchHeight=function(i){if(i==="remove"){var r=this;return this.css("height",""),n.each(t._groups,function(n,t){t.elements=t.elements.not(r)}),this}return this.length<=1?this:(i=typeof i!="undefined"?i:!0,t._groups.push({elements:this,byRow:i}),t._apply(this,i),this)},u;t._groups=[];t._throttle=80;t._maintainScroll=!1;t._beforeUpdate=null;t._afterUpdate=null;t._apply=function(r,u){var f=n(r),o=[f],h=n(window).scrollTop(),c=n("html").outerHeight(!0),s=f.parents().filter(":hidden");return s.css("display","block"),u&&(f.each(function(){var t=n(this),i=t.css("display")==="inline-block"?"inline-block":"block";t.data("style-cache",t.attr("style"));t.css({display:i,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px"})}),o=e(f),f.each(function(){var t=n(this);t.attr("style",t.data("style-cache")||"").css("height","")})),n.each(o,function(t,r){var f=n(r),e=0;u&&f.length<=1||(f.each(function(){var t=n(this),i=t.css("display")==="inline-block"?"inline-block":"block";t.css({display:i,height:""});t.outerHeight(!1)>e&&(e=t.outerHeight(!1));t.css("display","")}),f.each(function(){var t=n(this),r=0;t.css("box-sizing")!=="border-box"&&(r+=i(t.css("border-top-width"))+i(t.css("border-bottom-width")),r+=i(t.css("padding-top"))+i(t.css("padding-bottom")));t.css("height",e-r)}))}),s.css("display",""),t._maintainScroll&&n(window).scrollTop(h/c*n("html").outerHeight(!0)),this};t._applyDataApi=function(){var t={};n("[data-match-height], [data-mh]").each(function(){var i=n(this),r=i.attr("data-match-height")||i.attr("data-mh");t[r]=r in t?t[r].add(i):i});n.each(t,function(){this.matchHeight(!0)})};u=function(i){t._beforeUpdate&&t._beforeUpdate(i,t._groups);n.each(t._groups,function(){t._apply(this.elements,this.byRow)});t._afterUpdate&&t._afterUpdate(i,t._groups)};t._update=function(i,e){if(e&&e.type==="resize"){var o=n(window).width();if(o===f)return;f=o}i?r===-1&&(r=setTimeout(function(){u(e);r=-1},t._throttle)):u(e)};n(t._applyDataApi);n(window).bind("load",function(n){t._update(!1,n)});n(window).bind("resize orientationchange",function(n){t._update(!0,n)})})(jQuery)