(function(a,b){(function(a,b){if(!a.every||!a.filter||!a.indexOf||!a.map||!a.reduce||!a.some||!a.forEach)throw new Error("See "+b+" for reference versions of Array.prototype methods available in JS 1.8")})([],"https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/");var c,d={},e={},f=[],g=0,h=0,i=encodeURIComponent,j=decodeURIComponent,k="hasOwnProperty",l="=",m="/",n="#",o=/\*|:|\?/,p=/(^([^\*:\?]+):\*)|(^\*$)/,q=/^:([^\*:\?]+)(\??)$/,r=/^([^\*:\?]+):(\??)$/,s=new RegExp("([^"+m+"])$"),t=typeof window!="undefined"?window:{},u=function(a){return typeof a!="string"||!a.length},v=function(a){return[a.method,a.route].join("|")},w=function(a){var b="parse",e=f.filter(function(b){return a.replace(s,"$1"+m).indexOf(b)===0}).filter(function(a,b){return!b||d[a].some(function(a){return!!a.rules.star})});return e.length?e.reduce(function(e,f){var g=d[f].map(function(d){var e={},g=d.rules.scalars,h=d.rules.keyvals,i,n=a.replace(f,"").split(m).reduce(function(a,b){var c=b.split(l),d=c[0],e=c.slice(1).join(l);return b.length?e?a.keyvals[d]=e:a.scalars.push(b):a,a},{keyvals:{},scalars:[]}),o,p,q=h.reduce(function(a,b){return(a[b.name]=0)||a},{}),r=g.filter(function(a){return a.required}).length,s=h.filter(function(a){return a.required}).every(function(a){return n.keyvals[k](a.name)});if(r>n.scalars.length||!s)return 0;if(!d.rules.star){if(n.scalars.length>g.length)return 0;for(p in n.keyvals)if(n.keyvals[k](p)&&!q[k](p))return 0}n.scalars.slice(0,g.length).forEach(function(a,b){e[g[b].name]=j(a)}),h.forEach(function(a){n.keyvals[a.name]&&(e[a.name]=j(n.keyvals[a.name])),delete n.keyvals[a.name]});if(d.rules.star){o=n.scalars.slice(g.length,n.scalars.length);for(p in n.keyvals)n.keyvals[k](p)&&o.push([p,n.keyvals[p]].join(l));e[d.rules.star]=o.join(m)}try{i=d.method.split(".").reduce(function(a,b){return a[b]},t);if(typeof i!="function")throw new Error}catch(u){throw new TypeError(b+": "+d.method+" is not a function in current context")}return{page:f,hash:c.hash({route:d.raw},e),method:i,args:e}});return e.concat(g).filter(Boolean)},[]).sort(function(a,b){return b.hash.length-a.hash.length}):[]},x=function(a){return function(b){var c="compile",d,e,f={},g=b[0]===m?b:~(e=b.indexOf(m))?b.slice(e):0,h=function(a){if(f[k](a)||(f[a]=0))throw new SyntaxError(c+': "'+a+'" is repeated in: '+b)};if(!g)throw new SyntaxError(c+": the route "+b+" was not understood");return a[g]?a[g]:(d=g.split(m).reduce(function(a,d){var e=a.rules,f=e.scalars,g=e.keyvals;if(e.star)throw new SyntaxError(c+": no rules can follow a * directive in: "+b);if(!~d.search(o)&&!f.length&&!g.length)return a.page.push(d),a;if(d.match(p))return e.star=RegExp.$2||RegExp.$3,h(e.star),a;if(d.match(q)){if(a.has_optional_scalar)throw new SyntaxError(c+': "'+d+'" cannot follow an optional rule in: '+b);return!RegExp.$2||(a.has_optional_scalar=d),f.push({name:RegExp.$1,required:!RegExp.$2}),h(RegExp.$1),a}if(d.match(r))return g.push({name:RegExp.$1,required:!RegExp.$2}),h(RegExp.$1),a;throw new SyntaxError(c+': the rule "'+d+'" was not understood in: '+b)},{page:[],rules:{scalars:[],keyvals:[],star:!1},has_optional_scalar:""}),delete d.has_optional_scalar,d.page=d.page.join(m).replace(new RegExp(m+"$"),"")||m,a[g]=d)}}({});a[b]=c={add:function(a){var b="add",g=a.method,h=a.route,i,j=v(a);if([h,g].some(u))throw new TypeError(b+": rule.route and rule.method must both be non-empty strings");if(e[j])throw new Error(b+": "+h+" to "+g+" already exists");i=x(h),e[j]=!0,!d[i.page]&&(d[i.page]=[])&&(f=f.concat(i.page).sort(function(a,b){return b.length-a.length})),d[i.page].push(c.post_add({method:g,rules:i.rules,raw:h}))},context:function(a){return t=typeof a=="object"?a:t},current:function(){return h},default_handler:function(){},get:function(){if(typeof window=="undefined")return m;var a=window.location.hash,b=a.indexOf(m);return~b?a.slice(b):m},go:function(a){typeof window!="undefined"&&(window.location.hash=(a.indexOf(n)===0?"":n)+a)},handler:function(){var a=c.get(),b=w(a),d=Array.prototype.slice.call(arguments);if(!b.length)return c.default_handler.apply(null,[a].concat(d));h=b[0],b=c.pre_dispatch(b),h=b[0],b.forEach(function(a){a.method.apply(null,[a.args].concat(d))}),g=b[0]},hash:function(a,b){var c="hash",d,e,b=b||{};if(u(a.route))throw new TypeError(c+": rule.route must be a non-empty string");return e=x(a.route),d=e.page+(e.page===m?"":m)+e.rules.scalars.map(function(d){var e=i(b[d.name]),f=b[d.name]===void 0||u(e);if(d.required&&f)throw new TypeError(c+": params."+d.name+" is undefined, route: "+a.route);return f?0:e}).concat(e.rules.keyvals.map(function(d){var e=i(b[d.name]),f=b[d.name]===void 0||u(e);if(d.required&&f)throw new TypeError(c+": params."+d.name+" is undefined, route: "+a.route);return f?0:d.name+l+e})).filter(Boolean).join(m),e.rules.star&&b[e.rules.star]&&(d+=(d[d.length-1]===m?"":m)+b[e.rules.star]),d},last:function(){return g},parse:function(a){var b="parse",c,d=a.indexOf(m);a=~d?a.slice(d):"";if(u(a))throw new TypeError(b+": hash must be a string with a "+m+" character");if(!(c=w(a)).length)throw new SyntaxError(b+": "+a+" cannot be parsed");return{page:c[0].page,args:c[0].args}},post_add:function(a){return a},pre_dispatch:function(a){return a},prefix:function(a){return n=typeof a!="undefined"?a+"":n},remove:function(a){var b="remove",c=a.method,g=a.route,h,i=v(a),j;if([g,c].some(u))throw new TypeError(b+": rule.route and rule.method must both be non-empty strings");if(!e[i])return;h=x(g),delete e[i],d[h.page]=d[h.page].filter(function(a){return a.raw!==g||a.method!==c}),!d[h.page].length&&delete d[h.page]&&~(j=f.indexOf(h.page))&&f.splice(j,1)}}})(typeof exports=="undefined"?window:exports,"RouteMap"),define("js/libs/routemap.js",function(){}),define("js/core/routeHandler",["js/libs/routemap.js"],function(){function a(a){var b=document.location.href.replace(/\/?#!\//,"/");_gaq&&_gaq.push(["_trackPageview",b]),a.handler()}function b(b,c){var d=window.RouteMap,e,f;d.prefix("#!"),e={"default":{route:"/",method:"displayHome"},home:{route:"/home",method:"displayHome"},about:{route:"/about",method:"displayAbout"},contact:{route:"/contact",method:"displayContact"},downloads:{route:"/downloads",method:"displayDownloads"},browseProjects:{route:"/projects/",method:"listProjects"},browseClients:{route:"/client/",method:"listClients"},browseProjectsForClient:{route:"/client/:client",method:"listProjects"},browseTagsByTagGroup:{route:"/grouped-by/:group",method:"listTagsForGroup"},browseIllustrationsByClientProject:{route:"/client/:client/:project/:illustration?",method:"displayProjectIllustrationBrowser"},browseIllustrationsByProject:{route:"/project/:project/:illustration?",method:"displayProjectIllustrationBrowser"},projectIllustrationThumbs:{route:"/thumbs/project/:project",method:"displayThumbnailsForProject"},clientProjectIllustrationThumbs:{route:"/thumbs/client-project/:client/:project",method:"displayThumbnailsForProject"},browseIllustrationsByTag:{route:"/tagged/:tag/:illustration?",method:"displayTagIllustrationBrowser"},taggedIllustrationThumbs:{route:"/thumbs/tagged/:tag",method:"displayThumbnailsForTag"}},d.context(b.routeHandler);for(f in e)e.hasOwnProperty(f)&&d.add(e[f]);$(window).bind("hashchange",function(){a(d)}),d.handler(),c&&c()}return b}),define("js/core/simpleMemCache",[],function(){var a={},b=6e5,c={put:function(b,c){return a[b]={data:c,timestamp:(new Date).getTime()},a[b].data},get:function(c){if(a[c]){if((new Date).getTime()-a[c].timestamp<b)return a[c].data;delete a[c]}return undefined}};return setInterval(function(){for(var c in a)(new Date).getTime()-a[c].timestamp>b&&delete a[c]},b+1e3),c}),define("js/core/core",[],function(){function a(a,b,c,d){var e=a.split("."),a=d||window;for(var f=0;f<e.length;f++)a[e[f]]=a[e[f]]||{},a=a[e[f]];if(a[b])throw["namespace clash for ",b].join("");return a[b]=c,a}function c(a,b){return a.prototype=new b,a.prototype.constructor=a,a}function d(a){var b;return b=a.replace(/[^a-z0-9A-Z]/g,"-"),b=b.replace(/-+/g,"-").toLowerCase(),b}var b=a("core","register",a);return a("core","inherit",c),a("core.strings","toSlug",d),b}),define("js/mvc/models/FlickrProxy",[],function(){function a(a){this.getDomainPfx=function(){return["http://",a,"/"].join("")}}a.prototype.getClients=function(a){$.getJSON([this.getDomainPfx(),"grundini/flickr/clients.json?callback=?"].join(""),a)},a.prototype.getProjects=function(a){$.getJSON([this.getDomainPfx(),"grundini/flickr/projects.json?callback=?"].join(""),a)},a.prototype.getAllProjects=function(a){$.getJSON([this.getDomainPfx(),"grundini/flickr/userprojects.json?callback=?"].join(""),a)},a.prototype.getTags=function(a){$.getJSON([this.getDomainPfx(),"grundini/flickr/tags.json?callback=?"].join(""),a)},a.prototype.getIllustrations=function(a,b){var c;b?c=[this.getDomainPfx(),"grundini/flickr/illustrations.json?projectflickrid=",b,"&callback=?"].join(""):c=[this.getDomainPfx(),"grundini/flickr/illustrations.json?callback=?"].join("");if(window.cache){var d=window.cache.get(c);if(d){a(d);return}}$.getJSON(c,function(b){window.cache&&window.cache.put(c,b),a(b)})},a.prototype.getIllustrationsForTag=function(a,b){var c;c=[this.getDomainPfx(),"grundini/flickr/illustrations.json?tags=",b,"&callback=?"].join("");if(window.cache){var d=window.cache.get(c);if(d){a(d);return}}$.getJSON(c,function(b){window.cache&&window.cache.put(c,b),a(b)})},a.prototype.getIllustration=function(a,b){var c=[this.getDomainPfx(),"grundini/flickr/illustration.json?illustrationId=",b,"&callback=?"].join("");if(window.cache){var d=window.cache.get(c);if(d){a(d);return}}$.getJSON(c,function(b){window.cache&&window.cache.put(c,b),a(b)})};var b=new a("api.grundini.com");return b}),define("js/mvc/models/GrundiniAppModel",["js/core/core","js/mvc/models/FlickrProxy"],function(a,b){function c(){var b,c,d,e,i=[],j,k,l,m,n,o,p,q;this.listeners={},this.load=function(){var a=this;f(a,function(){g(a,function(){h(a,function(){for(var a=0;a<i.length;a++)i[a]()})})})},this.isReady=function(){return c&&b&&d},this.onReady=function(a){i.push(a)},this.getClients=function(){return b},this.setClients=function(a){b=a},this.getProjects=function(){return c},this.setAllProjects=function(a){c=a},this.getTags=function(){return d},this.setTags=function(a){d=a},this.getTagGroups=function(){if(c)return c;var b=this.getTags(),c=[],d,e;b&&b.forEach(function(b,f,g){d=b.group,d&&(e=c.some(function(a,c,d){return a.slug===b.group}),e||c.push({slug:a.strings.toSlug(b.group),value:b.group}))})},this.getSelectedClient=function(){return l},this.setSelectedClient=function(a){l=a},this.getSelectedProject=function(){return j},this.setSelectedProject=function(a){j=a},this.getSelectedIllustrations=function(){return k},this.setSelectedIllustrations=function(a){k=a},this.getSelectedIllustration=function(){return m},this.setSelectedIllustration=function(a){m=a},this.getSelectedIllustrationIndex=function(){var a,b,c;if(!this.getSelectedIllustration())return 0;a=this.getSelectedIllustration().slug,b=this.getSelectedIllustrations(),c=-1;for(var d=0;d<b.length;d++)if(b[d].slug===a){c=d;break}return c},this.getIllustrationState=function(a){return o},this.setIllustrationState=function(a){o=a},this.getSelectedTagGroup=function(){return q},this.setSelectedTagGroup=function(a){q=findTagGroupBySlug()},this.getSelectedTag=function(){return p},this.setSelectedTag=function(a){p=a}}function e(a){return a.result&&a.result==="success"&&a.data}function f(a,c){b.getAllProjects(function(b){if(e(b)&&b.data.allProjects)a.setAllProjects(b.data.allProjects),c&&c();else throw"An error occurred while getting all of the projects"})}function g(a,c){b.getClients(function(b){if(e(b)&&b.data.clients)a.setClients(b.data.clients),c&&c();else throw"An error occurred while loading - getting clients"})}function h(a,c){b.getTags(function(b){if(e(b)&&b.data.tags){a.setTags(b.data.tags),c&&c();return}throw"An error occurred while loading - getting tags"})}var d=c.prototype;return d.setTagsForGroup=function(a,b){},d.getIllustrationsForProject=function(a,c){var d=this;if(!a.slug||!a.flickrId)throw"specified project is not a valid project [missing a slug value or a flickr id]";b.getIllustrations(function(a){if(e(a)&&a.data.illustrations){d.setSelectedIllustrations(a.data.illustrations),c&&c(a.data.illustrations);return}throw"flickr response failed while getting illustrations"},a.flickrId)},d.getIllustrationsForTag=function(a,c){var d=this;if(!a||!a.slug)throw"specified project is not a valid project [missing a slug value or a flickr id]";b.getIllustrationsForTag(function(a){if(e(a)&&a.data.illustrations){d.setSelectedIllustrations(a.data.illustrations),c&&c(a.data.illustrations);return}throw"flickr response failed while getting illustrations"},a.content)},d.getIllustration=function(a,c){var d,f=this;if(!a)throw"no illustrationSlug specified when trying to get Illustration [GrundiniAppModel.getIllustration]";d=this.findIllustrationBySlug(a,this.getSelectedIllustrations());if(!d)throw"no illustration could be found within the current set with a slug value of "+a;if(!d.flickrId)throw"the selected illustration doesnt have an associated Id: "+a;b.getIllustration(function(a){if(e(a)&&a.data.illustration){f.setSelectedIllustration(a.data.illustration),c&&c(a.data.illustration);return}throw"flickr response failed while getting a single illustration"},d.flickrId)},d.findProjectBySlug=function(a,b){var c=b.filter(function(b,c,d){return b&&b.slug&&b.slug===a});if(c.length===1)return c[0];if(c.length>1)throw"more than one project found with a slug value of: "+a;return null},d.findTagBySlug=function(a,b){var c=b.filter(function(b,c,d){return b&&b.slug&&b.slug===a});if(c.length===1)return c[0];if(c.length>1)throw"more than one project found with a slug value of: "+a;return null},d.findIllustrationBySlug=function(a,b){var c;c=b.filter(function(b,c,d){return b&&b.slug&&b.slug===a});if(c.length===1)return c[0];if(c.length>1)throw"more than one illustration found with a slug value of: "+a;return null},d.findClientBySlug=function(a,b){var c;for(var d=0;d<b.length;d++)if(b[d].slug&&b[d].slug===a){c=b[d];break}return c},d.getNextIllustration=function(){var a,b;return b=this.getSelectedIllustrations(),a=this.getSelectedIllustrationIndex()||0,a!==b.length-1?b[a+1]:undefined},d.getPreviousIllustration=function(){var a,b;return b=this.getSelectedIllustrations(),a=this.getSelectedIllustrationIndex()||0,a!==0?b[a-1]:undefined},d.getFullProjectsForClient=function(a){var b=[];for(var c=0;c<a.projects.length;c++)b.push(this.findProjectBySlug(a.projects[c].slug,this.getProjects()));return b},c}),define("js/mvc/controllers/mvc.Controller",["js/core/core"],function(a){function b(a,b){this.model=a,this.view=b,this.registeredViews={}}return b.prototype.getHrefParts=function(a){return $(a).attr("href").split("/")},b.prototype.getLastHrefPart=function(a){var b=this.getHrefParts(a),c=b.length;return b[c-1]},b.prototype.setView=function(a,b,c,d){this.registeredViews[a]?this.view=this.registeredViews[a]:(this.view=new b(c),d&&this.view.bind(d),this.registeredViews[a]=this.view)},a.register("mvc","Controller",b),b}),define("js/mvc/views/mvc.View",["js/core/core"],function(a){function b(){this.renderFn=null,this.templateCache={},this.elCache={},this.viewModel=null}return b.prototype.appRootClass="body",b.prototype.declareElms=function(a){if(a)for(var b=0;b<a.length;b++)a[b].name&&a[b].selector&&this.setElm(a[b].name,a[b].selector)},b.prototype.setRenderFn=function(a){this.renderFn=a},b.prototype.setViewModel=function(a){this.viewModel=a},b.prototype.render=function(){if(!this.renderFn)throw new["no render function specified for ",this.constructor].join("");this.renderFn()},b.prototype.getTemplate=function(a,b){if(!this.templateCache[a]||b)this.templateCache[a]=$(['script[type="text/x-mustache-template"]#',a].join("")).html();return this.templateCache[a]},b.prototype.getElm=function(a,b){if(!this.elCache[a])throw["element with name ",a," not found"].join("");return b&&(this.elCache[a].el=$(this.elCache[a].selector)),this.elCache[a].el},b.prototype.setElm=function(a,b){return this.elCache[a]={name:a,selector:b,el:$(b)},this.elCache[a].el},b.prototype.findByHref=function(a,b){var c=null;return b=b||$(document),c=$(b).find('a[href="'+a+'"]'),c},b.prototype.bind=function(a){for(var b=0;b<a.length;b++)if(this.elCache[a[b].name].el)for(var c=0;c<a[b].events.length;c++)$(this.elCache[a[b].name].el).live(a[b].events[c],a[b].fn)},b.prototype.getHashbang=function(){return window.location.hash},b.prototype.updateHashbang=function(a){window.location.hash=a},b.prototype.setTheme=function(a){$(this.appRootClass).removeClass(),$(this.appRootClass).addClass(a)},a.register("mvc","View",b),b}),define("js/mvc/views/ProjectsView",["js/core/core","js/mvc/views/mvc.View"],function(a,b){function c(a){var b;this.getViewModel=function(){return a},this.getNavView=function(){return b},this.setPartialViews=function(a){b=a}}return a.inherit(c,b),c.prototype.render=function(){var a=this.getViewModel(),b=this.getNavView().navView,c=this.getHashbang(),d={contextItem:[]},e=!1;a.update();var f=a.getModelData(),g=Mustache.to_html(this.getTemplate("projects"),f);document.title="Grundini",f.client&&(e=!0,d.contextItem.push({title:"Clients",value:"#!/client",seperator:"&nbsp;/"}),d.contextItem.push({title:f.client.title,value:"#!/client/"+f.client.slug})),$(".stage").html(g),this.setTheme("theme-standard"),b.setProjectView(c,d,e),b.showStage()},c}),define("js/mvc/viewModels/ProjectsViewModel",[],function(){function a(a,b,c){var g,h;this.update=function(){b?(h=d(b,a),a=c.getFullProjectsForClient(h),e(a,h)):(a=c.getProjects(),f(a)),g={projects:a},h&&(g.client=h)},this.getModelData=function(){return g}}function c(a,b){var c;for(var d=0;d<b.length;d++)if(b[d].slug===a){c=b[d].projects;break}return c}function d(a,b){var c;for(var d=0;d<b.length;d++)if(b[d].slug===a){c=b[d];break}return c}function e(a,b){for(var c=0;c<a.length;c++)a[c].projectlink=["/#!/client/",b.slug,"/",a[c].slug].join("")}function f(a,b){for(var c=0;c<a.length;c++)a[c].projectlink=["/#!/project/",a[c].slug].join("")}var b=a.prototype;return a}),define("js/mvc/views/ClientsView",["js/core/core","js/mvc/views/mvc.View"],function(a,b){function c(a){var b;this.getViewModel=function(){return a},this.getNavView=function(){return b},this.setPartialViews=function(a){b=a}}return a.inherit(c,b),c.prototype.render=function(){function g(){b=a.getModelData(),b.clients.sort(function(a,b){return a.title.toLowerCase()<b.title.toLowerCase()?-1:a.title.toLowerCase()>b.title.toLowerCase()?1:0}),c=e.buildClientsHtml(b),$(".stage").html(c)}function h(){b=a.getModelData(),b.clients=b.clients.sort(function(a,b){return a.order<b.order?-1:a.order>b.order?1:0}),c=e.buildClientsHtml(b),$(".stage").html(c)}var a=this.getViewModel(),b,c,d=this.getNavView().navView,e=this,f=this.getHashbang();a.update(),b=a.getModelData(),c=this.buildClientsHtml(b),this.setTheme("theme-standard"),$(".stage").html(c),d.setClientView(f,"Grundini",g,h),d.showStage()},c.prototype.buildClientsHtml=function(a){return Mustache.to_html(this.getTemplate("clients"),a)},c}),define("js/mvc/viewModels/ClientsViewModel",[],function(){function a(a){var b;this.update=function(){b={clients:a}},this.getModelData=function(){return b}}var b=a.prototype;return a}),define("js/mvc/views/IllustrationThumbnailsView",["js/core/core","js/mvc/views/mvc.View"],function(a,b){function c(a){var b;this.getViewModel=function(){return a},this.getNavView=function(){return b},this.setPartialViews=function(a){b=a}}function e(a,b,c){$(".share").hide(),$(".sharethis").html("");var d=[{type:"facebook",image:"./css/img/social-facebook.png"},{type:"twitter",image:"./css/img/social-twitter.png"},{type:"email",image:"./css/img/social-email.png"},{type:"sharethis",image:"./css/img/social-more.png"}],e,f;for(var g=0;g<d.length;g++)e=d[g],f=$(['<span class="st_',e.type,'_custom" st_url="',a,'" st_title="Grundini : ',b,': " st_image="',c,'"><span class="sharethis-item ',d[g].type,'"></span></span>'].join("")),$(".sharethis").append(f);stButtons.locateElements(),$(".share").show()}a.inherit(c,b);var d=c.prototype;return d.onAlphabeticalOrderClick=function(){},d.onDateOrderClick=function(){},d.render=function(){var a,b,c,d=this.getNavView().navView,f,g=this.getHashbang(),h={contextItem:[]};a=this.getViewModel(),a.update(),b=a.getModelData(),c=Mustache.to_html(this.getTemplate("thumbnails"),b.container),$(".stage").html(c),b.viewType==="PROJECT"&&(f=b.container.title,b.client?h.contextItem.push({title:b.client.title,value:"#!/client/"+b.client.slug,seperator:"&nbsp;/"}):h.contextItem.push({title:"Projects",value:"#!/projects",seperator:"&nbsp;/"}),h.contextItem.push({title:b.container.title,value:["#!/thumbs/project/",b.container.slug].join("")})),b.viewType==="TAG"&&(f=b.container.value,document.title="Grundini :"+f,b.container.group&&h.contextItem.push({title:b.container.group.pluralize(),value:["#!/grouped-by/",b.container.group].join(""),seperator:"&nbsp;/"}),h.contextItem.push({title:b.container.value,value:["#!/thumbs/tagged/",b.container.slug].join("")})),this.setTheme("theme-light"),$(".illustration-thumbnails").removeClass("off"),e(window.location.href,f,b.container.illustrations[0].thumbnail),d.setThumbnailsView(g,h),d.showStage()},c}),define("js/mvc/viewModels/IllustrationThumbsViewModel",[],function(){function a(a,b,e){var f;b=b||"PROJECT",this.update=function(){var g,h,i,j;b==="PROJECT"?(h=a.getSelectedProject(),g=d(a.getSelectedIllustrations(),h.primaryId),h.illustrations=c(g,h,"project"),f={container:h,viewType:b},e&&(f.client=e)):(i=a.getSelectedTag(),g=a.getSelectedIllustrations(),i.illustrations=c(g,i,"tagged"),f={container:i,viewType:b})},this.getModelData=function(){return f}}function c(a,b,c){var d;return d=a.map(function(a,d,e){var f={};return f.link=["#!/",c,"/",b.slug,"/",a.slug].join(""),f.thumbnail=a.imageurl.medium500,f}),d}function d(a,b){return a.filter(function(a,c,d){return a.flickrId!==b})}var b=a.prototype;return a}),define("js/mvc/views/IllustrationBrowserView",["js/core/core","js/mvc/views/mvc.View"],function(a,b){function h(a){function d(a){a.preventDefault(),b.onNextClick($(this).attr("href"),$(this))}function e(a){a.preventDefault(),b.onPreviousClick($(this).attr("href"),$(this))}function f(a,c){a.direction.x==="west"?b.$next.trigger("click"):a.direction.x==="east"&&b.$prev.trigger("click")}var b=this,c;this.loadingIll=!1,this.getViewModel=function(){return a},this.getNavView=function(){return c.navView},this.setPartialViews=function(a){c=a},this.$next=$("#app>div.controls .button.next"),this.$prev=$("#app>div.controls .button.previous"),this.$illustrations=$(".illustrationBrowser .illustrations"),$(".fullsize-image .loading-container").off("click"),$(".fullsize-image .loading-container").on("click",function(a){a.preventDefault(),$(".stage").fadeIn("fast"),$(".fullsize-image").fadeOut("fast")}),this.$next.off("click"),this.$prev.off("click"),this.$next.on("click",d),this.$prev.on("click",e),this.setTouchEvents=function(){this.getNavView().addTouchEventHandler(f)},$(document).off("keydown"),$(document).on("keydown",function(a){var c=b.getViewModel();switch(a.keyCode){case 37:c.getPos()>0&&(a.preventDefault(),b.$prev.trigger("click"));break;case 39:c.getPos()<c.getModelData().illustrations.length-1&&(a.preventDefault(),b.$next.trigger("click"));break;default:return!0}}),$(window).off("resize"),$(window).off("resizeEnd"),$(window).resize(function(){if(!b.getNavView().reloadOnResize)return;$(".stage").hide(),this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){$(this).trigger("resizeEnd")},750)}),$(window).on("resizeEnd",function(){b.render(),$(".stage").show("fast")})}function j(a,b,c){function i(a){f+=1,f>=g&&!h&&(h=!0,b(d)),f>=g&&!h&&(h=!0,b(d))}var d=[],e,f=0,g,h=!1;!c||c>a.length-1?g=a.length-1:g=c;for(var j=0;j<a.length;j++)e=new Image,e.src=a[j],e.onload=i,d.push(e)}function k(a,b){return a.illustrations.length*b+500}function l(a,b,c){$(".share").hide(),$(".sharethis").html("");var d=[{type:"facebook",image:"./css/img/social-facebook.png"},{type:"twitter",image:"./css/img/social-twitter.png"},{type:"email",image:"./css/img/social-email.png"},{type:"sharethis",image:"./css/img/social-more.png"}],e,f;for(var g=0;g<d.length;g++)e=d[g],f=$(['<span class="st_',e.type,'_custom" st_url="',a,'" st_title="Grundini : ',b,': " st_image="',c,'"><span class="sharethis-item ',d[g].type,'"></span></span>'].join("")),$(".sharethis").append(f);stButtons.locateElements(),$(".share").show()}var c=400,d=1e3,e,f=null,g;a.inherit(h,b);var i=h.prototype;return i.updateLinks=function(){var a,b,c,d;d=this.getViewModel().getModelData(),c=this.getViewModel().getPos(),c>0&&(b=["!/",d.viewSlug,"/",d.sectionSlug,"/",d.illustrations[c-1].slug].join("")),c<d.illustrations.length-1&&(a=["!/",d.viewSlug,"/",d.sectionSlug,"/",d.illustrations[c+1].slug].join("")),this.$next.attr("href",a),this.$prev.attr("href",b)},i.onNextClick=function(a,b){this.updateHashbang(a)},i.onPreviousClick=function(a,b){this.updateHashbang(a)},i.moveToPos=function(a,b){b?$(".illustrationBrowser .illustrations").animate({left:a},250,"swing",b):$(".illustrationBrowser .illustrations").animate({left:a},250,"swing")},i.moveToItem=function(a){var b=this,d,f=this.getNavView(),g=this.getViewModel().getModelData().illustrations,h=g.length;a>0&&$(".illustrationBrowser .illustrations li:eq("+(a-1)+") img").attr("src",g[a-1].toFit),$(".illustrationBrowser .illustrations li:eq("+a+") img").attr("src",g[a].toFit),a<h-1&&g[a+1]&&$(".illustrationBrowser .illustrations li:eq("+(a+1)+") img").attr("src",g[a+1].toFit),$(".position .current").text(a+1),f.setTitle("..."),this.moveToPos(a*(e+4)*-1,function(){b.loadIllTO&&clearTimeout(b.loadIllTO),b.loadIllTO=setTimeout(function(){b.getViewModel().getCurrentIllustration(function(a){d=Mustache.to_html(b.getTemplate("tags"),a),$(".footer-bar .tags").html(d),document.title="Grundini :"+a.title,f.setTitle(a.title),l(window.location.href,a.title,a.imageUrl.small)})},c)})},i.onZoomClick=function(a){var b,c,d=this;a.preventDefault(),$(".loading-container").removeClass("loaded"),b=$(".fullsize-image img").attr("src"),c=$(this).attr("href"),$(".stage").fadeOut("fast"),$(".fullsize-image").fadeIn("fast"),b!==c?($(".fullsize-image img").hide(),g=new Image,g.src=c,g.onload=function(){$(".fullsize-image img").attr("src",$(d).attr("href")),$(".fullsize-image img").show(),$(".loading-container").addClass("loaded");return}):$(".loading-container").addClass("loaded")},i.render=function(){var a=Math.round($(window).width()*.8),b=Math.round($(window).height()*.8),c,f=this.getNavView(),g=this.getHashbang(),h={contextItem:[]};c=a<b?a:b;var i,j,l,m=this,n,o,p;i=this.getViewModel(),i.setImageSizeToLoad(c),i.update(),j=i.getModelData(),j.viewType==="TAG"&&(j.tag.group&&h.contextItem.push({title:j.tag.group.pluralize(),value:["#!/grouped-by/",j.tag.group].join(""),seperator:"&nbsp;/"}),h.contextItem.push({title:j.tag.value,value:["#!/thumbs/tagged/",j.tag.slug].join("")})),j.viewType==="PROJECT"&&(j.client?(h.contextItem.push({title:"Clients",value:"#!/client",seperator:"&nbsp;/"}),h.contextItem.push({title:j.client.title,value:"#!/client/"+j.client.slug,seperator:"&nbsp;/"})):h.contextItem.push({title:"Projects",value:"#!/projects",seperator:"&nbsp;/"}),j.project&&(j.client?h.contextItem.push({title:j.project.title,value:["#!/thumbs/client-project/",j.client.slug,"/",j.project.slug].join("")}):h.contextItem.push({title:j.project.title,value:["#!/thumbs/project/",j.project.slug].join("")}))),e=$(window).width(),o=e-d,p=i.getPos(),this.setTheme("theme-light"),f.setBrowserView(g,h,i.getPos()+1,j.illustrations.length),l=Mustache.to_html(m.getTemplate("illustration-browser"),j),$(".stage").html(l),n=k(j,e),$(".illustrationBrowser .illustrations").dequeue(),$(".illustrationBrowser .illustrations").css("width",[n.toString(),"px"].join("")),$(".illustrationBrowser .illustrations li").css("width",e+"px"),$(".illustrationBrowser.off").removeClass("off"),$(".illustration.off").removeClass("off"),m.updateLinks(),m.toggleNextPrevious(m.$next,m.$prev,p,j.illustrations.length),m.moveToItem(p),$(".fullsize-link").off("click"),$(".fullsize-link").on("click",m.onZoomClick),$(".footer-bar").show(),$("#app>.controls.off").removeClass("off"),m.setTouchEvents(),f.showStage()},i.toggleNextPrevious=function(a,b,c,d){c<d-1?a.removeClass("off"):a.addClass("off"),c>0?b.removeClass("off"):b.addClass("off")},h}),define("js/mvc/viewModels/IllustrationBrowserViewModel",[],function(){function a(a,b,c){var d={},f=0;this.illustrationCache=[],this.ready=!1,imageSizeToLoad=e(200),this.getModel=function(){return a},this.getViewType=function(){return b},this.getPos=function(){return f},this.setPos=function(a){f=a},this.getClient=function(){return c},this.getImageSizeToLoad=function(){return imageSizeToLoad},this.setImageSizeToLoad=function(a){imageSizeToLoad=e(a)},this.getModelData=function(){return d},this.updateIllustration=function(){d.illustration=a.getSelectedIllustration()}}function c(a,b){return a.filter(function(a,c,d){return a.flickrId!==b})}function d(a,b){var c=-1;for(var d=0;d<a.length;d++)if(a[d].slug===b){c=d;break}return c}function e(a){return a<400?"small":a<600?"medium500":a<800?"medium640":"large"}var b=a.prototype;return b.getViewSlug=function(){return this.getViewType()==="TAG"?"tagged":"project"},b.getSectionSlug=function(){return vmd=this.getModelData(),this.getViewType()==="PROJECT"?vmd.project.slug:vmd.tag.slug},b.setPosBySlug=function(a){this.ready?this.updateIllustration():this.update();var b=d(this.getModelData().illustrations,a);b>-1&&this.setPos(b)},b.getCurrentIllustration=function(a){var b=this.getPos(),c=this,d=this.getModel(),e=this.getModelData(),f;if(this.illustrationCache[b]){a(this.illustrationCache[b]);return}var g=d.getIllustration(e.illustrations[b].slug,function(d){for(var e=0;e<d.tag.length;e++)d.tag[e].link="/#!/thumbs/tagged/"+d.tag[e].slug,d.tag[e].content.indexOf("|")>-1&&(f=d.tag[e].content.split("|"),d.tag[e].content=f[1]);c.illustrationCache[b]=d,a(d)})},b.update=function(){var a=this.getModelData(),b=this.getModel(),d;a.viewType=this.getViewType(),a.viewType==="PROJECT"?(a.project=b.getSelectedProject(),a.client=this.getClient(),a.illustrations=c(b.getSelectedIllustrations(),a.project.primaryId)):(a.tag=b.getSelectedTag(),a.illustrations=b.getSelectedIllustrations()),this.illustrationCache=new Array(a.illustrations.length),this.updateIllustration(),a.srcs=[];for(var e=0;e<a.illustrations.length;e++)d=a.illustrations[e].imageurl[this.getImageSizeToLoad()],a.illustrations[e].toFit=d,a.srcs.push(d);a.viewSlug=this.getViewSlug(),a.sectionSlug=this.getSectionSlug(),this.ready=!0},a}),define("js/mvc/views/TagGroupsView",["js/core/core","js/mvc/views/mvc.View"],function(a,b){function c(a){var b;this.getViewModel=function(){return a},this.getNavView=function(){return b},this.setPartialViews=function(a){b=a}}return a.inherit(c,b),c.prototype.render=function(){var a=this.getViewModel(),b,c,d=this.getNavView().navView,e=this,f=this.getHashbang();a.update(),b=a.getModelData(),b&&(c=Mustache.to_html(this.getTemplate("tags-for-group"),b)),document.title="Grundini",$(".stage").html(c),this.setTheme("theme-standard"),d.setTagGroupsView(f),d.showStage()},c}),define("js/mvc/viewModels/TagGroupsViewModel",[],function(){function a(a,b){var c={};this.getModelData=function(){return c},this.sortTagsBy=function(a,b,c){var d=c?1:-1;a=a.sort(function(a,c){return a[b]<c[b]?d:a[b]>c[b]?d*-1:0})},this.update=function(){c.selectedGroup=b,c.groups=a.getTagGroups(),c.tags=a.getTags(),c.tagsForGroup=this.getTagsForGroup(b),b==="year"&&this.sortTagsBy(c.tagsForGroup,"value",!0)},this.getTagsForGroup=function(a){return c.tags?c.tags.filter(function(b,c,d){return b.group===a}):[]}}var b=a.prototype;return a}),define("js/mvc/controllers/BrowseIllustrationsController",["js/core/core","js/mvc/controllers/mvc.Controller","js/mvc/views/ProjectsView","js/mvc/viewModels/ProjectsViewModel","js/mvc/views/ClientsView","js/mvc/viewModels/ClientsViewModel","js/mvc/views/IllustrationThumbnailsView","js/mvc/viewModels/IllustrationThumbsViewModel","js/mvc/views/IllustrationBrowserView","js/mvc/viewModels/IllustrationBrowserViewModel","js/mvc/views/TagGroupsView","js/mvc/viewModels/TagGroupsViewModel"],function(a,b,c,d,e,f,g,h,i,j,k,l){function n(a){var b,c,d;this.getModel=function(){return a},this.getView=function(){return b},this.setView=function(a){b=a},this.getSelectedIllustration=function(){return c},this.setSelectedIllustration=function(a){c=a},this.getNavView=function(){return d},this.setPartialViews=function(a){d=a}}function p(a,b,c){var d=b.getSelectedProject(),e;return e=a.getView(),e===undefined||e.constructor!==i||d.slug!==c}function q(a,b,c){var d=b.getSelectedTag(),e;return e=a.getView(),returnVal=e===undefined||e.constructor!==i||d==undefined||d.slug!==c}var m;a.inherit(n,b);var o=n.prototype;return o.displayClients=function(a){var b,c,d,g=this.getModel();d=g.getClients(),c=new f(d),b=new e(c),this.setView(b),b.setPartialViews(this.getNavView()),a.update(),b.render()},o.displayProjects=function(a,b){var e,f,g=this.getModel(),h=this,i,j;b?(j=g.getClients(),viewModelCtx=f=new d(j,b,g),e=new c(f),h.setView(e),e.setPartialViews(this.getNavView()),e.render()):(i=g.getProjects(),f=new d(i,b,g),e=new c(f),h.setView(e),e.setPartialViews(this.getNavView()),e.render())},o.displayTagsForGroup=function(a,b){var c,d,e=this.getModel();d=new l(e,b),c=new k(d),this.setView(c),c.setPartialViews(this.getNavView()),c.render()},o.displayThumbnailsForProject=function(a,b,c){var d,e,f=this.getModel(),i=this,j,k,l;k=f.getProjects(),j=f.findProjectBySlug(b,k),f.setSelectedProject(j),c&&(l=f.findClientBySlug(c,f.getClients())),f.getIllustrationsForProject(j,function(a){f.setSelectedIllustrations(a),e=new h(f,"PROJECT",l),d=new g(e),i.setView(d),d.setPartialViews(i.getNavView()),d.render()})},o.displayThumbnailsForTag=function(a,b){var c,d,e=this.getModel(),f=this,i;ts=e.getTags(),i=e.findTagBySlug(b,ts),e.setSelectedTag(i),e.getIllustrationsForTag(i,function(a){e.setSelectedIllustrations(a),d=new h(e,"TAG"),c=new g(d),f.setView(c),c.setPartialViews(f.getNavView()),c.render()})},o.displayProjectIllustrationBrowser=function(a,b,c,d){var e,f,g=this.getModel(),h=this,k,l,m,n,o,q,r;p(this,g,b)?(l=g.getProjects(),k=g.findProjectBySlug(b,l),g.setSelectedProject(k),d&&(r=g.findClientBySlug(d,g.getClients()),g.setSelectedClient(r)),g.getIllustrationsForProject(k,function(a){g.setSelectedIllustrations(a),c||(c=a[0].slug),m=g.findIllustrationBySlug(c,a),g.setSelectedIllustration(m),q=f=new j(g,"PROJECT",r),c&&f.setPosBySlug(c),e=new i(f),h.setView(e),e.setPartialViews(h.getNavView()),e.render()})):(o=h.getView(),q=o.getViewModel(),q.setPosBySlug(c),n=q.getPos(),o.updateLinks(),o.setPartialViews(h.getNavView()),h.getNavView().navView.hideSortBar(),o.toggleNextPrevious(o.$next,o.$prev,n,q.getModelData().illustrations.length),o.moveToItem(n))},o.displayTagggedIllustrationsBrowser=function(a,b,c){var d,e,f=this.getModel(),g=this,h,k,l,m,n,o,p;q(this,f,b)?(k=f.getTags(),h=f.findTagBySlug(b,k),!!h,f.setSelectedTag(h),f.getIllustrationsForTag(h,function(a){f.setSelectedIllustrations(a),c||(c=a[0].slug),l=f.findIllustrationBySlug(c,a),f.setSelectedIllustration(l),p=e=new j(f,"TAG"),c&&e.setPosBySlug(c),d=new i(e),d.setPartialViews(g.getNavView()),g.setView(d),d.render()})):(o=g.getView(),p=o.getViewModel(),p.setPosBySlug(c),n=p.getPos(),o.updateLinks(),o.toggleNextPrevious(o.$next,o.$prev,n,p.getModelData().illustrations.length),o.moveToItem(n))},n}),define("js/core/touchevents",[],function(){function c(a,b){this.getElms=function(){return a},this.getSelector=function(){return b},e(a,b)}function d(a){var b=document.querySelectorAll(a),d;return b&&b.length&&(b=e(b,a),d=new c(b,a)),d}function e(b,c){var d,e,g;if(b.length>0)for(var h=0;h<b.length;h++)if(!b[h]._ttid){d=(new Date).getTime(),g=f(d,h);if(a[g])throw["element with id ",g," already found in touch targets store"].join("");e={selectors:[],ttid:d},e.selectors.push(c),b[h]._ttid=g,a[g]=e,b[h].addEventListener("touchstart",i,!1),b[h].addEventListener("touchend",j,!1)}else{e=a[b[h]._ttid];if(!e)throw["could not find element reference in touch target store with ID ",b[h]._ttid].join("");e.selectors.indexOf(c)||e.selectors.push(c)}return b}function f(a,b){return["ttid_",a,"_"+b].join("")}function g(a){a.distance=a.distance||{},a.direction=a.direction||{},a.distance.x=a.end.x-a.start.x,a.direction.x="static",a.distance.x>1?a.direction.x="east":a.distance.x<0&&(a.direction.x="west")}function h(a){a.distance=a.distance||{},a.direction=a.direction||{},a.distance.y=a.end.y-a.start.y,a.direction.y="static",a.distance.y>1?a.direction.y="south":a.distance.y<0&&(a.direction.y="north")}function i(a){var b={};b.target={},b.target.width=a.target.offsetWidth,b.target.height=a.target.offsetHeight,b.start={},b.start.ts=(new Date).getTime(),a.target.touchParams=b;if(a.touches.length===1){var c=a.touches[0];b.start.x=c.pageX,b.start.y=c.pageY}}function j(a){var b=a.target.touchParams;b.end={},b.end.ts=(new Date).getTime();if(a.changedTouches.length===1){var c=a.changedTouches[0];b.end.x=c.pageX,b.end.y=c.pageY,g(b),h(b)}b.end.ts=(new Date).getTime(),b.duration=b.end.ts-b.start.ts,b.velocity={},b.velocity.x=b.distance.x/b.duration,b.velocity.y=b.distance.y/b.duration,k(this,b)}function k(a,c){c.velocity.x>b||c.velocity.x*-1>b?p(a,"flick",c):c.velocity.y>b||c.velocity.y*-1>b?p(a,"flick",c):p(a,"drag",c)}function l(a){clearOutput(),output(a)}function m(b,c,d){var e="ontouch"+c;a[b._ttid][e]=a[b._ttid][e]||new Array,a[b._ttid][e].push(d)}function n(b,c,d){var e="ontouch"+c;for(var f=0;f<a[b._ttid][e].length;f++)d==a[b._ttid][e][f]&&delete a[b._ttid][e][f]}function o(b,c){var d="ontouch"+c;a[b._ttid][d]=[]}function p(b,c,d){var e="ontouch"+c;for(var f=0;f<a[b._ttid][e].length;f++)a[b._ttid][e][f](d)}if(!document.addEventListener)return;var a={},b=.5;return c.prototype.isSupported=function(){return document.querySelectorAll&&document.body.addEventListener},c.prototype.on=function(a,b){var c=this.getElms();for(var d=0;d<c.length;d++)m(c[d],a,b);return this},c.prototype.off=function(a,b){var c=this.getElms();for(var d=0;d<c.length;d++)n(c[d],a,b);return this},c.prototype.clear=function(a){var b=this.getElms();for(var c=0;c<b.length;c++)o(b[c],a);return this},d}),define("js/mvc/partialViews/NavigationMenuView",["js/core/core","js/core/touchevents","js/mvc/views/mvc.View"],function(a,b,c){function d(a){var b=this,c,d,e;this.renderFn=null,this.templateCache={},this.elCache={},this.viewModel=null,this.visible=!1,this.shareThisMenuState="CLOSED",this.root=$(".illustration-nav"),this.getDateSortFn=function(){return c},this.setDateSortFn=function(a){c=a},this.getAlphaSortFn=function(){return d},this.setAlphaSortFn=function(a){d=a},this.resetSortFns=function(){d=undefined,c=undefined},this.setDisableYScroll=function(a){e=a},this.reloadOnResize=!1,$(".sorting-controls .alphabetical").on("click",function(a){a.preventDefault();var c=b.getAlphaSortFn();c&&c(),$(".sorting-controls a").removeClass("active"),$(this).addClass("active")}),$(".sorting-controls .chronological").on("click",function(a){a.preventDefault();var c=b.getDateSortFn();c&&c(),$(".sorting-controls a").removeClass("active"),$(this).addClass("active")}),$(".click-plate").on("click",function(){b.toggleIllustrationNav()}),$(".sharethis-menu-toggle").on("click",function(a){a.preventDefault(),b.toggleShareThisMenu()}),document.body.addEventListener&&document.body.addEventListener("touchmove",function(a){e&&a.preventDefault()},!1)}function e(a,b){var c=$(".title-bar");if($(".title-bar .client-crumb").length&&$(".title-bar .client-crumb").length>0)$(".title-bar .client-crumb a").text(a.title);else{var d=Mustache.to_html(b.getTemplate("client-crumb"),a);c.append(d)}}function f(a,b,c){var d=$(".title-bar"),e;c?e=Mustache.to_html(a.getTemplate("client-project-crumb"),{client:c,project:b}):e=Mustache.to_html(a.getTemplate("project-crumb"),b),$(".title-bar .project-crumb").length&&$(".title-bar .project-crumb").length>0?$(".title-bar .project-crumb a").text(b.title):d.append(e)}function g(a){var b=$(".title-bar .active"),c=Mustache.to_html(this.getTemplate("tag-crumb"),a);b.append(c)}return a.inherit(d,c),d.prototype.hideIllustrationNav=function(a){$(".illustration-nav").slideUp(250,a)},d.prototype.showIllustrationNav=function(a){$(".illustration-nav").slideDown(100,a)},d.prototype.setActiveItem=function(a){this.clearIllstrItem(),$(a).addClass("active")},d.prototype.clearIllstrItem=function(a){this.root.find("li").removeClass("active")},d.prototype.setActiveItemByHash=function(a){this.clearIllstrItem();if(window.location.hash){var b=this.findByHref(a,this.root);if(b&&b[0]){this.setActiveItem($(b[0]).parent());return}this.setActiveItem($(b).parent())}},d.prototype.hideSortBar=function(){$("header .sorting-controls").slideUp(250)},d.prototype.showSortBar=function(){$("header .sorting-controls").slideDown(100)},d.prototype.hideNextPreviousButtons=function(){$(".controls .nextPrevious").fadeOut(250),$(".controls .position").fadeOut(250)},d.prototype.showNextPreviousButtons=function(){$(".controls .nextPrevious").fadeIn(250),$(".controls .position").fadeIn(250)},d.prototype.hideShareControls=function(){$(".controls .share").fadeOut(250)},d.prototype.showShareControls=function(){$(".controls .share").fadeIn(100)},d.prototype.openShareThisMenu=function(){$(".share .sharethis-buttons-container").animate({left:"0"}),this.shareThisMenuState="OPEN"},d.prototype.closeShareThisMenu=function(){$(".share .sharethis-buttons-container").animate({left:"500px"},250),this.shareThisMenuState="CLOSED"},d.prototype.toggleShareThisMenu=function(){this.shareThisMenuState==="OPEN"?this.closeShareThisMenu():this.openShareThisMenu()},d.prototype.hideFooter=function(){$("footer").fadeOut(250)},d.prototype.showFooter=function(){$("footer").fadeIn(250)},d.prototype.hidePageLoading=function(){$(".page-loading").hide()},d.prototype.setCrumbsForClient=function(a){e(a,this)},d.prototype.setCrumbsForProject=function(a,b){f(this,a,b)},d.prototype.setCrumbsForTag=function(a){var b=$(".title-bar"),c=Mustache.to_html(this.getTemplate("tag-crumb"),a);$(".title-bar .tag-crumb").remove(),b.append(c)},d.prototype.deleteCrumbs=function(){$(".title-bar .crumb").remove()},d.prototype.showTitleBar=function(){$(".title-bar").slideDown(250)},d.prototype.hideTitleBar=function(){$(".title-bar").slideUp(250)},d.prototype.setTitle=function(a){$(".title-bar .title-text").text(a)},d.prototype.clearMainSelection=function(){$(".main-navigation li").removeClass("active")},d.prototype.setMainSelection=function(a){$(".main-navigation "+a).addClass("active")},d.prototype.update=function(){},d.prototype.setFilterByHashbang=function(a){this.clearIllstrItem();var b=/\//gi,c=a.match(b);if(a.indexOf("all-work")>-1){this.findByHref("#!/all-work",$(".illustration-nav")).parent().addClass("active");return}if(a.indexOf("client")>-1){this.findByHref("#!/client",$(".illustration-nav")).parent().addClass("active");return}if(a.indexOf("project")>-1){this.findByHref("#!/all-work",$(".illustration-nav")).parent().addClass("active");return}if(a.indexOf("tagged")>-1){var d=a.split("/"),e=d[2],f=e.split("-");this.findByHref("#!/grouped-by/"+f[0],$(".illustration-nav")).parent().addClass("active");return}if(a.indexOf("grouped-by")>-1){var d=a.split("/"),g=d[2];this.findByHref("#!/grouped-by/"+g,$(".illustration-nav")).parent().addClass("active")}},d.prototype.setContext=function(a){var b=Mustache.to_html(this.getTemplate("context-items"),a);$(".context-bar").html(b)},d.prototype.showContext=function(){$(".context-bar").slideDown(250)},d.prototype.hideContext=function(){$(".context-bar").slideUp(300)},d.prototype.hidePosition=function(){$(".context-bar .position").hide()},d.prototype.showPosition=function(){$(".context-bar .position").show()},d.prototype.setStageTopPos=function(a){$(".stage").css("top",a)},d.prototype.showStage=function(){$(".stage").css("opacity")==0&&(this.hidePageLoading(),$(".stage").animate({opacity:1},500))},d.prototype.addTouchEventHandler=function(a){b&&b("body").on("flick",a)},d.prototype.clearTouchEventHandlers=function(){b&&b("body").clear("flick")},d.prototype.setContentView=function(a,b){var c=this;this.reloadOnResize=!1,this.hideTitleBar(),this.hideSortBar(),this.hideNextPreviousButtons(),this.hideShareControls(),this.hideFooter(),b?this.hideIllustrationNav(function(){c.setContext(b),c.hidePosition(),c.showContext(),c.setStageTopPos("73px")}):this.hideIllustrationNav(function(){c.setStageTopPos("32px"),c.hideContext()}),this.clearMainSelection(),this.setMainSelection(a),this.setDisableYScroll(!1),this.clearTouchEventHandlers()},d.prototype.setProjectView=function(a,b,c){var d=this;this.reloadOnResize=!1,this.setStageTopPos("64px"),this.hideTitleBar(),this.hideSortBar(),this.hideNextPreviousButtons(),this.hideShareControls(),this.hideFooter(),this.clearMainSelection(),this.setMainSelection(".work"),this.hidePosition(),c?this.hideIllustrationNav(function(){d.setContext(b),d.showContext()}):this.showIllustrationNav(function(){d.hideContext()}),this.setFilterByHashbang(a),this.setDisableYScroll(!1),this.clearTouchEventHandlers()},d.prototype.setClientView=function(a,b,c,d){var e=this;this.reloadOnResize=!1,this.setStageTopPos("96px"),this.hideTitleBar(),this.hideNextPreviousButtons(),this.hideShareControls(),this.hideFooter(),this.clearMainSelection(),this.hidePosition(),this.showIllustrationNav(function(){e.hideContext(),e.showSortBar(),e.setMainSelection(".work"),e.setAlphaSortFn(c),e.setDateSortFn(d),e.setFilterByHashbang(a),e.setDisableYScroll(!1),e.clearTouchEventHandlers()})},d.prototype.setBrowserView=function(a,b,c,d){var e=this;this.reloadOnResize=!0,this.setStageTopPos("96px"),this.showNextPreviousButtons(),this.showShareControls(),this.showFooter(),this.clearMainSelection(),this.setMainSelection(".work"),this.hideIllustrationNav(function(){e.showTitleBar(),e.hideSortBar(),e.setContext(b),e.showPosition(),$(".context-bar .position .current").text(c),$(".context-bar .position .total").text(d),e.showContext(),e.setFilterByHashbang(a),e.setDisableYScroll(!0)})},d.prototype.setThumbnailsView=function(a,b){var c=this;this.reloadOnResize=!1,this.setStageTopPos("64px"),this.hideNextPreviousButtons(),this.showShareControls(),this.hideFooter(),this.clearMainSelection(),this.setMainSelection(".work"),this.hideIllustrationNav(function(){c.hideSortBar(),c.setContext(b),c.hidePosition(),c.showContext(),c.hideTitleBar(),c.setFilterByHashbang(a),c.setDisableYScroll(!1),c.clearTouchEventHandlers()})},d.prototype.setTagGroupsView=function(a){var b=this;this.reloadOnResize=!1,this.setStageTopPos("64px"),this.hideNextPreviousButtons(),this.hideShareControls(),this.hideFooter(),this.clearMainSelection(),this.setMainSelection(".work"),this.showIllustrationNav(function(){b.hideTitleBar(),b.hideSortBar(),b.hideContext(),b.hidePosition(),b.setFilterByHashbang(a),b.setDisableYScroll(!1),b.clearTouchEventHandlers()})},d}),define("js/mvc/viewModels/ContentViewModel",[],function(){function a(a,b,c,d,e){var f={},g;this.getUrl=function(){return b},this.getThemeClasses=function(){return d},this.getSelectedItem=function(){return c},this.getTitle=function(){return e},this.getModel=function(){return a},this.getModelData=function(){return f},this.getContent=function(){return g},this.setContent=function(a){g=a}}var b=a.prototype;return b.update=function(a){var b=this.getModelData();b.url=this.getUrl(),b.selectedItem=this.getSelectedItem(),b.themeClass=this.getThemeClasses(),b.title=this.getTitle()},a}),define("js/mvc/views/ContentView",["js/core/core","js/mvc/views/mvc.View"],function(a,b){function c(a,b){this.getViewModel=function(){return a},this.getNavView=function(){return b}}a.inherit(c,b);var d=c.prototype;return d.render=function(){var a=this.getViewModel().getModelData().url,b=this.getViewModel().getModelData(),c=b.selectedItem,d=this.getNavView(),e={contextItem:[]};b.themeClass&&this.setTheme(b.themeClass),$(".stage").load(a+"#app section.editorial-content"),b.title&&b.title.length?e.contextItem.push({title:b.title,value:window.location.hash}):e=null,d.setContentView(c,e),d.showStage()},c}),define("js/mvc/controllers/ContentController",["js/core/core","js/mvc/controllers/mvc.Controller","js/mvc/views/ContentView","js/mvc/viewModels/ContentViewModel"],function(a,b,c,d){function e(a){var b;this.getModel=function(){return a},this.getNavView=function(){return b},this.setPartialViews=function(a){b=a}}function g(a,b,e,f,g,h){var i,j;j=new d(a.getModel(),b,f,g,h),i=new c(j,e),j.update(),i.render()}a.inherit(e,b);var f=e.prototype;return f.displayHome=function(a){g(this,"/index.html",a,".home","theme-light")},f.displayAbout=function(a){g(this,"/about.html",a,".about","theme-dark","About")},f.displayDownloads=function(a){g(this,"/downloads.html",a,".downloads","theme-dark","Downloads")},f.displayContact=function(a){g(this,"/contact.html",a,".contact","theme-dark","Contact")},e}),define("js/GrundiniApp",["js/mvc/models/GrundiniAppModel","js/mvc/controllers/BrowseIllustrationsController","js/mvc/partialViews/NavigationMenuView","js/mvc/controllers/ContentController","js/mvc/views/ContentView"],function(a,b,c,d,e){function j(a,b,c){if(!f||f.constructor!==a)f=new a(g),f.setPartialViews(i);g.isReady()?b():g.onReady(b)}var f,g=new a;g.load();var h={},i={navView:new c({elms:[{name:"root",selector:".illustration-nav"}]})};return h.routeHandler={displayHome:function(a){function b(){f.displayHome(i.navView)}j(d,b)},displayAbout:function(a){function b(){f.displayAbout(i.navView)}j(d,b)},displayContact:function(a){function b(){f.displayContact(i.navView)}j(d,b)},displayDownloads:function(a){function b(){f.displayDownloads(i.navView)}j(d,b)},listProjects:function(a){function c(){f.displayProjects(i.navView,a.client)}j(b,c)},listClients:function(a){function c(){f.displayClients(i.navView)}j(b,c)},listTagsForGroup:function(a){function c(){f.displayTagsForGroup(i.navView,a.group)}j(b,c)},displayThumbnailsForProject:function(a){function c(){f.displayThumbnailsForProject(i.navView,a.project,a.client)}j(b,c)},displayThumbnailsForTag:function(a){function c(){f.displayThumbnailsForTag(i.navView,a.tag)}j(b,c)},displayProjectIllustrationBrowser:function(a){function c(){f.displayProjectIllustrationBrowser(i.navView,a.project,a.illustration,a.client)}j(b,c)},displayTagIllustrationBrowser:function(a){function c(){f.displayTagggedIllustrationsBrowser(i.navView,a.tag,a.illustration)}j(b,c)}},h}),require(["js/core/routeHandler","js/core/simpleMemCache","js/GrundiniApp"],function(a,b,c){window.cache=b,window.onunload=function(){try{delete window.cache}catch(a){}},$(document).ready(function(){a(c)})}),define("js/main.js",function(){})
