/*!
 * jQuery UI Widget @VERSION
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
function Matrix(){}(function(a,b){var c=Array.prototype.slice,d=a.cleanData;a.cleanData=function(b){for(var c=0,e;(e=b[c])!=null;c++)a(e).triggerHandler("remove");d(b)},a.widget=function(b,d,e){var f=b.split(".")[0],g;b=b.split(".")[1],g=f+"-"+b,e||(e=d,d=a.Widget),a.expr[":"][g]=function(c){return!!a.data(c,b)},a[f]=a[f]||{},a[f][b]=a.extend(function(c,d){if(!this._createWidget)return new a[f][b](c,d);arguments.length&&this._createWidget(c,d)},a[f][b],{version:e.version});var h=new d;h.options=a.widget.extend({},h.options),a.each(e,function(b,f){a.isFunction(f)&&(e[b]=function(){var a=function(a){return d.prototype[a].apply(this,c.call(arguments,1))},b=function(a,b){return d.prototype[a].apply(this,b)};return function(){var c=this._super,d=this._superApply,e;return this._super=a,this._superApply=b,e=f.apply(this,arguments),this._super=c,this._superApply=d,e}}())}),a[f][b].prototype=a.widget.extend(h,{namespace:f,widgetName:b,widgetEventPrefix:b,widgetBaseClass:g},e),a.widget.bridge(b,a[f][b])},a.widget.extend=function(d){var e=c.call(arguments,1),f=0,g=e.length,h,i;for(;f<g;f++)for(h in e[f])i=e[f][h],e[f].hasOwnProperty(h)&&i!==b&&(d[h]=a.isPlainObject(i)?a.widget.extend({},d[h],i):i);return d},a.widget.bridge=function(d,e){a.fn[d]=function(f){var g=typeof f=="string",h=c.call(arguments,1),i=this;return f=!g&&h.length?a.widget.extend.apply(null,[f].concat(h)):f,g?this.each(function(){var c=a.data(this,d);if(!c)return a.error("cannot call methods on "+d+" prior to initialization; "+"attempted to call method '"+f+"'");if(!a.isFunction(c[f])||f.charAt(0)==="_")return a.error("no such method '"+f+"' for "+d+" widget instance");var e=c[f].apply(c,h);if(e!==c&&e!==b)return i=e&&e.jquery?i.pushStack(e.get()):e,!1}):this.each(function(){var b=a.data(this,d);b?b.option(f||{})._init():e(f,this)}),i}},a.Widget=function(b,c){if(!this._createWidget)return new a[namespace][name](b,c);arguments.length&&this._createWidget(b,c)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(b,c){c=a(c||this.defaultElement||this)[0],this.element=a(c),this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this.bindings=a(),this.hoverable=a(),this.focusable=a(),c!==this&&(a.data(c,this.widgetName,this),this._bind({remove:"destroy"})),this._create(),this._trigger("create"),this._init()},_getCreateOptions:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled"),this.bindings.unbind("."+this.widgetName),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(c,d){var e=c,f,g,h;if(arguments.length===0)return a.widget.extend({},this.options);if(typeof c=="string"){e={},f=c.split("."),c=f.shift();if(f.length){g=e[c]=a.widget.extend({},this.options[c]);for(h=0;h<f.length-1;h++)g[f[h]]=g[f[h]]||{},g=g[f[h]];c=f.pop();if(d===b)return g[c]===b?null:g[c];g[c]=d}else{if(d===b)return this.options[c]===b?null:this.options[c];e[c]=d}}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&(this.widget().toggleClass(this.widgetBaseClass+"-disabled ui-state-disabled",!!b).attr("aria-disabled",b),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_bind:function(b,c){c?(b=a(b),this.bindings=this.bindings.add(b)):(c=b,b=this.element);var d=this;a.each(c,function(c,e){b.bind(c+"."+d.widgetName,function(){if(d.options.disabled===!0||a(this).hasClass("ui-state-disabled"))return;return(typeof e=="string"?d[e]:e).apply(d,arguments)})})},_hoverable:function(b){this.hoverable=this.hoverable.add(b),this._bind(b,{mouseenter:function(b){a(b.currentTarget).addClass("ui-state-hover")},mouseleave:function(b){a(b.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(b){this.focusable=this.focusable.add(b),this._bind(b,{focusin:function(b){a(b.currentTarget).addClass("ui-state-focus")},focusout:function(b){a(b.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(b,c,d){var e=this.options[b],f;c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),d=d||{};if(c.originalEvent)for(var g=a.event.props.length,h;g;)h=a.event.props[--g],c[h]=c.originalEvent[h];return this.element.trigger(c,d),f=a.isArray(d)?[c].concat(d):[c,d],!(a.isFunction(e)&&e.apply(this.element[0],f)===!1||c.isDefaultPrevented())}},a.each({show:"fadeIn",hide:"fadeOut"},function(b,c){a.Widget.prototype["_"+b]=function(d,e,f){typeof e=="string"&&(e={effect:e});var g,h=e?e===!0||typeof e=="number"?c:e.effect||c:b;e=e||{},typeof e=="number"&&(e={duration:e}),g=!a.isEmptyObject(e),e.complete=f,e.delay&&d.delay(e.delay),g&&a.effects&&(a.effects.effect[h]||a.uiBackCompat!==!1&&a.effects[h])?d[b](e):h!==b&&d[h]?d[h](e.duration,e.easing,f):d.queue(function(c){a(this)[b](),f&&f.call(d[0]),c()})}}),a.uiBackCompat!==!1&&(a.Widget.prototype._getCreateOptions=function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]})})(jQuery),function(){var a,b;$.fn.bindFirst=function(a,b){var c;return a=a.split(" "),c=a.length,this.each(function(){var d;while(c--)$(this).bind(a[c],b),d=$.data(this,"events")[a[c]],d.splice(0,0,d.pop())})},b={},this.loadImage=function(a,c){var d,e,f;c==null&&(c={});if(a==null)return;return d=(f=c.complete)!=null?f:function(){},b[a]!=null?d(a,b[a],!0):(e=new Image,e.onload=function(){return d(a,this),b[a]=this},e.src=a)},$.fn.loadImage=function(a){var b,c,d,e,f,g,h,i;return a==null&&(a={}),d=(f=a.complete)!=null?f:function(){},b=(g=a.dataAttr)!=null?g:"image",c=(h=a.loadedClass)!=null?h:"loaded",e=(i=a.replace)!=null?i:!1,this.each(function(){var f,g;return f=$(this),g=f.data(b),a.complete=function(a,b,g){var h,i,j=this;return e?g||(f.css({display:"none"}),i=$(b).addClass(c),i.wrapAll("<div class='small'><div class='inner' /></div>"),h=i.closest(".small"),h.css({width:b.width,height:b.height}),f.after(h)):f.css({"background-image":"url("+a+")"}).addClass(c),setTimeout(function(){return d(a,j)},1)},loadImage(g,a)})},a=[],$.preLoad=function(){var b,c,d,e;b=arguments.length,d=b,e=[];while(d--)c=document.createElement("img"),c.src=arguments[d],e.push(a.push(c));return e},$.widget("metalab.loopedList",{options:{itemSelector:"li",containerSelector:".container",nextSelector:".next",pagingSelector:".dots li",pagingActiveClass:"active",activeClass:"active",loop:!0,auto:!1,keyboard:!1},currentIndex:0,_create:function(){var a=this;typeof this._setupDOM=="function"&&this._setupDOM(),this._setupElems(),this._setupPaging(),this.$paging.each(function(a){return $.data(this,"index",a)}),this._setupNext(),this._bindPaging(),this._bindNext(),this._bind(this.element,{play:"play",pause:"pause"});if(this.options.keyboard)return $(document).bindFirst("keydown",function(b){return a._keydown(b)}),$(document).bindFirst("keyup",function(b){return a._keyup(b)})},_setupElems:function(){return this.$elems=this.element.find(this.options.itemSelector)},_setupPaging:function(){return this.$paging=this.element.find(this.options.pagingSelector)},_bindPaging:function(){return this._bind(this.$paging,{mousedown:"_pagingClick"})},_setupNext:function(){return this.$nextButton=this.element.find(this.options.nextSelector)},_bindNext:function(){return this._bind(this.$nextButton,{mousedown:"_nextClick"})},_pagingClick:function(a,b){if($(a.target).hasClass("active"))return;return a.preventDefault(),this.showIndex($(a.target).data("index"))},_nextClick:function(a,b){return a.preventDefault(),this.showNext()},_keydown:function(a){if(!this.active)return a;if(a.keyCode===39)return a.preventDefault();if(a.keyCode===37)return a.preventDefault()},_keyup:function(a){if(!this.active)return a;if(a.keyCode===39)return a.preventDefault(),this.showNext();if(a.keyCode===37)return a.preventDefault(),this.showPrevious()},active:!0,play:function(){var a=this;this.active=!0;if(this.options.auto)return this.interval=setInterval(function(){return a.showNext()},this.options.auto)},pause:function(){this.active=!1;if(this.interval!=null)return clearInterval(this.interval)},restartTimer:function(){return this.pause(),this.play()},length:function(){return this.$elems.length},currentElem:function(){return $(this.$elems[this.currentIndex])},showPrevious:function(){return this.moveTo(this.currentIndex-1)},showNext:function(){return this.moveTo(this.currentIndex+1)},moveTo:function(a){if(a>this.$elems.length-1){if(!this.options.loop)return!1;a=0}if(a<0){if(!this.options.loop)return!1;a=this.$elems.length-1}return this.showIndex(a)},showIndex:function(a){this.$paging.removeClass(this.options.pagingActiveClass);if(this.$paging.length)return this.$paging.eq(a).addClass(this.options.pagingActiveClass)},showSpinner:function(){return this.spinnerTimeout=setTimeout(function(){return $(".spinner").addClass("on")},200)},hideSpinner:function(){return this.spinnerTimeout&&clearTimeout(this.spinnerTimeout),$(".spinner").removeClass("on")},preloadNextFewSmall:function(a){var b,c,d,e;c=a+3,b=$(".list-container .screenshot"),d=b.length,e=[];while(a<d&&a<c)jQuery.preLoad(b.eq(a).attr("data-image")),e.push(++a);return e},preloadNextBig:function(a,b){var c,d,e,f;d=a+1,c=$(".list-container .screenshot"),e=c.length,f=[];while(a<e&&a<d)jQuery.preLoad(c.eq(a).attr("data-image-big")),f.push(++a);return f}})}.call(this),$.easing.jswing=$.easing.swing,$.extend($.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return $.easing[$.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return b==0?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=e*.3,h=d;return b==0?c:(b/=e)==1?c+d:(h<Math.abs(d)?(h=d,f=g/4):f=g/(2*Math.PI)*Math.asin(d/h),-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c)},easeOutElastic:function(a,b,c,d,e){var f=1.70158,g=e*.3,h=d;return b==0?c:(b/=e)==1?c+d:(h<Math.abs(d)?(h=d,f=g/4):f=g/(2*Math.PI)*Math.asin(d/h),h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c)},easeInOutElastic:function(a,b,c,d,e){var f=1.70158,g=e*.3*1.5,h=d;return b==0?c:(b/=e/2)==2?c+d:(h<Math.abs(d)?(h=d,f=g/4):f=g/(2*Math.PI)*Math.asin(d/h),b<1?-0.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c:h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)*.5+d+c)},easeInBack:function(a,b,c,d,e,f){return f==undefined&&(f=1.70158),d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){return f==undefined&&(f=1.70158),d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){return f==undefined&&(f=1.70158),(b/=e/2)<1?d/2*b*b*(((f*=1.525)+1)*b-f)+c:d/2*((b-=2)*b*(((f*=1.525)+1)*b+f)+2)+c},easeInBounce:function(a,b,c,d,e){return d-$.easing.easeOutBounce(a,e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?d*7.5625*b*b+c:b<2/2.75?d*(7.5625*(b-=1.5/2.75)*b+.75)+c:b<2.5/2.75?d*(7.5625*(b-=2.25/2.75)*b+.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+.984375)+c},easeInOutBounce:function(a,b,c,d,e){return b<e/2?$.easing.easeInBounce(a,b*2,0,d,e)*.5+c:$.easing.easeOutBounce(a,b*2-e,0,d,e)*.5+d*.5+c}});var Sylvester={version:"0.1.3",precision:1e-6};Matrix.prototype={e:function(a,b){return a<1||a>this.elements.length||b<1||b>this.elements[0].length?null:this.elements[a-1][b-1]},map:function(a){var b=[],c=this.elements.length,d=c,e,f,g=this.elements[0].length,h;do{e=d-c,f=g,b[e]=[];do h=g-f,b[e][h]=a(this.elements[e][h],e+1,h+1);while(--f)}while(--c);return Matrix.create(b)},multiply:function(a){if(!a.elements)return this.map(function(b){return b*a});var b=a.modulus?!0:!1,c=a.elements||a;typeof c[0][0]=="undefined"&&(c=Matrix.create(c).elements);if(!this.canMultiplyFromLeft(c))return null;var d=this.elements.length,e=d,f,g,h=c[0].length,i,j=this.elements[0].length,k=[],l,m,n;do{f=e-d,k[f]=[],g=h;do{i=h-g,l=0,m=j;do n=j-m,l+=this.elements[f][n]*c[n][i];while(--m);k[f][i]=l}while(--g)}while(--d);var c=Matrix.create(k);return b?c.col(1):c},x:function(a){return this.multiply(a)},canMultiplyFromLeft:function(a){var b=a.elements||a;return typeof b[0][0]=="undefined"&&(b=Matrix.create(b).elements),this.elements[0].length==b.length},setElements:function(a){var b,c=a.elements||a;if(typeof c[0][0]!="undefined"){var d=c.length,e=d,f,g,h;this.elements=[];do{b=e-d,f=c[b].length,g=f,this.elements[b]=[];do h=g-f,this.elements[b][h]=c[b][h];while(--f)}while(--d);return this}var i=c.length,j=i;this.elements=[];do b=j-i,this.elements.push([c[b]]);while(--i);return this}},Matrix.create=function(a){var b=new Matrix;return b.setElements(a)},$M=Matrix.create,function(a){if(!a.cssHooks)throw"jQuery 1.4.3+ is needed for this plugin to work";var b="",c="transform",d,e,f,g,h,i=c.charAt(0).toUpperCase()+c.slice(1),j=["Moz","Webkit","O","ms"],k=document.createElement("div");if(c in k.style)e=c,f=k.style.perspective!==undefined;else for(var l=0;l<j.length;l++){d=j[l]+i;if(d in k.style){e=d,j[l]==="Moz"&&(b="px"),j[l]+"Perspective"in k.style?f=!0:g=!0;break}}/Chrome\/13/.test(navigator.userAgent)&&(f=!1,g=!0),e||(h="filter"in k.style,e="filter"),k=null,a.support[c]=e;var m=e,n={rotateX:{defaultValue:0,matrix:function(a){return f?$M([[1,0,0,0],[0,Math.cos(a),Math.sin(-a),0],[0,Math.sin(a),Math.cos(a),0],[0,0,0,1]]):$M([[1,0,0],[0,1,0],[0,0,1]])}},rotateY:{defaultValue:0,matrix:function(a){return f?$M([[Math.cos(a),0,Math.sin(a),0],[0,1,0,0],[Math.sin(-a),0,Math.cos(a),0],[0,0,0,1]]):$M([[1,0,0],[0,1,0],[0,0,1]])}},rotateZ:{defaultValue:0,matrix:function(a){return f?$M([[Math.cos(a),Math.sin(-a),0,0],[Math.sin(a),Math.cos(a),0,0],[0,0,1,0],[0,0,0,1]]):$M([[Math.cos(a),Math.sin(-a),0],[Math.sin(a),Math.cos(a),0],[0,0,1]])}},scale:{defaultValue:1,matrix:function(a){return f?$M([[a,0,0,0],[0,a,0,0],[0,0,a,0],[0,0,0,1]]):$M([[a,0,0],[0,a,0],[0,0,1]])}},translateX:{defaultValue:0,matrix:function(a){return f?$M([[1,0,0,0],[0,1,0,0],[0,0,1,0],[a,0,0,1]]):$M([[1,0,0],[0,1,0],[a,0,1]])}},translateY:{defaultValue:0,matrix:function(a){return f?$M([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,a,0,1]]):$M([[1,0,0],[0,1,0],[0,a,1]])}},translateZ:{defaultValue:0,matrix:function(a){return f?$M([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,a,1]]):$M([[1,0,0],[0,1,0],[0,0,1]])}}},o=function(c){var d=a(c).data("transforms"),e;f?e=$M([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]):e=$M([[1,0,0],[0,1,0],[0,0,1]]);for(var i in n)e=e.x(n[i].matrix(d[i]||n[i].defaultValue));f?(s="matrix3d(",s+=e.e(1,1).toFixed(10)+","+e.e(1,2).toFixed(10)+","+e.e(1,3).toFixed(10)+","+e.e(1,4).toFixed(10)+",",s+=e.e(2,1).toFixed(10)+","+e.e(2,2).toFixed(10)+","+e.e(2,3).toFixed(10)+","+e.e(2,4).toFixed(10)+",",s+=e.e(3,1).toFixed(10)+","+e.e(3,2).toFixed(10)+","+e.e(3,3).toFixed(10)+","+e.e(3,4).toFixed(10)+",",s+=e.e(4,1).toFixed(10)+","+e.e(4,2).toFixed(10)+","+e.e(4,3).toFixed(10)+","+e.e(4,4).toFixed(10),s+=")"):g?(s="matrix(",s+=e.e(1,1).toFixed(10)+","+e.e(1,2).toFixed(10)+",",s+=e.e(2,1).toFixed(10)+","+e.e(2,2).toFixed(10)+",",s+=e.e(3,1).toFixed(10)+b+","+e.e(3,2).toFixed(10)+b,s+=")"):h&&(s="progid:DXImageTransform.Microsoft.",s+="Matrix(",s+="M11="+e.e(1,1).toFixed(10)+",",s+="M12="+e.e(1,2).toFixed(10)+",",s+="M21="+e.e(2,1).toFixed(10)+",",s+="M22="+e.e(2,2).toFixed(10)+",",s+="SizingMethod='auto expand'",s+=")",c.style.top=e.e(3,1),c.style.left=e.e(3,2)),c.style[m]=s},p=function(b){return a.fx.step[b]=function(c){a.cssHooks[b].set(c.elem,c.now+c.unit)},{get:function(c,d,e){var f=a(c).data("transforms");return f===undefined&&(f={},a(c).data("transforms",f)),f[b]||n[b].defaultValue},set:function(c,d){var e=a(c).data("transforms");e===undefined&&(e={});var f=n[b];typeof f.apply=="function"?e[b]=f.apply(e[b]||f.defaultValue,d):e[b]=d,a(c).data("transforms",e),o(c)}}};if(m)for(var q in n)a.cssHooks[q]=p(q),a.cssNumber[q]=!0;a.fn.clearMatrix=function(){return this.each(function(){this.style[m]="none"})}}(jQuery),$.widget("metalab.fullscreenViewer",$.metalab.loopedList,{widgetClass:"fullscreen_viewer",options:{overlayId:"fullscreen",navId:"fullscreen_nav",bodyFullscreenClass:"fullscreen",titleContainerSelector:".title",titlesSelector:".screenshot-title",linkedController:null},_create:function(){var a=this;return this.$overlay=$("<div id='"+this.options.overlayId+"' />").appendTo(document.body),this.$nav=$("<div id='"+this.options.navId+"'><div class='container' /></div>").appendTo(document.body),this.$nav.find(".container").append($("#nav_template").html()),this.$titleContainer=this.$nav.find(this.options.titleContainerSelector),this.$titleElems=this.$titleContainer.find(this.options.titlesSelector),this.$overlay.click(function(b){return a.hide()}),$(".full").live("click",function(){return a.hide()}),this._super("_create")},_setupElems:function(){return this.$elems=this.options.$elems},_setupPaging:function(){return this.$paging=this.$nav.find(this.options.pagingSelector)},_setupNext:function(){return this.$nextButton=this.$nav.find(this.options.nextSelector)},isVisible:!1,isAnimating:!1,titleDuration:400,_prepLargeSize:function(a,b,c){var d,e=this;return d=$(a).closest(".small").siblings(".full"),d.length?c(d,d.data()):(this.showSpinner(),loadImage(b,{complete:function(b,d){var f,g,h,i,j,k,l;return e.hideSpinner(),l=a.width/d.width,k=958-d.width,i=-Math.ceil((d.height-d.height*l)/2-24),g=k/2-1,j=$(document.createElement("div")).addClass("inner").append(d),f=$(document.createElement("div")).addClass("full").append(j),$(a).closest(".screenshot-container").hasClass("iphone")&&(g-=78),h={zoomRatio:l,zoomOffset:k,topOffset:i,leftOffset:g},f.data(h),f.css({left:h.leftOffset,top:h.topOffset,display:"none"}),c(f,h)}}))},showIndex:function(a){var b,c,d,e=this;return this.isAnimating?!1:(d=$(this.$elems[a]),c=d.find(".screenshot"),b=c.data("image-big"),this.showSpinner(),c.loadImage({replace:!0,complete:function(){var c;return e.hideSpinner(),c=d.find("img"),e._prepLargeSize(c[0],b,function(b,c){var f,g,h;b[0].parentNode||d.append(b);if(e.isVisible){if(a===e.currentIndex)return!1;e.isAnimating=!0,b.css({top:0,left:c.zoomOffset/2-1,display:"block"}),b.clearMatrix(),(h=e.options.linkedController)!=null&&h.screenshots("showIndex",a,"slide",function(){return e.isAnimating=!1})}else $(document.body).addClass(e.options.bodyFullscreenClass),b.css({top:c.topOffset,scale:c.zoomRatio,display:"block"}),setTimeout(function(){return e.isAnimating=!0,b.animate({top:0,scale:1,left:c.zoomOffset/2-1},300,"easeOutQuad",function(){return b.clearMatrix(),e.isAnimating=!1,e.isVisible=!0})},15);return g=$(e.$titleElems[a]),f=$(e.$titleElems[e.currentIndex]),f.animate({opacity:0},e.titleDuration/2,"linear",function(){return setTimeout(function(){return g.animate({opacity:1},e.titleDuration/2,"linear")},10)}),e.currentIndex=a,e.preloadNextBig(a+1)})}}),this._super("showIndex",a,"slide"))},_titleElemFromTop:function(a){return a*this.$titleElems.first().height()},_keyup:function(a){return this.isVisible?(a.stopImmediatePropagation(),a.keyCode===27?(a.preventDefault(),this.hide()):this._super("_keyup",a)):a},hide:function(a){var b,c,d,e,f=this;if(!this.isVisible)return;return e=$(this.$elems[this.currentIndex]),c=e.find(".small, .full"),d=$(c[0]),b=$(c[1]),setTimeout(function(){return Modernizr.csstransforms&&b.animate({top:b.data("topOffset"),scale:b.data("zoomRatio"),left:b.data("leftOffset")},300,"easeInOutQuad",function(){return $(".screenshot-container .full").hide(),b.clearMatrix()}),setTimeout(function(){return $(document.body).removeClass(f.options.bodyFullscreenClass),f.isVisible=!1},300)},1)}}),$.widget("metalab.screenshots",$.metalab.loopedList,{widgetClass:"screenshots",options:{screenshotSelector:".screenshot",titleContainerSelector:".title",titlesSelector:".screenshot-title"},completedLoadingAnimation:!1,isAnimating:!1,_create:function(){var a=this;return this._super("_create"),this.$titleContainer=this.element.find(this.options.titleContainerSelector),this.$titleElems=this.$titleContainer.find(this.options.titlesSelector),this.$container=this.element.find(this.options.containerSelector),Modernizr.csstransitions&&(this.$fullscreen=$("<div />").appendTo(document.body),this.$fullscreen.fullscreenViewer({linkedController:this.element,$elems:this.$elems,keyboard:this.options.keyboard}),this.$container.click(function(b){var c;return b.preventDefault(),c=a.$fullscreen.data("fullscreenViewer"),c.isVisible?c.hide():c.showIndex(a.currentIndex)})),this.showIndex(this.currentIndex),this.play()},showIndex:function(a,b,c){var d,e=this;b==null&&(b="pop");if(this.isAnimating)return;return this.completedLoadingAnimation&&this.showSpinner(),this.isAnimating=!0,d=$(this.$elems[a]).find(this.options.screenshotSelector),d.loadImage({replace:!0,complete:function(){return e.hideSpinner(),e._animateTo(a,b,c)}}),this._super("showIndex",a,b,c)},_elemFromLeft:function(a){return a*this.$elems.first().width()},_pagingClick:function(a,b){return this._super("_pagingClick",a,b),this.restartTimer()},_nextClick:function(a,b){return this._super("_nextClick",a,b),this.restartTimer()},introDuration:400,titleDuration:400,nextDuration:400,_animateTo:function(a,b,c){var d,e,f,g=this;return b==null&&(b="pop"),this.$elems.removeClass(this.options.activeClass),d=$(this.$elems[a]).addClass(this.options.activeClass),b==="pop"?this._animateToPop(a,d,c):this._animateToSlide(a,d,c),f=$(this.$titleElems[a]),e=$(this.$titleElems[this.currentIndex]),e.animate({opacity:0},this.titleDuration,"linear",function(){return setTimeout(function(){return g.$titleElems.stop().css({opacity:0}),f.animate({opacity:1},g.titleDuration)},10)}),this.completedLoadingAnimation||(this.completedLoadingAnimation=!0,Modernizr.csstransforms?this._animateIntroWithCSS(d,this.introDuration,function(){return g.isAnimating=!1}):d.animate({"margin-top":0},this.introDuration,"linear",function(){return g.isAnimating=!1})),this.currentIndex=a,this.preloadNextFewSmall(a),this.preloadNextBig(a)},_animateIntroWithCSS:function(a,b,c){return a.css({translateY:388,opacity:0}),setTimeout(function(){return a.animate({translateY:0,opacity:1},b,"easeInOutQuad",function(){return a.clearMatrix(),typeof c=="function"?c():void 0})},25)},_animateToPop:function(a,b,c){var d,e=this;if(!this.completedLoadingAnimation)return;return Modernizr.csstransforms?(d=this.currentElem(),d.css({"z-index":10}),b.find(".small .inner").css({height:388}),b.css({translateX:0,scale:1,"z-index":1,opacity:1}),d.animate({opacity:0,scale:1.5},this.nextDuration,"easeInOutQuad",function(){return e.isAnimating=!1,d.removeAttr("style"),typeof c=="function"?c():void 0})):this._animateToSlide(a,b),this},_animateToSlide:function(a,b,c){var d,e,f=this;if(!this.completedLoadingAnimation)return;return Modernizr.csstransforms?(d=this.currentElem(),e=a>this.currentIndex?1:-1,b.css({translateX:998*e,opacity:0,scale:1}),this._animateNextSlideWithCSS(d,b,e,this.nextDuration,function(){return f.isAnimating=!1,typeof c=="function"?c():void 0})):this.$container.animate({left:-this._elemFromLeft(a)},{duration:this.nextDuration,complete:function(){return f.isAnimating=!1}}),this},_animateNextSlideWithCSS:function(a,b,c,d,e){return a.animate({translateX:-998*c,opacity:0},d,"easeInOutQuad",function(){return a.removeAttr("style")}),b.animate({translateX:0,opacity:1},d,"easeInOutQuad",function(){return b.clearMatrix(),typeof e=="function"?e():void 0})}}),function(){var a;$(window).load(function(){return $("#clients").screenshots({itemSelector:".screenshot-container",containerSelector:".list-container",loop:!0,keyboard:!0})}),a=quotes[Math.floor(Math.random()*quotes.length)],$("li.kind_word").css("background-image","url(http://static1.metalabdesign.com/images/"+a.image+")").find(" .quote q").text(a.quote).end().find(".quote cite strong").text(a.author).end().find(".quote cite span").text(", "+a.title).end().find(".quote").show()}.call(this)
