window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;console.log(Array.prototype.slice.call(arguments))}};(function(e){function h(){}for(var g="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),f;f=g.pop();){e[f]=e[f]||h}})(window.console=window.console||{});
/*!
 * jQuery Templates Plugin 1.0.0pre
 * http://github.com/jquery/jquery-tmpl
 * Requires jQuery 1.4.2
 *
 * Copyright Software Freedom Conservancy, Inc.
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 */
(function(i,f){var t=i.fn.domManip,h="_tmplitem",u=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,p={},e={},y,x={key:0,data:{}},w=0,q=0,g=[];function k(B,A,D,E){var C={data:E||(E===0||E===false)?E:(A?A.data:{}),_wrap:A?A._wrap:null,tmpl:null,parent:A||null,nodes:[],calls:c,nest:b,wrap:n,html:r,update:z};if(B){i.extend(C,B,{nodes:[],parent:A})}if(D){C.tmpl=D;C._ctnt=C._ctnt||C.tmpl(i,C);C.key=++w;(g.length?e:p)[w]=C}return C}i.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(A,B){i.fn[A]=function(C){var F=[],I=i(C),E,G,D,J,H=this.length===1&&this[0].parentNode;y=p||{};if(H&&H.nodeType===11&&H.childNodes.length===1&&I.length===1){I[B](this[0]);F=this}else{for(G=0,D=I.length;G<D;G++){q=G;E=(G>0?this.clone(true):this).get();i(I[G])[B](E);F=F.concat(E)}q=0;F=this.pushStack(F,A,I.selector)}J=y;y=null;i.tmpl.complete(J);return F}});i.fn.extend({tmpl:function(C,B,A){return i.tmpl(this[0],C,B,A)},tmplItem:function(){return i.tmplItem(this[0])},template:function(A){return i.template(A,this[0])},domManip:function(E,H,G,I){if(E[0]&&i.isArray(E[0])){var B=i.makeArray(arguments),A=E[0],F=A.length,C=0,D;while(C<F&&!(D=i.data(A[C++],"tmplItem"))){}if(D&&q){B[2]=function(J){i.tmpl.afterManip(this,J,G)}}t.apply(this,B)}else{t.apply(this,arguments)}q=0;if(!y){i.tmpl.complete(p)}return this}});i.extend({tmpl:function(C,F,E,B){var D,A=!B;if(A){B=x;C=i.template[C]||i.template(null,C);e={}}else{if(!C){C=B.tmpl;p[B.key]=B;B.nodes=[];if(B.wrapped){s(B,B.wrapped)}return i(m(B,null,B.tmpl(i,B)))}}if(!C){return[]}if(typeof F==="function"){F=F.call(B||{})}if(E&&E.wrapped){s(E,E.wrapped)}D=i.isArray(F)?i.map(F,function(G){return G?k(E,B,C,G):null}):[k(E,B,C,F)];return A?i(m(B,null,D)):D},tmplItem:function(B){var A;if(B instanceof i){B=B[0]}while(B&&B.nodeType===1&&!(A=i.data(B,"tmplItem"))&&(B=B.parentNode)){}return A||x},template:function(B,A){if(A){if(typeof A==="string"){A=l(A)}else{if(A instanceof i){A=A[0]||{}}}if(A.nodeType){A=i.data(A,"tmpl")||i.data(A,"tmpl",l(A.innerHTML))}return typeof B==="string"?(i.template[B]=A):A}return B?(typeof B!=="string"?i.template(null,B):(i.template[B]||i.template(null,u.test(B)?B:i(B)))):null},encode:function(A){return(""+A).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});i.extend(i.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(A){p={}},afterManip:function v(C,A,D){var B=A.nodeType===11?i.makeArray(A.childNodes):A.nodeType===1?[A]:[];D.call(C,A);o(B);q++}});function m(A,E,C){var D,B=C?i.map(C,function(F){return(typeof F==="string")?(A.key?F.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+h+'="'+A.key+'" $2'):F):m(F,A,F._ctnt)}):A;if(E){return B}B=B.join("");B.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(G,H,F,I){D=i(F).get();
o(D);if(H){D=a(H).concat(D)}if(I){D=D.concat(a(I))}});return D?D:a(B)}function a(B){var A=document.createElement("div");A.innerHTML=B;return i.makeArray(A.childNodes)}function l(A){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+i.trim(A).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(I,C,G,D,E,J,F){var L=i.tmpl.tag[G],B,H,K;if(!L){throw"Unknown template tag: "+G}B=L._default||[];if(J&&!/\w$/.test(E)){E+=J;J=""}if(E){E=j(E);F=F?(","+j(F)+")"):(J?")":"");H=J?(E.indexOf(".")>-1?E+j(J):("("+E+").call($item"+F)):E;K=J?H:"(typeof("+E+")==='function'?("+E+").call($item):("+E+"))"}else{K=H=B.$1||"null"}D=j(D);return"');"+L[C?"close":"open"].split("$notnull_1").join(E?"typeof("+E+")!=='undefined' && ("+E+")!=null":"true").split("$1a").join(K).split("$1").join(H).split("$2").join(D||B.$2||"")+"__.push('"})+"');}return __;")}function s(B,A){B._wrap=m(B,true,i.isArray(A)?A:[u.test(A)?A:i(A).html()]).join("")}function j(A){return A?A.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function d(A){var B=document.createElement("div");B.appendChild(A.cloneNode(true));return B.innerHTML}function o(G){var I="_"+q,B,A,E={},F,D,C;for(F=0,D=G.length;F<D;F++){if((B=G[F]).nodeType!==1){continue}A=B.getElementsByTagName("*");for(C=A.length-1;C>=0;C--){H(A[C])}H(B)}function H(O){var L,N=O,M,J,K;if((K=O.getAttribute(h))){while(N.parentNode&&(N=N.parentNode).nodeType===1&&!(L=N.getAttribute(h))){}if(L!==K){N=N.parentNode?(N.nodeType===11?0:(N.getAttribute(h)||0)):0;if(!(J=p[K])){J=e[K];J=k(J,p[N]||e[N]);J.key=++w;p[w]=J}if(q){P(K)}}O.removeAttribute(h)}else{if(q&&(J=i.data(O,"tmplItem"))){P(J.key);p[J.key]=J;N=i.data(O.parentNode,"tmplItem");N=N?N.key:0}}if(J){M=J;while(M&&M.key!=N){M.nodes.push(O);M=M.parent}delete J._ctnt;delete J._wrap;i.data(O,"tmplItem",J)}function P(Q){Q=Q+I;J=E[Q]=(E[Q]||k(J,p[J.parent.key+I]||J.parent))}}}function c(C,A,D,B){if(!C){return g.pop()}g.push({_:C,tmpl:A,item:this,data:D,options:B})}function b(A,C,B){return i.tmpl(i.template(A),C,B,this)}function n(C,A){var B=C.options||{};B.wrapped=A;return i.tmpl(i.template(C.tmpl),C.data,B,C.item)}function r(B,C){var A=this._wrap;return i.map(i(i.isArray(A)?A.join(""):A).filter(B||"*"),function(D){return C?D.innerText||D.textContent:D.outerHTML||d(D)})}function z(){var A=this.nodes;i.tmpl(null,null,null,this).insertBefore(A[0]);i(A).remove()}})(jQuery);
/*! 
 * CSS hook -- transitions
 * Copyright (c) 2010 Burin Asavesna (http://helloburin.com)
 * Licensed under the MIT License (LICENSE.txt).
 */
