$(function(){$("body").addClass("has-js").removeClass("no-js");$(".slideshow noscript").remove();$(".slideshow img").lazy_images().removeClass("hide");$(".slideshow").slideshow({beforeInit:function(){},init:function(C){$("#breadcrumb").remove();$(this).find(".description").hide();var A=C.items,D=[];for(var B=0;B<A.length;B++){D.push('<li title="Jump to #'+(B+1)+'">'+B+"</li>");}C.item_index=$('<ol class="slideshow-index"></ol>').appendTo($(".footer-inner"));C.item_index_items=$(D.join("")).appendTo(C.item_index);C.item_index_items.eq(0).addClass("active");C.item_index.bind("click",function(F){var E=$(F.target);if(!E.is("li")){return ;}C.__change_image__(parseInt(E.text(),10));});C.wrapper.append('<span class="controls"><a class="next">Next</a><a class="previous">Previous</a></span>');C.__change_image__(0);},beforeChange:function(A,C,B){A.items.slice(B-1,B+2).find("img").trigger("lazy_images.show");A.item_index_items.eq(C).removeClass("active");A.item_index_items.eq(B).addClass("active");},change:function(A,C,B){A.items.eq(B).find(".description").slideDown(function(){A.items.eq(C).find(".description").hide();}).end().find("img").trigger("lazy_images.show");}});$("#primary").Tabs({index:".slideshow .heading",content:".slideshow-wrapper",show:function(C){var B=$(C).parents(".slideshow-inner").css("padding","15px").parent(".slideshow").data("slideshow");$(C).fadeIn();B.item_index.show();var A=B.items,D=A.eq(0).find("img").trigger("lazy_images.show").end().find(".description").slideDown();},hide:function(A){$(A).hide().parents(".slideshow-inner").css("padding",0).parent(".slideshow").data("slideshow").item_index.hide();},load:function(B){var A=$(B.index,this),C=15;A.each(function(F,E){var D=$(this).outerWidth()+15;$(this).width(D).css("left",C+"px");C+=D+20;});}});});jQuery.fn.slideshow=function(B){var A=$.extend({container:"ol.album",items:"li.project",class_names:{container:"slideshow-container",item:"slideshow-item",wrapper:"slideshow-wrapper"},controls:{next:".controls .next",previous:".controls .previous"},scrollOptions:{duration:500},beforeInit:function(C){},init:function(C){},beforeChange:function(C,E,D){},change:function(C,E,D){}},B||{});return this.each(function(){var E=$(this),D={};for(var F in A){$.isFunction(A[F])&&(D[F]=A[F]);}D.__change_image__=function(G){var I=this,M=$.extend({},this.scrollOptions),H=true,L=this.current_item;I.beforeChange&&(H=I.beforeChange.apply(E,[I,L,G]));if(H===false){return ;}var J=$(I.controls.next,E).removeClass("inactive"),K=$(I.controls.previous,E).removeClass("inactive");G===0&&K.addClass("inactive");G===this.items.length-1&&J.addClass("inactive");this.change&&(M.onAfter=function(){return I.change.apply(E,[I,L,G]);});I.wrapper.scrollTo(this.items.eq(G),M);this.current_item=G;};D.beforeInit&&D.beforeInit.apply(E,[A]);D.current_item=-1;D.scrollOptions=A.scrollOptions;D.items=E.find(A.items).addClass(A.class_names.item);D.container=E.find(A.container);D.container.addClass(A.class_names.container);D.wrapper=$('<div class="'+A.class_names.wrapper+'"></div>').insertBefore(D.container);D.container.css("width",D.items.length*D.container.outerWidth()+(D.items.length*15)).appendTo(D.wrapper);var C=D.controls={next:A.controls.next,previous:A.controls.previous};$(C.next,E).live("click",function(J){var G=E.data("slideshow"),I=G.current_item,H=G.current_item+1;if(H==G.items.length){H=0;}G.__change_image__(H);return false;}).live("mousedown",function(){$(this).addClass("focus");}).live("mouseup",function(){$(this).removeClass("focus");});$(C.previous,E).live("click",function(J){var G=E.data("slideshow"),I=G.current_item,H=G.current_item-1;if(H===-1){H=G.items.length-1;}G.__change_image__(H);return false;}).live("mousedown",function(){$(this).addClass("focus");}).live("mouseup",function(){$(this).removeClass("focus");});E.mousewheel(function(I,L){var G=-((Math.floor(L)===0)?1:Math.floor(L)),J=D.current_item,K=G+J,H=D.items.length-1;if((J==H&&L<0)||(J===0&&L>0)){return false;}if(K>=H){K=H;}if(K<0){K=0;}D.__change_image__(K);return false;});E.data("slideshow",D);D.init&&D.init.apply(E,[D]);});};jQuery.fn.lazy_images=function(F){jQuery.lazy_images=jQuery.lazy_images||{};var A=false,D=A&&typeof window.console!=="undefined"&&window.console.log;var B=$.extend({loadingClass:"loading",loadedClass:"loaded",init:function(){},load:function(){},preLoad:function(){}},F||{});var E=jQuery.lazy_images[this.selector]=jQuery.lazy_images[this.selector]||{};E.images=this;E.options=B;E.loading=[];E.loaded=[];var C=new Date().valueOf();this.each(function(){var H=$(this),I=H.attr("original")||this.src,G=H.is("img");if(!G||!I){if(A){throw new Error("jQuery.lazy_images: Selector "+H.selector+" did not return an image");}else{return ;}}H.removeAttr("src");B&&$.isFunction(B.init)&&B.init.apply(this);H.bind("lazy_images.show",function(){var M=$(this),K=this.lazy_load_options,J=this.lazy_load_status;if(J===1){D&&D("Already loaded",this);return ;}var L=$.inArray(this,E.loading);if(L!==-1){D&&D("Waiting to load",this);return ;}E.loading.push(this);K&&$.isFunction(K.preLoad)&&K.preLoad.apply(M);$("<img/>").load(function(){M.attr("src",this.src)[0].lazy_load_status=1;E.loading.splice(L,1);E.loaded.push(M[0]);if(K){K.loadingClass&&M.removeClass(K.loadingClass);K.loadedClass&&M.addClass(K.loadedClass);$.isFunction(K.load)&&K.load.apply(M);}}).attr("src",this.lazy_load_src);});this.lazy_load_options=B;this.lazy_load_src=I;this.lazy_load_status=0;B&&B.loadingClass&&H.addClass(B.loadingClass);});return this;};jQuery.fn.Tabs=function(B){var A=$.extend({eventName:"click",show:function(C){C.show();},hide:function(C){C.hide();},preLoad:function(){},load:function(){},startPosition:1,delay:500},B);return this.each(function(){var L=$(this),I=A.index,H=A.eventName,D=A.preLoad,N=A.load,J=A.content,G=A.hide,M=A.show,E=A.startPosition,F=$(I,L),C=$(J,L);if(D){D.call(this,A);}var K;C.hide().addClass("tabContent");F.addClass("tabIndex");F.unbind(H+".Tabs").bind(H+".Tabs",function(U,O){var P=jQuery.inArray(O||U.target,F);if(P==-1){P=jQuery.inArray($(U.target).parents(I+":first")[0],F);}if(P==-1||K==P){return ;}if(typeof K=="undefined"){var S=C.map(function(W){return(W==P)?false:$(this);}),R=F.map(function(W){return(W==P)?false:$(this);});for(var Q=S.length-1;Q>=0;Q--){S[Q]&&G(S[Q]);}for(var Q=R.length-1;Q>=0;Q--){R[Q]&&R[Q].removeClass("active");}}else{var S=C.eq(K),R=F.eq(K);R.removeClass("active");G(S);}var V=F.eq(P),T=C.eq(P);V.addClass("active");M(T);T.show();K=P;return false;});if(E){F.trigger(H+".Tabs",F.eq(E-1)[0]);}if(N){N.call(this,A);}});};
/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * Version: 3.0.3-pre
 * 
 * Requires: 1.2.2+
 */
