var $event,$special,resizeTimeout,BLANK;window.Modernizr=function(n,t,i){function p(n){k.cssText=n}function u(n,t){return typeof n===t}function tt(n,t){return!!~(""+n).indexOf(t)}function w(n,t){var u,r;for(u in n)if(r=n[u],!tt(r,"-")&&k[r]!==i)return t=="pfx"?r:!0;return!1}function it(n,t,r){var e,f;for(e in n)if(f=t[n[e]],f!==i)return r===!1?n[e]:u(f,"function")?f.bind(r||t):f;return!1}function f(n,t,i){var r=n.charAt(0).toUpperCase()+n.slice(1),f=(n+" "+g.join(r+" ")+r).split(" ");return u(t,"string")||u(t,"undefined")?w(f,t):(f=(n+" "+nt.join(r+" ")+r).split(" "),it(f,t,i))}var r={},h=!0,c=t.documentElement,b=t.createElement("modernizr"),k=b.style,rt,ft={}.toString,d="Webkit Moz O ms",g=d.split(" "),nt=d.toLowerCase().split(" "),e={},l=[],a=l.slice,o,v={}.hasOwnProperty,y,s;y=!u(v,"undefined")&&!u(v.call,"undefined")?function(n,t){return v.call(n,t)}:function(n,t){return t in n&&u(n.constructor.prototype[t],"undefined")};Function.prototype.bind||(Function.prototype.bind=function(n){var t=this,i,r;if(typeof t!="function")throw new TypeError;return i=a.call(arguments,1),r=function(){var f,e,u;return this instanceof r?(f=function(){},f.prototype=t.prototype,e=new f,u=t.apply(e,i.concat(a.call(arguments))),Object(u)===u?u:e):t.apply(n,i.concat(a.call(arguments)))},r});e.csstransitions=function(){return f("transition")};for(s in e)y(e,s)&&(o=s.toLowerCase(),r[o]=e[s](),l.push((r[o]?"":"no-")+o));return r.addTest=function(n,t){if(typeof n=="object")for(var u in n)y(n,u)&&r.addTest(u,n[u]);else{if(n=n.toLowerCase(),r[n]!==i)return r;t=typeof t=="function"?t():t;typeof h!="undefined"&&h&&(c.className+=" "+(t?"":"no-")+n);r[n]=t}return r},p(""),b=rt=null,function(n,t){function v(n,t){var i=n.createElement("p"),r=n.getElementsByTagName("head")[0]||n.documentElement;return i.innerHTML="x<style>"+t+"<\/style>",r.insertBefore(i.lastChild,r.firstChild)}function s(){var n=r.elements;return typeof n=="string"?n.split(" "):n}function u(n){var t=a[n[l]];return t||(t={},o++,n[l]=o,a[o]=t),t}function h(n,r,f){if(r||(r=t),i)return r.createElement(n);f||(f=u(r));var e;return e=f.cache[n]?f.cache[n].cloneNode():b.test(n)?(f.cache[n]=f.createElem(n)).cloneNode():f.createElem(n),e.canHaveChildren&&!w.test(n)?f.frag.appendChild(e):e}function y(n,r){if(n||(n=t),i)return n.createDocumentFragment();r=r||u(n);for(var e=r.frag.cloneNode(),f=0,o=s(),h=o.length;f<h;f++)e.createElement(o[f]);return e}function p(n,t){t.cache||(t.cache={},t.createElem=n.createElement,t.createFrag=n.createDocumentFragment,t.frag=t.createFrag());n.createElement=function(i){return r.shivMethods?h(i,n,t):t.createElem(i)};n.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+s().join().replace(/\w+/g,function(n){return t.createElem(n),t.frag.createElement(n),'c("'+n+'")'})+");return n}")(r,t.frag)}function c(n){n||(n=t);var f=u(n);return r.shivCSS&&!e&&!f.hasCSS&&(f.hasCSS=!!v(n,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),i||p(n,f),n}var f=n.html5||{},w=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,b=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,e,l="_html5shiv",o=0,a={},i,r;(function(){try{var n=t.createElement("a");n.innerHTML="<xyz><\/xyz>";e="hidden"in n;i=n.childNodes.length==1||function(){t.createElement("a");var n=t.createDocumentFragment();return typeof n.cloneNode=="undefined"||typeof n.createDocumentFragment=="undefined"||typeof n.createElement=="undefined"}()}catch(r){e=!0;i=!0}})();r={elements:f.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:f.shivCSS!==!1,supportsUnknownElements:i,shivMethods:f.shivMethods!==!1,type:"default",shivDocument:c,createElement:h,createDocumentFragment:y};n.html5=r;c(t)}(this,t),r._version="2.6.2",r._domPrefixes=nt,r._cssomPrefixes=g,r.testProp=function(n){return w([n])},r.testAllProps=f,r.prefixed=function(n,t,i){return t?f(n,t,i):f(n,"pfx")},c.className=c.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(h?" js "+l.join(" "):""),r}(this,this.document),function(n,t,i){function h(n){return"[object Function]"==y.call(n)}function c(n){return"string"==typeof n}function l(){}function w(n){return!n||"loaded"==n||"complete"==n||"uninitialized"==n}function f(){var n=a.shift();v=1;n?n.t?s(function(){("c"==n.t?u.injectCss:u.injectJs)(n.s,0,n.a,n.x,n.e,1)},0):(n(),f()):v=0}function ut(n,i,o,h,c,l,y){function k(t){if(!nt&&w(p.readyState)&&(tt.r=nt=1,!v&&f(),p.onload=p.onreadystatechange=null,t)){"img"!=n&&s(function(){g.removeChild(p)},50);for(var u in r[i])r[i].hasOwnProperty(u)&&r[i][u].onload()}}var y=y||u.errorTimeout,p=t.createElement(n),nt=0,b=0,tt={t:o,s:i,e:c,a:l,x:y};1===r[i]&&(b=1,r[i]=[]);"object"==n?p.data=i:(p.src=i,p.type=n);p.width=p.height="0";p.onerror=p.onload=p.onreadystatechange=function(){k.call(this,b)};a.splice(h,0,tt);"img"!=n&&(b||2===r[i]?(g.insertBefore(p,d?null:e),s(k,y)):r[i].push(p))}function ft(n,t,i,r,u){return v=0,t=t||"j",c(n)?ut("c"==t?et:nt,n,t,this.i++,i,r,u):(a.splice(this.i++,0,n),1==a.length&&f()),this}function b(){var n=u;return n.loader={load:ft,i:0},n}var o=t.documentElement,s=n.setTimeout,e=t.getElementsByTagName("script")[0],y={}.toString,a=[],v=0,k="MozAppearance"in o.style,d=k&&!!t.createRange().compareNode,g=d?o:e.parentNode,o=n.opera&&"[object Opera]"==y.call(n.opera),o=!!t.attachEvent&&!o,nt=k?"object":o?"script":"img",et=o?"script":nt,tt=Array.isArray||function(n){return"[object Array]"==y.call(n)},p=[],r={},it={timeout:function(n,t){return t.length&&(n.timeout=t[0]),n}},rt,u;u=function(n){function a(n){for(var n=n.split("!"),f=p.length,i=n.pop(),e=n.length,i={url:i,origUrl:i,prefixes:n},u,r,t=0;t<e;t++)r=n[t].split("="),(u=it[r.shift()])&&(i=u(i,r));for(t=0;t<f;t++)i=p[t](i);return i}function f(n,t,u,f,e){var o=a(n),s=o.autoCallback;o.url.split(".").pop().split("?").shift();o.bypass||(t&&(t=h(t)?t:t[n]||t[f]||t[n.split("/").pop().split("?")[0]]),o.instead?o.instead(n,t,u,f,e):(r[o.url]?o.noexec=!0:r[o.url]=1,u.load(o.url,o.forceCSS||!o.forceJS&&"css"==o.url.split(".").pop().split("?").shift()?"c":i,o.noexec,o.attrs,o.timeout),(h(t)||h(s))&&u.load(function(){b();t&&t(o.origUrl,e,f);s&&s(o.origUrl,e,f);r[o.url]=2})))}function s(n,t){function a(n,o){if(n){if(c(n))o||(i=function(){var n=[].slice.call(arguments);s.apply(this,n);u()}),f(n,i,t,0,e);else if(Object(n)===n)for(r in v=function(){var t=0;for(var i in n)n.hasOwnProperty(i)&&t++;return t}(),n)n.hasOwnProperty(r)&&(!o&&!--v&&(h(i)?i=function(){var n=[].slice.call(arguments);s.apply(this,n);u()}:i[r]=function(n){return function(){var t=[].slice.call(arguments);n&&n.apply(this,t);u()}}(s[r])),f(n[r],i,t,r,e))}else o||u()}var e=!!n.test,o=n.load||n.both,i=n.callback||l,s=i,u=n.complete||l,v,r;a(e?n.yep:n.nope,!!o);o&&a(o)}var e,t,o=this.yepnope.loader;if(c(n))f(n,0,o,0);else if(tt(n))for(e=0;e<n.length;e++)t=n[e],c(t)?f(t,0,o,0):tt(t)?u(t):Object(t)===t&&s(t,o);else Object(n)===n&&s(n,o)};u.addPrefix=function(n,t){it[n]=t};u.addFilter=function(n){p.push(n)};u.errorTimeout=1e4;null==t.readyState&&t.addEventListener&&(t.readyState="loading",t.addEventListener("DOMContentLoaded",rt=function(){t.removeEventListener("DOMContentLoaded",rt,0);t.readyState="complete"},0));n.yepnope=b();n.yepnope.executeStack=f;n.yepnope.injectJs=function(n,i,r,o,h,c){var a=t.createElement("script"),v,y,o=o||u.errorTimeout;a.src=n;for(y in r)a.setAttribute(y,r[y]);i=c?f:i||l;a.onreadystatechange=a.onload=function(){!v&&w(a.readyState)&&(v=1,i(),a.onload=a.onreadystatechange=null)};s(function(){v||(v=1,i(1))},o);h?a.onload():e.parentNode.insertBefore(a,e)};n.yepnope.injectCss=function(n,i,r,u,o,h){var u=t.createElement("link"),c,i=h?f:i||l;u.href=n;u.rel="stylesheet";u.type="text/css";for(c in r)u.setAttribute(c,r[c]);o||(e.parentNode.insertBefore(u,e),s(i,0))}}(this,document);Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};$event=$.event;$special=$event.special.debouncedresize={setup:function(){$(this).on("resize",$special.handler)},teardown:function(){$(this).off("resize",$special.handler)},handler:function(n,t){var r=this,u=arguments,i=function(){n.type="debouncedresize";$event.dispatch.apply(r,u)};resizeTimeout&&clearTimeout(resizeTimeout);t?i():resizeTimeout=setTimeout(i,$special.threshold)},threshold:250};BLANK="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";$.fn.imagesLoaded=function(n){function s(){var f=$(o),e=$(u);t&&(u.length?t.reject(i,f,e):t.resolve(i));$.isFunction(n)&&n.call(r,i,f,e)}function f(n,r){n.src!==BLANK&&$.inArray(n,e)===-1&&(e.push(n),r?u.push(n):o.push(n),$.data(n,"imagesLoaded",{isBroken:r,src:n.src}),h&&t.notifyWith($(n),[r,i,$(o),$(u)]),i.length===e.length&&(setTimeout(s),i.unbind(".imagesLoaded")))}var r=this,t=$.isFunction($.Deferred)?$.Deferred():0,h=$.isFunction(t.notify),i=r.find("img").add(r.filter("img")),e=[],o=[],u=[];return $.isPlainObject(n)&&$.each(n,function(i,r){i==="callback"?n=r:t&&t[i](r)}),i.length?i.bind("load.imagesLoaded error.imagesLoaded",function(n){f(n.target,n.type==="error")}).each(function(n,t){var r=t.src,i=$.data(t,"imagesLoaded");if(i&&i.src===r){f(t,i.isBroken);return}if(t.complete&&t.naturalWidth!==undefined){f(t,t.naturalWidth===0||t.naturalHeight===0);return}(t.readyState||t.complete)&&(t.src=BLANK,t.src=r);f(t,!0)}):s(),t?t.promise(r):r};$.fn.grid=function(){var r=[],n=[],f=function(){function d(n){t=n.grid;i=t.children();e=$(window);a=$("html, body");r=$.extend(!0,{},r,n);t.imagesLoaded(function(){y(!0);w();tt()})}function g(){return t}function nt(n){i=i.add(n);n.each(function(){var n=$(this);n.data({offsetTop:n.offset().top,height:n.height()})});p(n)}function y(n){i.each(function(){var t=$(this);t.data("offsetTop",t.offset().top);n&&t.data("height",t.outerHeight())})}function tt(){p(i);e.on("debouncedresize",function(){h=0;f=-1;y();w();var t=n;t!=null&&b()})}function p(n){n.unbind("click");n.find(".openPreview").unbind("click");n.on("click","span.og-close",function(){return s(),!1}).find(".openPreview").on("click",function(){var n=it($(this));return u===n.index()?b():l(n),!1})}function it(n){var t;return i.each(function(i,r){var u=$(r).find(n);if(u.length>0)return t=$(r),!1}),t}function w(){winsize={width:e.width(),height:e.height()}}function l(i){var r=n,u=Math.floor(i.offset().top);if(h=0,r!=null)if(f!==u)u>f&&(h=r.height),s(),u=i.offset().top-r.$previewEl.innerHeight()-c;else return r.update(i),t.trigger("previewOpen",[i,r]),!1;i.data("height",i.outerHeight());f=u;r=n=new k(i);r.open()}function s(){if(n!=null){var i=n.$item;n.$item.removeClass("og-expanded");n.$item.css("height","");n.$previewEl.remove();n=null;u=-1;t.trigger("previewClose",[i])}}function rt(n){var t=parseInt(n.offset().top);t!=f&&s();l(n)}function b(){u=-1;var t=n;t!=null&&t.close();n=null}function k(n){this.$item=n;this.expandedIdx=this.$item.index();this.create();this.update()}var t,i,n=null,u=-1,f=-1,h=0,c=50,e,a,v={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"}[Modernizr.prefixed("transition")],o=Modernizr.csstransitions,r={minHeight:500,speed:100,easing:"ease",showVisitButton:!0};return k.prototype={create:function(){this.$closePreview=$('<span class="og-close"><\/span>');this.$previewInner=$('<div id="og-expander-inner" class="og-expander-inner"><\/div>').append(this.$closePreview);this.$previewEl=$('<div class="og-expander"><\/div>').append(this.$previewInner);this.$item.append(this.getEl());o&&this.setTransition()},update:function(n){var r,f;n&&(this.$item=n);u!==-1&&(r=i.eq(u),r.removeClass("og-expanded"),this.$item.addClass("og-expanded"),this.positionPreview());u=this.$item.index();f=this;t.trigger("previewUpdate",[this.$item,this.$previewEl])},open:function(){this.setHeights();this.positionPreview()},close:function(){var n=this,r=function(){o&&$(this).off(v);var r=i.eq(this.expandedIdx);n.$item.removeClass("og-expanded");n.$previewEl.remove();t.trigger("previewClose",[n.$item])},u;typeof this.$largeImg!="undefined"&&this.$largeImg.fadeOut("fast");this.$previewEl.css("height",0);u=i.eq(this.expandedIdx);u.css("height","").on(v,r);return o||r.call(),n.$item.removeClass("open"),!1},calcHeight:function(){var n=this.$previewEl.children().innerHeight(),t=this.$previewEl.children().innerHeight()+this.$item.data("height")+c;this.height=n;this.itemHeight=t},setHeights:function(){var n=this;this.calcHeight();this.$previewEl.css("height",this.height);this.$item.css("height",this.itemHeight);this.$item.addClass("og-expanded");t.trigger("previewOpen",[n.$item,n.$preview]);o||onEndFn.call()},positionPreview:function(){var t=this.$item.offset().top,n=this.$previewEl.offset().top,i=this.height+this.$item.innerHeight()+c<=winsize.height?t:this.height<winsize.height?n-(winsize.height-this.height):n;a.animate({scrollTop:i},r.speed)},setTransition:function(){this.$previewEl.css("transition","height "+r.speed+"ms "+r.easing);this.$item.css("transition","height "+r.speed+"ms "+r.easing)},getEl:function(){return this.$previewEl}},{init:d,addItems:nt,showPreview:l,removePreview:s,Grid:g,nextPreview:rt}},t,i,u;this.each(function(t,i){$.inArray($(i),r)==-1&&(n.push(new f),n[n.length-1].init({grid:$(i)}),r.push($(i)))});t=this;i=function(n){return t.index(n)};this.unbind("previewOpen");this.on("previewOpen",function(){var r=$(t).not($(this));r.each(function(t,r){var u=i(r);u!=-1&&n[u].removePreview()})});return u=function(t,r){var u=i(r);u!=-1&&n[u].nextPreview(t)},{next:u}}