(function(d){var e=document.createElement("div"),a=e.style,c=d.support,b="Property Duration TimingFunction".split(" ");c.transition=a.MozTransition===""?"MozTransition":(a.MsTransition===""?"MsTransition":(a.WebkitTransition===""?"WebkitTransition":(a.OTransition===""?"OTransition":(a.transition===""?"Transition":false))));e=null;if(c.transition&&c.transition!=="Transition"){d.cssHooks.transition={get:function(h,g,f){return d.map(b,function(k,j){return d.css(h,c.transition+k)}).join(" ")},set:function(f,g){f.style[c.transition]=g}};d.each(b,function(f,g){d.cssHooks["transition"+g]={get:function(j,i,h){return d.css(j,c.transition+g)},set:function(h,i){h.style[c.transition+g]=i}}})}})(jQuery);
/*!
* Experimental header scroller
* Someday to be made more generic and opensourced
* Author: Nick Evans 2011
*/
(function(g){var c=navigator.userAgent.toLowerCase(),b=!!c.match(/applewebkit/i);var f=false;try{document.createEvent("TouchEvent");f=true}catch(i){}var h=function(){},a=function(){},d=function(){if(f&&b){return new a()}else{return new h()}};h.prototype.settings={$header:null,winHeight:null,smallestHeight:null,inHeaderLockedOff:false,fontSize:null,two:"other",scaleFactor:null,referencePointSelector:null,sections:null,horizontal_scroll:null,section_flip:null,prev_section:0,prev_x:0,prev_y:0};
h.prototype.getScrollPosition=function(){return $(g).scrollTop()};h.prototype.assessHeaderCondition=function(){var k=this.settings,l=this;if(k.$header.height()>k.smallestHeight&&l.getScrollPosition()<k.winHeight-200||l.getScrollPosition()<k.winHeight-200){l.resizeElement(k.$header);for(var e=0,j=l.extraElements.length;e<j;e+=1){l.resizeElement($(l.extraElements[e]))}if(k.inHeaderLockedOff){this.settings.inHeaderLockedOff=false;$("body").removeClass("scroll-locked-off");k.$header.parent().parent().removeClass("locked-off");if(typeof(this.callbacks.onRemoveLockOff)=="function"){this.callbacks.onRemoveLockOff()}}}else{if(!k.inHeaderLockedOff){l.lockOffElement(k.$header);for(var e=0,j=l.extraElements.length;e<j;e+=1){l.lockOffElement($(l.extraElements[e]))}}}};h.prototype.assessViewPort=function(){if(this.settings.winHeight!=$(g).height()){this.settings.winHeight=$(g).height();this.assessHeaderCondition()}};
/*! yup, we could be using scale here, and I'm experimenting with it */
h.prototype.resizeElement=function(j){var k=this.settings,e=$(g).scrollTop()>1?100-(100*($(g).scrollTop()/k.winHeight)):100;j.css({height:e+"%","font-size":j.height()/k.scaleFactor+"px","line-height":j.height()+"px"}).find("h1").css({height:"100%","font-size":"100%","line-height":"100%"});if(typeof(this.callbacks.resizeHeader)=="function"){this.callbacks.resizeHeader()}};h.prototype.lockOffElement=function(e){var j=this.settings,k=e.clone(true);k.css({height:j.smallestHeight+"px","font-size":j.fontSize+"px","line-height":j.smallestHeight+"px"}).find("h1").css({height:j.smallestHeight+"px","font-size":j.fontSize+"px","line-height":j.smallestHeight+"px"}).addClass("locked-off");if(j.$header===e){this.settings.$header=k}e.replaceWith(k);this.settings.inHeaderLockedOff=true;$("body").addClass("scroll-locked-off");if(typeof(this.callbacks.lockOffElement)=="function"){this.callbacks.lockOffElement()}};h.prototype.init=function(e){var k=document.body.style;this.settings.$header=e.header||$("header");this.settings.smallestHeight=e.smallestHeight||100;this.settings.fontSize=e.fontSize||44;this.callbacks=e.callbacks||{};this.extraElements=e.extraElements||[];this.settings.scaleFactor=e.scaleFactor||2;var j=this;this.settings.tStyle=(k.WebkitTransform!==undefined)?"-webkit-transform":(k.MozTransform!==undefined)?"-moz-transform":(k.msTransition!==undefined)?"-ms-transform":(k.OTransform!==undefined)?"-o-transform":(k.transform!==undefined)?"transform":null;$(g).bind("scroll",function(l){j.assessHeaderCondition()});$(g).bind("resize",function(l){j.assessViewPort()});this.assessViewPort()};a.prototype=new h();a.prototype.resizeElement=function(){var k=this.settings,l=this,j=l.getScrollPosition(),e=(j>1)?100-(100*-((-j/k.winHeight))):100,m=k.$header.height(),n=k.$header.find("h1").clone(true);n.css({"font-size":parseInt(m/k.scaleFactor,10)+"px","line-height":m+"px"});k.$header.css("height",e+"%");k.$header.find("h1").replaceWith(n)};a.prototype.getScrollPosition=function(){var e=this.settings;return -$(e.referencePointSelector).offset().top};a.prototype.init=function(e){this.settings.$header=e.header||$("header");this.settings.smallestHeight=e.smallestHeight||100;this.settings.fontSize=e.fontSize||44;this.settings.scaleFactor=e.scaleFactor||2;this.settings.referencePointSelector=e.referencePointSelector||"#container-liner";this.callbacks=e.callbacks||{};this.extraElements=e.extraElements||[];var j=this;this.section_flip=new iScroll("container",{hScrollbar:false,vScrollbar:true,snap:".touch-div",momentum:false,onScrollMove:function(k){j.assessHeaderCondition()},onScrollEnd:function(k){j.onScrollEnd()}});$(g).bind("resize",function(k){j.assessViewPort()});this.assessViewPort()};a.prototype.onScrollEndLoop=function(j){var e=j.settings.$header.height();j.assessHeaderCondition();if(e!=j.settings.$header.height()){j.onScrollEnd()}};a.prototype.onScrollEnd=function(){var e=this;this.timer=setTimeout(function(){e.onScrollEndLoop(e)},100);if(typeof(this.callbacks.onScrollEnd)=="function"){this.callbacks.onScrollEnd(this)
}};g.scrollableHeader=d})(window);(function(a){a.fn.carousel=function(b){var d={slider:".slider",slide:".slide",pagination:false,prevSlide:".prev",nextSlide:".next",speed:500},c=a.extend(d,b);carousel={roundDown:function(e){var e=parseInt(e,10);return Math.ceil((e-(e%100))/100)*100},transitionSupport:function(){var e=document.body.style;return e.webkitTransition!==undefined||e.mozTransition!==undefined||e.msTransition!==undefined||e.oTransition!==undefined||e.transition!==undefined},transitionSwap:function(e,f){var g=c.speed/1000,h=(f)?"margin-left "+g+"s ease":"none";e.css({"-webkit-transition":h,"-moz-transition":h,"-ms-transition":h,"-o-transition":h,transition:h})},snapBack:function(f,h){var e=(f.attr("style")!==undefined)?f.attr("style").match(/margin\-left:(.*[0-9])/i)&&parseInt(RegExp.$1):0,g=(h===false)?carousel.roundDown(e)-100:carousel.roundDown(e);carousel.transitionSwap(f,true);carousel.move(f,g)},nextPrev:function(i,f){var h=(i)?i.attr("style").match(/margin\-left:(.*[0-9])/i)&&parseInt(RegExp.$1):0,g=i.find(c.slide),j=f==="prev"?h!=0:-h<(g.length-1)*100,e=a('[href="#'+i.attr("id")+'"]');if(!i.is(":animated")&&j){if(f==="prev"){h=(h%100!=0)?carousel.roundDown(h):h+100}else{h=((h%100)!=0)?carousel.roundDown(h)-100:h-100}}else{var h=carousel.roundDown(h)}carousel.move(i,h)},createPagination:function(e){e.each(function(g){var j=a(this),f=a('<ol class="carousel-tabs" role="tablist" />'),h=j.find(c.slide).length,k=j.index()+1;while(h--){var g=h+1;f.prepend('<li><a href="#carousel'+k+"-slide"+g+'" id="carousel'+k+"-tab"+g+'" role="tab" tabindex="-1" aria-selected="false">Page '+g+"</a></li>")}f.find("li").keydown(function(n){var l=a(this),m=l.prev().find("a"),i=l.next().find("a");switch(n.which){case 37:case 38:m.length&&m.trigger("click").focus();n.preventDefault();break;case 39:case 40:i.length&&i.trigger("click").focus();n.preventDefault();break}}).find("a").click(function(n){var l=a(this),m=l.parent().index(),i=-(100*(m)),o=j.find(c.slider);carousel.move(o,i);n.preventDefault()});j.append(f)})},move:function(f,e){if(carousel.transitionSupport()){f.css("marginLeft",e+"%")}else{f.animate({marginLeft:e+"%"},c.speed)}carousel.navState(f,e)},activeSlide:function(h,g){var f=h.find(c.slide),e=a(f[g]);e.addClass("active").attr("aria-hidden",false).find("*").removeAttr("tabindex").end().siblings().removeClass("active").attr("aria-hidden",true).find("*").attr("tabindex",-1)},navState:function(j,g){var f=a('[href="#'+j.attr("id")+'"]'),i=j.find(c.slide),h=-(g/100),e=j.parent().find(".carousel-tabs");f.removeClass("disabled");carousel.activeSlide(j,h);if(e.length){e.find("li:nth-child("+(h+1)+")").addClass("current").find("a").attr({tabindex:0,"aria-selected":true}).end().siblings().removeClass("current").find("a").attr({tabindex:-1,"aria-selected":false})}switch(g){case (-(i.length-1)*100):f.filter(c.nextSlide).addClass("disabled");break;case 0:f.filter(c.prevSlide).addClass("disabled");break}}};a(c.nextSlide+","+c.prevSlide).click(function(i){var g=a(this),h=g.attr("href"),f=(g.is(c.prevSlide))?"prev":"next",j=a(h);if(g.is(".disabled")){return false}carousel.nextPrev(j,f);i.preventDefault()}).keydown(function(h){var f=a(this),g=f.attr("href");switch(h.which){case 37:case 38:a(c.prevSlide).filter('[href="'+g+'"]').trigger("click").focus();break;case 39:case 40:a(c.nextSlide).filter('[href="'+g+'"]').trigger("click").focus();break}});a(c.prevSlide).addClass("disabled");this.live("dragSnap",function(h,g){var i=a(this).find(c.slider),f=(g.direction==="left")?"next":"prev";carousel.nextPrev(i,f)});if(c.pagination){carousel.createPagination(this)}return this.each(function(j){var e=a(this),i=e.find(c.slider),h=e.find(c.slide),g=h.length,f=c.speed/1000;e.css({overflow:"hidden",width:"100%"});i.css({marginLeft:"0px",width:100*g+"%"});h.css({width:(100/g)+"%"}).each(function(m){var l=a(this),k="carousel"+(j+1),m=m+1;l.attr({role:"tabpanel",id:k+"-slide"+m});if(c.pagination){l.attr("aria-labelledby",k+"-tab"+m)}});carousel.navState(i,0);
carousel.transitionSwap(i,true)})};a.event.special.dragSnap={setup:function(){var b=a(this);b.bind("touchstart",function(i){var h=i.originalEvent.touches?i.originalEvent.touches[0]:i,j={time:(new Date).getTime(),coords:[h.pageX,h.pageY],origin:a(i.target).closest(".slidewrap")},d,g=a(i.target).closest(".slider"),c=(g.attr("style")!=undefined)?g.attr("style").match(/margin\-left:(.*[0-9])/i)&&parseInt(RegExp.$1):0;carousel.transitionSwap(g,false);function f(l){var k=l.originalEvent.touches?l.originalEvent.touches[0]:l;d={time:(new Date).getTime(),coords:[k.pageX,k.pageY]};if(!j||Math.abs(j.coords[0]-d.coords[0])<Math.abs(j.coords[1]-d.coords[1])){return}g.css({"margin-left":c+(((d.coords[0]-j.coords[0])/j.origin.width())*100)+"%"});if(Math.abs(j.coords[0]-d.coords[0])>10){l.preventDefault()}}b.bind("gesturestart",function(k){b.unbind("touchmove",f).unbind("touchend",f)}).bind("touchmove",f).one("touchend",function(l){b.unbind("touchmove",f);carousel.transitionSwap(g,true);if(j&&d){if(Math.abs(j.coords[0]-d.coords[0])>10&&Math.abs(j.coords[0]-d.coords[0])>Math.abs(j.coords[1]-d.coords[1])){l.preventDefault()}else{carousel.snapBack(g,true);return}if(Math.abs(j.coords[0]-d.coords[0])>1&&Math.abs(j.coords[1]-d.coords[1])<75){var k=j.coords[0]>d.coords[0];if(-(d.coords[0]-j.coords[0])>(j.origin.width()/4)||(d.coords[0]-j.coords[0])>(j.origin.width()/4)){j.origin.css("marginLeft",0).trigger("dragSnap",{direction:k?"left":"right"})}else{carousel.snapBack(g,k)}}}j=d=undefined})})}}})(jQuery);/*!
 Device agnositc logic
 Author: Nick Evans
*/
var nick=nick||{};nick={settings:{scaleFactor:(Modernizr.touch)?((window.innerHeight>window.innerWidth)?4:2.5):2,mainMessageHeight:null},behaviours:function(){nick.settings.mainMessageHeight=parseFloat($(window).height()/this.settings.scaleFactor);$("body").removeClass("loading");$("#mainMessage span").css({lineHeight:nick.settings.mainMessageHeight*this.settings.scaleFactor+"px",fontSize:nick.settings.mainMessageHeight});$(window).resize(function(){nick.settings.mainMessageHeight=$(window).height()/nick.settings.scaleFactor;$("#mainMessage span").css({lineHeight:nick.settings.mainMessageHeight*nick.settings.scaleFactor+"px",fontSize:nick.settings.mainMessageHeight})});$("#sectionTmpl").tmpl(nick.stripContent).insertAfter("#section-0");$(".horizontal-carousel-with-content").carousel({slider:".horizontal-carousel-slider",slide:".horizontal-carousel-slide",pagination:true,nextSlide:".horizontal-carousel-controls-next",prevSlide:".horizontal-carousel-controls-prev",speed:300})}};$(document).ready(function(){nick.behaviours();yepnope([{test:Modernizr.touch,yep:["js/helper/touchHelpers.js"],nope:["js/helper/desktopHelpers.js"],callback:function(b,a,c){if(a){if(b==="js/helper/touchHelpers.js"){nick.touchBehaviours()}}else{nick.desktopBehaviours()}}},{test:Modernizr.backgroundsize,nope:["js/libs/jquery.imgCenter.minified.js"],callback:function(b,a,c){$(".slider .slider-item img").each(function(){$(this).imgCenter()})}}]);if(Modernizr.backgroundsize){$(".horizontal-carousel-slide img").each(function(){$(this).parent().parent().css("backgroundImage","url("+$(this).attr("src")+")");$(this).remove()})}});