(function(C){var A=["DOMMouseScroll","mousewheel"];C.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var D=A.length;D;){this.addEventListener(A[--D],B,false);}}else{this.onmousewheel=B;}},teardown:function(){if(this.removeEventListener){for(var D=A.length;D;){this.removeEventListener(A[--D],B,false);}}else{this.onmousewheel=null;}}};C.fn.extend({mousewheel:function(D){return D?this.bind("mousewheel",D):this.trigger("mousewheel");},unmousewheel:function(D){return this.unbind("mousewheel",D);}});function B(F){var D=[].slice.call(arguments,1),G=0,E=true;F=C.event.fix(F||window.event);F.type="mousewheel";if(F.wheelDelta){G=F.wheelDelta/120;}if(F.detail){G=-F.detail/3;}D.unshift(F,G);return C.event.handle.apply(this,D);}})(jQuery);
/* jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
(function(C){var A=C.scrollTo=function(D,E,F){C(window).scrollTo(D,E,F);};A.defaults={axis:"xy",duration:parseFloat(C.fn.jquery)>=1.3?0:1};A.window=function(D){return C(window)._scrollable();};C.fn._scrollable=function(){return this.map(function(){var D=this,E=!D.nodeName||C.inArray(D.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!E){return D;}var F=(D.contentWindow||D).document||D.ownerDocument||D;return C.browser.safari||F.compatMode=="BackCompat"?F.body:F.documentElement;});};C.fn.scrollTo=function(F,E,D){if(typeof E=="object"){D=E;E=0;}if(typeof D=="function"){D={onAfter:D};}if(F=="max"){F=9000000000;}D=C.extend({},A.defaults,D);E=E||D.speed||D.duration;D.queue=D.queue&&D.axis.length>1;if(D.queue){E/=2;}D.offset=B(D.offset);D.over=B(D.over);return this._scrollable().each(function(){var M=this,K=C(M),L=F,I,J={},G=K.is("html,body");switch(typeof L){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(L)){L=B(L);break;}L=C(L,this);case"object":if(L.is||L.style){I=(L=C(L)).offset();}}C.each(D.axis.split(""),function(P,Q){var S=Q=="x"?"Left":"Top",R=S.toLowerCase(),U="scroll"+S,O=M[U],N=A.max(M,Q);if(I){J[U]=I[R]+(G?0:O-K.offset()[R]);if(D.margin){J[U]-=parseInt(L.css("margin"+S))||0;J[U]-=parseInt(L.css("border"+S+"Width"))||0;}J[U]+=D.offset[R]||0;if(D.over[R]){J[U]+=L[Q=="x"?"width":"height"]()*D.over[R];}}else{var T=L[R];J[U]=T.slice&&T.slice(-1)=="%"?parseFloat(T)/100*N:T;}if(/^\d+$/.test(J[U])){J[U]=J[U]<=0?0:Math.min(J[U],N);}if(!P&&D.queue){if(O!=J[U]){H(D.onAfterFirst);}delete J[U];}});H(D.onAfter);function H(N){K.animate(J,E,D.easing,N&&function(){N.call(this,F,D);});}}).end();};A.max=function(F,G){var I=G=="x"?"Width":"Height",H="scroll"+I;if(!C(F).is("html,body")){return F[H]-C(F)[I.toLowerCase()]();}var J="client"+I,E=F.ownerDocument.documentElement,D=F.ownerDocument.body;return Math.max(E[H],D[H])-Math.min(E[J],D[J]);};function B(D){return typeof D=="object"?D:{top:D,left:D};}})(jQuery);
