/*! Tiles.js | http://thinkpixellab.com/tilesjs | 2012-12-03 */ var Tiles={};(function(e){var t=Tiles.Tile=function(t,n){this.id=t,this.top=0,this.left=0,this.width=0,this.height=0,this.$el=e(n||document.createElement("div"))};t.prototype.appendTo=function(e,t,n,r){this.$el.hide().appendTo(e),t?this.$el.delay(n).fadeIn(r):this.$el.show()},t.prototype.remove=function(t,n){t?this.$el.fadeOut({complete:function(){e(this).remove()}}):this.$el.remove()},t.prototype.resize=function(e,t,n,r,i){var s={},o=!1;this.left!==t.x&&(s.left=t.x,this.left=t.x,o=!0),this.top!==t.y&&(s.top=t.y,this.top=t.y,o=!0),this.width!==t.width&&(s.width=t.width,this.width=t.width,o=!0),this.height!==t.height&&(s.height=t.height,this.height=t.height,o=!0);var u=this,a=function(){var e=u.$el[0];u.left!==e.offsetLeft&&u.$el.css("left",u.left),u.top!==e.offsetTop&&u.$el.css("top",u.top),i&&i()};n&&o?this.$el.animate(s,{duration:r,easing:"swing",complete:a}):(o&&this.$el.css(s),setTimeout(a,r))}})(jQuery),function(e){function n(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r}var t=function(e){var t=[],n=e.length,r,i,s,o,u;for(i=0;i0?n[0].length:0,n.length)},Tiles.Template.prototype.toJSON=function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t=e.length,n=0,r=[],i,s,o,u,a,f;for(a=0;a1||o.height>1){f=e[n];for(a=0;ar||t.top+t.heighti||t.left+t.widthr||n.y+n.heighti||n.x+n.width0&&(this.numCols=e,this.isDirty=!0);var t=this.resizeCellSize();this.cellSize!==t&&t>0&&(this.cellSize=t,this.isDirty=!0)},t.prototype.updateTiles=function(t){t=n(t);var r=t.length,i=[],s,o,u,a;for(s=this.tiles.length-1;s>=0;s--)o=this.tiles[s],a=e.inArray(o.id,t),a<0?this.tilesRemoved.push(o):i[a]=o;this.tiles=[];for(s=0;s0&&(this.template.append(this.createTemplate(this.numCols,t)),this.isDirty=!0)}},t.prototype.shouldRedraw=function(){this.cellSize<=0&&this.resize(),this.ensureTemplate(this.tiles.length);var e=this.isDirty||this.tilesAdded.length>0||this.tilesRemoved.length>0;return e},t.prototype.redraw=function(t,n){if(!this.shouldRedraw()){n&&n(!1);return}var i=this.tiles.length,s=this.priorityPageSize,o=this.animationDuration,u=this.cellSize+this.cellPadding,a=0,f=0,l=new Tiles.Rectangle(this.$el.scrollLeft(),this.$el.scrollTop(),this.$el.width(),this.$el.height()),c,h,p,d,v,m,g,y,b,w,E;for(a=0;a=0,g=w[v],y=new Tiles.Rectangle(g.x*u,g.y*u,g.width*u-this.cellPadding,g.height*u-this.cellPadding),c.resize(g,y,t&&!h&&r(l,c,y),o),h&&(b=t&&r(l,null,y),b&&this.getAppendDelay?f=this.getAppendDelay(g,p,w,c,d,E):f=0,c.appendTo(this.$el,b,f,o))}for(v=0,m=this.tilesRemoved.length;v