var dmc;(function(n){function i(t,i){var r=n(i);return r.length<2?r:t.parent().find(i)}function r(r,u){var f=this,v=r.add(f),e=r.children(),l=0,o=u.vertical,y,p,a,s,h,c;t||(t=f),e.length>1&&(e=n(u.items,r)),u.size>1&&(u.circular=!1),n.extend(f,{getConf:function(){return u},getIndex:function(){return l},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return s.add(h)},getRoot:function(){return r},getItemWrap:function(){return e},getItems:function(){return e.find(u.item).not("."+u.clonedClass)},move:function(n,t){return f.seekTo(l+n,t)},next:function(n){return f.move(u.size,n)},prev:function(n){return f.move(-u.size,n)},begin:function(n){return f.seekTo(0,n)},end:function(n){return f.seekTo(f.getSize()-1,n)},focus:function(){return t=f,f},addItem:function(t){return t=n(t),u.circular?(e.children().last().before(t),e.children().first().replaceWith(t.clone().addClass(u.clonedClass))):(e.append(t),h.removeClass("disabled")),v.trigger("onAddItem",[t]),f},seekTo:function(i,r,s){var h,c,a;return(i.jquery||(i*=1),u.circular&&i===0&&l==-1&&r!==0)?f:!u.circular&&i<0||i>f.getSize()||i<-1?f:(h=i,i.jquery?i=f.getItems().index(i):h=f.getItems().eq(i),c=n.Event("onBeforeSeek"),!s&&(v.trigger(c,[i,r]),c.isDefaultPrevented()||!h.length))?f:(a=o?{top:-h.position().top}:{left:-h.position().left},l=i,t=f,r===undefined&&(r=u.speed),e.animate(a,r,u.easing,s||function(){v.trigger("onSeek",[i])}),f)}}),n.each(["onBeforeSeek","onSeek","onAddItem"],function(t,i){n.isFunction(u[i])&&n(f).on(i,u[i]),f[i]=function(t){return t&&n(f).on(i,t),f}}),u.circular&&(y=f.getItems().slice(-1).clone().prependTo(e),p=f.getItems().eq(1).clone().appendTo(e),y.add(p).addClass(u.clonedClass),f.onBeforeSeek(function(n,t,i){if(!n.isDefaultPrevented()){if(t==-1)return f.seekTo(y,i,function(){f.end(0)}),n.preventDefault();t==f.getSize()&&f.seekTo(p,i,function(){f.begin(0)})}}),a=r.parents().add(r).filter(function(){if(n(this).css("display")==="none")return!0}),a.length?(a.show(),f.seekTo(0,0,function(){}),a.hide()):f.seekTo(0,0,function(){})),s=i(r,u.prev).click(function(n){n.stopPropagation(),f.prev()}),h=i(r,u.next).click(function(n){n.stopPropagation(),f.next()}),u.circular||(f.onBeforeSeek(function(n,t){setTimeout(function(){n.isDefaultPrevented()||(s.toggleClass(u.disabledClass,t<=0),h.toggleClass(u.disabledClass,t>=f.getSize()-1))},1)}),u.initialIndex||s.addClass(u.disabledClass)),f.getSize()<2&&s.add(h).addClass(u.disabledClass),u.mousewheel&&n.fn.mousewheel&&r.mousewheel(function(n,t){if(u.mousewheel)return f.move(t<0?1:-1,u.wheelSpeed||50),!1}),u.touch&&(c={},e[0].ontouchstart=function(n){var t=n.touches[0];c.x=t.clientX,c.y=t.clientY},e[0].ontouchmove=function(n){if(n.touches.length==1&&!e.is(":animated")){var t=n.touches[0],i=c.x-t.clientX,r=c.y-t.clientY;f[o&&r>0||!o&&i>0?"next":"prev"](),n.preventDefault()}}),u.keyboard&&n(document).on("keydown.scrollable",function(i){if(!(!u.keyboard||i.altKey||i.ctrlKey||i.metaKey||n(i.target).is(":input"))){if(u.keyboard!="static"&&t!=f)return;var r=i.keyCode;if(o&&(r==38||r==40))return f.move(r==38?-1:1),i.preventDefault();if(!o&&(r==37||r==39))return f.move(r==37?-1:1),i.preventDefault()}}),u.initialIndex&&f.seekTo(u.initialIndex,0,function(){})}n.tools=n.tools||{version:"v1.2.7"},n.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,wheelSpeed:0}};var t;n.fn.scrollable=function(t){var i=this.data("scrollable");return i?i:(t=n.extend({},n.tools.scrollable.conf,t),this.each(function(){i=new r(n(this),t),n(this).data("scrollable",i)}),t.api?i:this)}})(jQuery),function(n){var t=n.tools.scrollable;t.autoscroll={conf:{autoplay:!0,interval:3e3,autopause:!0}},n.fn.autoscroll=function(i){typeof i=="number"&&(i={interval:i});var r=n.extend({},t.autoscroll.conf,i),u;return this.each(function(){function o(){i&&clearTimeout(i),i=setTimeout(function(){t.next()},r.interval)}var t=n(this).data("scrollable"),f=t.getRoot(),i,e=!1;t&&(u=t),t.play=function(){i||(e=!1,f.on("onSeek",o),o())},t.pause=function(){i=clearTimeout(i),f.off("onSeek",o)},t.resume=function(){e||t.play()},t.stop=function(){e=!0,t.pause()},r.autopause&&f.add(t.getNaviButtons()).hover(t.pause,t.resume),r.autoplay&&t.play()}),r.api?u:this}}(jQuery),function(n){function i(t,i){var r=n(i);return r.length<2?r:t.parent().find(i)}var t=n.tools.scrollable;t.navigator={conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:!1,idPrefix:null,history:!1}},n.fn.navigator=function(r){typeof r=="string"&&(r={navi:r}),r=n.extend({},t.navigator.conf,r);var u;return this.each(function(){function c(n,i,r){t.seekTo(i),r.preventDefault(),h&&history.pushState({i:i},"")}function f(){return e.find(r.naviItem||"> *")}function l(t){var i=n("<"+(r.naviItem||"a")+"/>").click(function(i){c(n(this),t,i)});return t===0&&i.addClass(o),r.indexed&&i.text(t+1),r.idPrefix&&i.attr("id",r.idPrefix+t),i.appendTo(e)}var t=n(this).data("scrollable"),e=r.navi.jquery?r.navi:i(t.getRoot(),r.navi),a=t.getNaviButtons(),o=r.activeClass,h=r.history&&history.pushState,s=t.getConf().size;t&&(u=t),t.getNaviButtons=function(){return a.add(e)},h&&(history.pushState({i:0},""),n(window).on("popstate",function(n){var i=n.originalEvent.state;i&&t.seekTo(i.i)})),f().length?f().each(function(t){n(this).click(function(i){c(n(this),t,i)})}):n.each(t.getItems(),function(n){n%s==0&&l(n)}),t.onBeforeSeek(function(n,t){setTimeout(function(){if(!n.isDefaultPrevented()){var i=t/s,r=f().eq(i);r.length&&f().removeClass(o).eq(i).addClass(o)}},1)}),t.onAddItem(function(n,i){var r=t.getItems().index(i);r%s==0&&l(r)})}),r.api?u:this}}(jQuery),function(n){function s(t,r,u,e){var s={data:e||(r?r.data:{}),_wrap:r?r._wrap:null,tmpl:null,parent:r||null,nodes:[],calls:g,nest:nt,wrap:tt,html:it,update:rt};return t&&n.extend(s,t,{nodes:[],parent:r}),u&&(s.tmpl=u,s._ctnt=s._ctnt||s.tmpl(n,s),s.key=++o,(c.length?f:i)[o]=s),s}function h(t,i,r){var f,e=r?n.map(r,function(n){return typeof n=="string"?t.key?n.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+u+'="'+t.key+'" $2'):n:h(n,t,n._ctnt)}):t;return i?e:(e=e.join(""),e.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(t,i,r,u){f=n(r).get(),k(f),i&&(f=l(i).concat(f)),u&&(f=f.concat(l(u)))}),f?f:l(e))}function l(t){var i=document.createElement("div");return i.innerHTML=t,n.makeArray(i.childNodes)}function w(t){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+n.trim(t).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(t,i,r,u,f,e,o){var h=n.tmpl.tag[r],c,s,l;if(!h)throw"Template command not found: "+r;return c=h._default||[],e&&!/\w$/.test(f)&&(f+=e,e=""),f?(f=a(f),o=o?","+a(o)+")":e?")":"",s=e?f.indexOf(".")>-1?f+e:"("+f+").call($item"+o:f,l=e?s:"(typeof("+f+")==='function'?("+f+").call($item):("+f+"))"):l=s=c.$1||"null",u=a(u),"');"+h[i?"close":"open"].split("$notnull_1").join(f?"typeof("+f+")!=='undefined' && ("+f+")!=null":"true").split("$1a").join(l).split("$1").join(s).split("$2").join(u?u.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,function(n,t,i,r){return r=r?","+r+")":i?")":"",r?"("+t+").call($item"+r:n}):c.$2||"")+"_.push('"})+"');}return _;")}function b(t,i){t._wrap=h(t,!0,n.isArray(i)?i:[y.test(i)?i:n(i).html()]).join("")}function a(n){return n?n.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function d(n){var t=document.createElement("div");return t.appendChild(n.cloneNode(!0)),t.innerHTML}function k(t){function p(t){function p(n){n=n+a,e=v[n]=v[n]||s(e,i[e.parent.key+a]||e.parent,null,!0)}var y,h=t,c,e,l;if(l=t.getAttribute(u)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(y=h.getAttribute(u)));y!==l&&(h=h.parentNode?h.nodeType===11?0:h.getAttribute(u)||0:0,(e=i[l])||(e=f[l],e=s(e,i[h]||f[h],null,!0),e.key=++o,i[o]=e),r&&p(l)),t.removeAttribute(u)}else r&&(e=n.data(t,"tmplItem"))&&(p(e.key),i[e.key]=e,h=n.data(t.parentNode,"tmplItem"),h=h?h.key:0);if(e){for(c=e;c&&c.key!=h;)c.nodes.push(t),c=c.parent;delete e._ctnt,delete e._wrap,n.data(t,"tmplItem",e)}}for(var a="_"+r,c,l,v={},e,h=0,y=t.length;h<y;h++)if((c=t[h]).nodeType===1){for(l=c.getElementsByTagName("*"),e=l.length-1;e>=0;e--)p(l[e]);p(c)}}function g(n,t,i,r){if(!n)return c.pop();c.push({_:n,tmpl:t,item:this,data:i,options:r})}function nt(t,i,r){return n.tmpl(n.template(t),i,r,this)}function tt(t,i){var r=t.options||{};return r.wrapped=i,n.tmpl(n.template(t.tmpl),t.data,r,t.item)}function it(t,i){var r=this._wrap;return n.map(n(n.isArray(r)?r.join(""):r).filter(t||"*"),function(n){return i?n.innerText||n.textContent:n.outerHTML||d(n)})}function rt(){var t=this.nodes;n.tmpl(null,null,null,this).insertBefore(t[0]),n(t).remove()}var v=n.fn.domManip,u="_tmplitem",y=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,i={},f={},e,p={key:0,data:{}},o=0,r=0,c=[];n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,u){n.fn[t]=function(f){var o=[],h=n(f),c,s,a,v,l=this.length===1&&this[0].parentNode;if(e=i||{},l&&l.nodeType===11&&l.childNodes.length===1&&h.length===1)h[u](this[0]),o=this;else{for(s=0,a=h.length;s<a;s++)r=s,c=(s>0?this.clone(!0):this).get(),n.fn[u].apply(n(h[s]),c),o=o.concat(c);r=0,o=this.pushStack(o,t,h.selector)}return v=e,e=null,n.tmpl.complete(v),o}}),n.fn.extend({tmpl:function(t,i,r){return n.tmpl(this[0],t,i,r)},tmplItem:function(){return n.tmplItem(this[0])},template:function(t){return n.template(t,this[0])},domManip:function(t,u,f){if(t[0]&&t[0].nodeType){for(var s=n.makeArray(arguments),h=t.length,c=0,l;c<h&&!(l=n.data(t[c++],"tmplItem")););h>1&&(s[0]=[n.makeArray(t)]),l&&r&&(s[2]=function(t){n.tmpl.afterManip(this,t,f)}),v.apply(this,s)}else v.apply(this,arguments);return r=0,e||n.tmpl.complete(i),this}}),n.extend({tmpl:function(t,r,u,e){var o,c=!e;if(c)e=p,t=n.template[t]||n.template(null,t),f={};else if(!t)return t=e.tmpl,i[e.key]=e,e.nodes=[],e.wrapped&&b(e,e.wrapped),n(h(e,null,e.tmpl(n,e)));return t?(typeof r=="function"&&(r=r.call(e||{})),u&&u.wrapped&&b(u,u.wrapped),o=n.isArray(r)?n.map(r,function(n){return n?s(u,e,t,n):null}):[s(u,e,t,r)],c?n(h(e,null,o)):o):[]},tmplItem:function(t){var i;for(t instanceof n&&(t=t[0]);t&&t.nodeType===1&&!(i=n.data(t,"tmplItem"))&&(t=t.parentNode););return i||p},template:function(t,i){return i?(typeof i=="string"?i=w(i):i instanceof n&&(i=i[0]||{}),i.nodeType&&(i=n.data(i,"tmpl")||n.data(i,"tmpl",w(i.innerHTML))),typeof t=="string"?n.template[t]=i:i):t?typeof t!="string"?n.template(null,t):n.template[t]||n.template(null,y.test(t)?t:n(t)):null},encode:function(n){return(""+n).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}}),n.extend(n.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(){i={}},afterManip:function(t,i,u){var f=i.nodeType===11?n.makeArray(i.childNodes):i.nodeType===1?[i]:[];u.call(t,i),k(f),r++}})}(jQuery),dmc=dmc||{},dmc.utilities=function(){var n=!1,t=function(){},i=function(){$("a[href^='#']").click(function(){ga&&ga("send",{hitType:"pageview",page:"/#"+$(this).attr("href").substring(1)})})},r=function(){$.ajaxSetup({error:function(xhr,status,error){var response=eval("("+xhr.responseText+")");alert(response.ErrorMessage),n&&alert(response.Stack)}})};return{init:t}}(),function(){for(var n,u=function(){},t=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],i=t.length,r=window.console=window.console||{};i--;)n=t[i],r[n]||(r[n]=u)}(),String.prototype.format=function(){for(var n=this,t=arguments.length;t--;)n=n.replace(new RegExp("\\{"+t+"\\}","gm"),arguments[t]);return n},dmc=dmc||{},dmc.tweets=function(){var n=[],t=function(n){var t="https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name="+n.screenname+"&include_rts=true&trim_user=false&exclude_replies=true&count="+n.count;return"/TwitterApiBridge?url="+encodeURIComponent(t)},r=function(){return $.Deferred(function(n){n.reject()})},i=function(i,r){var u=[];$.each(i.feeds,function(i,r){u.push($.getJSON(t(r),function(t){$.merge(n,t)}))}),$.when.apply($,u).then(function(){$.each(n,function(n,t){var i=t.text;i=i.replace(/(http|https):\/\/\S+/g,'<a href="$&" target="_blank">$&<\/a>'),i=i.replace(/\s(@)(\w+)/g,' @<a href="http://twitter.com/$2" target="_blank">$2<\/a>'),i=i.replace(/\s(#)(\w+)/g,' #<a href="http://search.twitter.com/search?q=%23$2" target="_blank">$2<\/a>'),t.text=i,t.jdate=new Date(t.created_at.replace(/^\w+ (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/,"$1 $2 $4 $3 UTC"))}),i.sort&&n.sort(function(n,t){return t.jdate-n.jdate});r.onComplete(n)},function(){r.onFail(null)})};return{load:i}}(),dmc=dmc||{},dmc.global=function(){var t=null,n=null,i=null,r=function(){t=$("#page-scroll"),e(),f(),u(),$("a.btn-home").click(function(){n.seekTo(0)}),$("a.btn-start, #btn-next-hint").click(function(){n.seekTo(1)}),$("a.btn-start").hover(function(){$("#btn-next-hint").stop().fadeIn(1200)},function(){$("#btn-next-hint").stop().fadeOut(300)});var r={sort:!0,feeds:[{screenname:"dmcnetau",count:30}]},o={onComplete:function(n){$(".data-tmpl-tweet").template("tmpl_tweets"),$("#tweets").empty(),$.tmpl("tmpl_tweets",n).appendTo("#tweets"),$("#twitter-feed").scrollable({vertical:!0,next:".next-tweet",prev:".prev-tweet",disabledClass:"nav-tweet-disabled"}),i=$("#twitter-feed").data("scrollable");i.onSeek(function(){_gaq.push(["_trackPageview","/#blog/article"])});$("#blog nav").stop().fadeIn(300)}};dmc.tweets.load(r,o)},u=function(){$(".obfuscate").each(function(){$(this).on({click:function(){window.location.href="mailto:"+$(this).html().split("").reverse().join("")}})})},f=function(){if(n!=null)n.onSeek(function(n,t){var i=["home","about","blog","contact"];_gaq.push(["_trackPageview","/#"+i[t]])})},e=function(){t.scrollable({next:".next-page",prev:".prev-page",disabledClass:"nav-page-disabled"}),n=$("#page-scroll").data("scrollable");n.onBeforeSeek(function(n,t){t==0?$(".browse").stop().hide():$(".browse").stop().fadeIn(300)})};return{init:r}}(),$(function(){"use strict";dmc.global.init()})