/*
 * jQuery UI Effects 1.8.9
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor",
"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,
d){if(f.isFunction(b)){d=b;b=null}return this.queue("fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l=h.splice(h.length-1,1)[0];
h.splice(1,0,l);f.dequeue(this)})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,
a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.9",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,
a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",
border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);
return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments);
else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),
b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,
a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,
a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==
e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=
g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/
h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,
a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
;(function(a){a.backstretch=function(b,n,m){var f={centeredX:true,centeredY:true,speed:0,rightPadding:0,bottomPadding:0},c=("onorientationchange" in window)?a(document):a(window),e,d,i,h,l,k;if(n&&typeof n=="object"){a.extend(f,n)}a(document).ready(j);return this;function j(){if(b){var o=a("<div />").attr("id","backstretch").addClass("faded").css({left:0,top:0,position:"fixed",visibility:"hidden",overflow:"hidden",zIndex:-9990}),p=a("<img />").css({position:"relative",display:"block"}).bind("load",function(r){var q=a(this);e=a(r.target).width()/a(r.target).height();g(function(){o.css({display:"none",visibility:"visible"});a("body").trigger("backstretch_loaded");o.removeClass("faded")})}).appendTo(o);if(a("body#home").length){a("h4#subtitle").after(o)}if(a("body#projects").length){a("body").prepend(o)}p.attr("src",b);a(window).resize(g)}}function g(o){if(a("body#home").length){if(a(window).width()/a(window).height()>=1){f.rightPadding=0.2;f.bottomPadding=0}else{f.bottomPadding=0.3;f.rightPadding=0}}try{k={left:0,top:0};i=c.width()-(c.width()*f.rightPadding);h=i/e;if(h>=c.height()){l=(h-c.height())/2;if(f.centeredY){a.extend(k,{top:"-"+l+"px"})}}else{h=c.height()-(c.height()*f.bottomPadding);i=h*e;l=(i-c.width())/2;if(f.centeredX){a.extend(k,{left:"-"+l+"px"})}}a("#backstretch img").width(i).height(h).css(k)}catch(p){}if(typeof o=="function"){o()}}updateSettings=function(o){if(o&&typeof o=="object"){a.extend(f,o)}console.log(f);alert("whoa!")}}})(jQuery);var is_ajax_busy=false;$(function(){if($("div.image-box").length){show_hide_manage_image_move_links();$("a.move-left-link").bind("click",move_left);$("a.move-right-link").bind("click",move_right)}if($("textarea.count-characters, input.count-characters").length){setup_count_form_characters()}if($("div.help-box").length){setup_help_boxes()}var a=$("#update-message");if(a.length){a.delay(3000).fadeOut(1000,function(){$(this).remove()})}if($("select#news-type").length){$("select#news-type").change(function(){var b=$(this).val();var c=b.charAt(0).toUpperCase()+b.slice(1);$('input[type="submit"]').attr("value","Add "+c+" Item")})}});function move_left(b){var c=$("div.image-holder");var a=$(this).closest("div.image-holder");var d=c.index(a);a.insertBefore(c.eq(d-1));update_order_ajax();show_hide_manage_image_move_links();return false}function move_right(b){var c=$("div.image-holder");var a=$(this).closest("div.image-holder");var d=c.index(a);a.insertAfter(c.eq(d+1));update_order_ajax();show_hide_manage_image_move_links();return false}function update_order_ajax(){if(is_ajax_busy){return false}is_ajax_busy=true;var b=new Array();var a=$("div.image-holder");a.each(function(c){var e=$(this).attr("data-image-number");var d=a.index(this);b[c]=e});$.post("http://localhost:8888/andersson_wise-production/admin/projects/update_image_order/",{image_order:b},function(c){}).success(function(){}).complete(function(){is_ajax_busy=false})}function show_hide_manage_image_move_links(){var a=$("div.image-box div.image-holder");a.each(function(){var b=a.index(this);if(b==0){$(this).find("a.move-left-link").hide()}else{$(this).find("a.move-left-link").show()}if(b==a.length-1){$(this).find("a.move-right-link").hide()}else{$(this).find("a.move-right-link").show()}})}function setup_count_form_characters(){$("textarea.count-characters, input.count-characters").each(function(){$(this).after('<p class="character-count"><span>0</span> characters remaining</p>');$(this).bind("keyup",update_character_count);$(this).trigger("keyup")})}function update_character_count(e){var c=$(this).attr("data-character-limit");var f=$(this).val().length;var d=c-f;var b=$(this).next("p.character-count");var a=b.find("span");a.html(d);if(d<0){b.addClass("too-many-characters")}else{b.removeClass("too-many-characters")}}function setup_help_boxes(){var a=$("div.help-box");a.each(function(){$(this).prepend('<a class="open-helpbox-link" href="" title="Help">Get Help</a>')});$("a.open-helpbox-link").live("click",open_help_window);a.addClass("collapsed")}function open_help_window(b){var d='<link rel="stylesheet" href="'+$("head link").attr("href")+'">';var c=$(this).parent().html();var e=d+'<div class="help-box expanded">'+c+"</div>";var a=window.open("","","width=600,height=500,resizeable,scrollbars");a.document.write(e);a.document.close();return false};var current_category="all";var current_project=null;var current_image=0;var mousemove_timer_id=0;var is_mousemove_fade_active=false;var touch_support=false;$(function(){if(Modernizr.touch){touch_support=true}$("a.email-encoded").each(function(){var f=$(this).attr("href");var d=rot13x(f);var e=rot13x($(this).html());$(this).attr("href",d);$(this).html(e)});if($("body#home").length){update_image_size();var b=$("a#splash").attr("data-featured-image");$("body").bind("backstretch_loaded",function(){$("div#backstretch").fadeIn(600)});$.backstretch(b)}if($("body#projects").length){load_thumbnails();create_subnav("View by Category");start()}if($("body#studio").length&&$("div.principal-info").length){$("p.bio-extended").hide();var a=$("div.principal-info").each(function(){$(this).append('<a class="show-hide-extended" href="">Read More</a>')});$("a.show-hide-extended").bind("click",c)}function c(d){var e=$(this).parent("div.principal-info");if(e.find("p.bio-extended:hidden").length){e.find("p.bio-extended").fadeIn(300,"easeOutQuad");$(this).html("Collapse")}else{e.find("p.bio-extended").hide();$(this).html("Read More")}return false}});function start(){if($("div#project-holder").length){set_current_project();reveal_project()}else{show_project_selection()}}function create_subnav(a){var b='<ul id="subnav"><h4>'+a+'</h4><li><a href="" data-category="all" id="active-category">All Categories</a></li>';var c=$("div#thumbs-holder h3").each(function(){var d=$(this).html();b+='<li><a href="" data-category="'+d.toLowerCase()+'">'+d+"</a></li>"});b+="</ul>";$("body").append(b);$("ul#subnav a").bind("click",change_categories)}function load_thumbnails(){var a=$("div#thumbs-holder a");a.each(function(){var e=$(this).closest("div.project-thumb");e.addClass("loading-thumb");var b=new Image();var d=$(this).attr("data-thumb");var c=$(this);$(b).load(function(){$(this).prependTo(e).fadeIn(500,"easeOutQuad");e.removeClass("loading-thumb");c.attr("data-thumbloaded","true")}).error(function(){}).attr("src",d)})}function change_categories(){var b=($(this).attr("data-category"));$("a#active-category").attr("id","");$(this).attr("id","active-category");var a;if(b=="all"){a=$("div#thumbs-holder div.project-thumb")}else{a=$('div#thumbs-holder a[data-category="'+b+'"]').closest("div.project-thumb");secondary_thumbs_to_fade_in=$('div#thumbs-holder a[data-secondary-category="'+b+'"]').closest("div.project-thumb")}fade_out_thumbs_sequentially($("div#thumbs-holder div.project-thumb:visible"),250,20,a.add(secondary_thumbs_to_fade_in));return false}function fade_out_thumbs_sequentially(d,b,c,a){d.each(function(e){$(this).delay(e*c).fadeTo(b,0,function(){if(e==d.length-1){d.hide();fade_in_thumbs_sequentially(a,c)}})})}function fade_in_thumbs_sequentially(b,a){b.each(function(c){$(this).fadeTo(0,0).show().delay(c*a).fadeTo(500,1)})}function load_project(a){var b={ajax:"1"};$.ajax({url:a,type:"POST",data:b,success:function(c){$("div#container").prepend(c);hide_project_selection()}});return false}function hide_project_selection(){$("div#thumbs-holder").fadeOut(400,"easeOutQuad",reveal_project);$("ul#subnav").fadeOut(400,"easeOutQuad")}function show_project_selection(){if($("div#project-holder").length!=0){$("div#backstretch").fadeOut(500);$("div#project-holder").fadeOut(500,"easeOutQuad");$("body").fadeTo(600,1,function(){delete_project();a()})}else{a()}function a(){$("div#thumbs-holder").fadeIn(400,"easeOutQuad");$("ul#subnav").fadeIn(400,"easeOutQuad")}}function reveal_project(){var a='<div id="project-description-controls"><a href="" id="description-lock">Lock Description Open</a><a href="" id="description-previous">Previous Image</a><a href="" id="description-next">Next Image</a></div>';$("div#project-description").prepend(a);$("div#share-controls").prepend('<a id="share-expand" href="">Share&nbsp;Project</a>');$("div#project-controls").append('<div id="image-controls"><p id="image-number"><span id="number">1</span><span id="number-slash">/</span><span id="out-of">1</span></p><a href="" id="main-previous">Previous Image</a><a href="" id="main-next">Next Image</a></div>');
$("span#out-of").html($("div#project-holder div#images-holder a").length);if(!touch_support){$("div#project-controls a#share-expand").bind("click",show_share_options);$("div#project-controls a#selection-link").bind("click",function(){show_project_selection();return false});$("a#description-previous, a#main-previous").bind("click",previous_image);$("a#description-next, a#main-next").bind("click",next_image);$("div#backstretch").live("click",project_image_click);$("div#backstretch").live("mousemove",on_mouse_move_backstretch)}else{document.getElementById("share-expand").ontouchstart=function(b){b.preventDefault();show_share_options()};document.getElementById("selection-link").ontouchstart=function(b){b.preventDefault();show_project_selection()};document.getElementById("description-previous").ontouchstart=function(b){b.preventDefault();previous_image()};document.getElementById("main-previous").ontouchstart=function(b){b.preventDefault();previous_image()};document.getElementById("description-next").ontouchstart=function(b){b.preventDefault();next_image()};document.getElementById("main-next").ontouchstart=function(b){b.preventDefault();next_image()};document.getElementById("project-title").ontouchstart=function(b){b.preventDefault();$("div#project-description").addClass("revealed")};document.getElementById("project-description").ontouchstart=function(b){if(b.target==document.getElementById("description-previous")||b.target==document.getElementById("description-next")){return false}$("div#project-description").removeClass("revealed")}}load_project_images($("div#images-holder a"))}function delete_project(){unbind_project();$("div#cursor").remove();$("div#project-holder").remove();$("div#backstretch").remove();$("div#hidden-images").remove();$("p#preloader").remove();update_fade_timer();clearTimeout(mousemove_timer_id)}function show_share_options(){if($("div#share-inner:visible").length!=1){$("div#share-inner").fadeIn(500,"easeOutQuad")}else{$("div#share-inner:visible").fadeOut(200,"easeOutQuad")}return false}function on_mouse_move_backstretch(d){var b;var g;if(d.pageX&&d.pageY){update_fade_timer();b=d.pageX;g=d.pageY;jQuery.data(document.body,"pX",b);jQuery.data(document.body,"pY",g)}else{b=jQuery.data(document.body,"pX");g=jQuery.data(document.body,"pY")}var c=$(window).width();var a=$(window).height();e(null);if(b<500){if(g>(a-250)){$("div#project-description").addClass("revealed");e(true)}else{f()}}else{if(b>(c-190)){if(g>(a-200)){$("div#project-controls").addClass("revealed");e(true)}else{f()}}else{f()}}function f(){$("div#share-inner").fadeOut(200,"easeOutQuad");$("div#project-description").removeClass("revealed");$("div#project-controls").removeClass("revealed")}function e(h){if(h){$("div.cursor.left").addClass("hide");$("div.cursor.right").addClass("hide")}if(b<c/2&&!h){$("div.cursor.right").addClass("hide");$("div.cursor.left").removeClass("hide").css({top:(a/2)+"px"})}else{if(b>c/2&&!h){$("div.cursor.left").addClass("hide");$("div.cursor.right").removeClass("hide").css({top:(a/2)+"px",left:c-95+"px"})}}}}function update_fade_timer(){if(touch_support){return false}clearTimeout(mousemove_timer_id);if(is_mousemove_fade_active){mousemove_timer_fade_in()}mousemove_timer_id=setTimeout("mousemove_timer_fade_out()",3000)}function mousemove_timer_fade_out(){if($(window).width()<600){return false}is_mousemove_fade_active=true;var a=$("div#nav-container, h2#project-title, h4#subtitle");a.each(function(){$(this).fadeTo(1000,0)})}function mousemove_timer_fade_in(){is_mousemove_fade_active=false;var a=$("div#nav-container, h2#project-title, h4#subtitle");a.each(function(){$(this).stop().fadeTo(300,1)})}function unbind_project(){$("div#project-controls a#share-expand").unbind("click",show_share_options);$("div#project-controls a#selection-link").unbind("click",function(){$.address.value("");return false});$("a#description-previous, a#main-previous").unbind("click",previous_image);$("a#description-next, a#main-next").unbind("click",next_image);
$("div#backstretch").die()}function load_project_images(e){var a=e;var g=a.length;var d=0;update_image_size();current_image=0;$("div#project-description").before('<div id="hidden-images"></div>');b();f(a.eq(0));function f(j){var h=j.attr("href");var i=new Image();$(i).attr("src",h);$(i).one("load",c).each(function(){if(this.complete){$(this).load()}})}function c(){var i=0;var h=$(this);h.attr("data-number",d);h.addClass("project-image");h.hide();$("div#hidden-images").append(h);$("body").trigger("image_loaded");if(d==i){$("p#preloader").delay(500).fadeOut(300,"easeOutQuad",function(){show_image(0);$("div#project-holder").fadeIn(400,"easeOutQuad")});update_fade_timer()}if(d<(g-1)){d++;f(a.eq(d))}else{$("p#preloader").fadeOut(600,function(){$(this).remove()})}}function b(){$("body").append('<p id="preloader"><span>Loading Images for</span><br />'+$("div#project-holder h2#project-title").html());var j=$("div#images-holder a").length;$("p#preloader").append('<div id="bar-holder"></div>');var h="";for(var k=0;k<j;k++){h=h+'<div class="preloader-bar"></div>'}$("p#preloader div").html(h);var l=0;preloader_animate()}}function preloader_animate(){var a=Math.round(($("div.preloader-bar").length-1)/2);$("p#preloader div.preloader-bar").each(function(b){$("this").attr("style","");var c=Math.abs(b-a)*400;$(this).delay(c).animate({top:"-30px",backgroundColor:"#fff"},1000,"easeOutQuad").delay(600).animate({backgroundColor:"#000"},2500,"easeOutQuad")})}function show_image(b,c){var c=typeof(c)!="undefined"?c:"next";var a=$("div#hidden-images img").eq(b);$("body").bind("backstretch_loaded",function(){if(!touch_support){$("div#backstretch").fadeIn(600)}else{document.getElementById("backstretch").ontouchstart=project_image_touch;$("div.cursor.left").removeClass("hide").css({top:($(window).height()/2)+"px"});$("div.cursor.right").removeClass("hide").css({top:($(window).height()/2)+"px",left:$(window).width()-95+"px"});var d=$(window).width();if(c=="next"){$("div#backstretch").css("-webkit-transform","translate3d("+d+"px, 0px, 0px)").addClass("css-animated").show().css("-webkit-transform","translate3d(0px, 0px, 0px)");$("div#old-backstretch").addClass("css-animated").css("opacity",0)}else{$("div#backstretch").css("opacity",0).css("z-index",-9999).show().addClass("css-animated").css("opacity",1);$("div#old-backstretch").addClass("css-animated").css("-webkit-transform","translate3d("+d+"px, 0px, 0px)")}}$("body").unbind("backstretch_loaded")});$.backstretch(a.attr("src"),{speed:500});$("div#backstretch").append('<div class="cursor left hide"></div><div class="cursor right hide"></div>');show_paragraph(b);update_prev_next_buttons(b);$("div#backstretch").trigger("mousemove")}function project_image_click(a){if(a.pageX<($(window).width()*0.5)){previous_image()}else{next_image()}}function project_image_touch(d){d.preventDefault();if(d.touches.length==1){var f=d.touches[0];var b=f.pageX;var a=f.pageY;var c=$(window).width();var e=$(window).height();if(b<500&&a>e-180){$("div#project-description").addClass("revealed");return false}if(b<c/2){previous_image()}else{next_image()}}}function next_image(){if($("div#old-backstretch").length>0){return false}if(current_image==$("div#images-holder a").length-1){if(current_project==$("div#thumbs-holder div.project-thumb").length-1){return false}document.location=$("div#thumbs-holder div.project-thumb a").eq(current_project+1).attr("href");return false}if(current_image>=$("div#hidden-images img").length-1){hold_for_image_load();return false}$("body").trigger("next_clicked");current_image+=1;$("p#image-number span#number").html(current_image+1);remove_current_image();show_image(current_image);return false}function previous_image(){if($("div#old-backstretch").length>0||current_image==0){return false}current_image-=1;$("p#image-number span#number").html(current_image+1);remove_current_image();show_image(current_image,"previous");return false}function hold_for_image_load(){$("body").append('<div id="holding">Loading</div>');$("div#holding").fadeIn(600,"easeOutExpo");
$("body").bind("image_loaded",function(){$("div#holding").fadeOut(600,"easeOutExpo",function(){$(this).remove()});next_image();$("body").unbind("image_loaded")})}function remove_current_image(){$("div#backstretch").css("z-index",-9999).attr("id","old-backstretch").unbind("click",project_image_click).animate({left:"+=0"},720,function(){$(this).remove()})}function show_paragraph(a){if($("div#project-description p").eq(a).html()==""){return false}$("div#project-description p").fadeOut(400,"easeOutQuad");$("body").fadeTo(450,1,function(){$("div#project-description p").eq(a).fadeIn(400,"easeOutQuad")})}function update_prev_next_buttons(c){if(c==0){d();b()}else{if(c==$("div#images-holder a").length-1){a();e()}else{a();d()}}function b(){var f=$("a#description-previous, a#main-previous").each(function(){$(this).fadeTo(400,0,"easeOutQuad")});$("div.cursor.left").css("display","none")}function a(){var f=$("a#description-previous, a#main-previous").each(function(){$(this).fadeTo(400,1,"easeOutQuad")});$("div.cursor.left").css("display","block")}function e(){var f=$("a#description-next, a#main-next").each(function(){$(this).fadeTo(400,0,"easeOutQuad")});$("div.cursor.right").css("display","none");if(!(current_project==$("div#thumbs-holder div.project-thumb").length-1)){$("div.cursor.right").css("display","block");$("div.cursor.right").fadeOut(300,function(){$(this).append('<p id="cursor-subhead">Next Project</p>');$(this).addClass("next-project-cursor")}).fadeIn(300)}}function d(){var f=$("a#description-next, a#main-next").each(function(){$(this).fadeTo(400,1,"easeOutQuad")});$("div.cursor.right").css("display","block");$("p#cursor-subhead").remove();$("div.cursor.right").removeClass("next-project-cursor")}}function set_current_project(){var a=$("div#project-holder").attr("data-project-id");var b=$('div#thumbs-holder div.project-thumb[data-project-id="'+a+'"]');current_project=b.index("div#thumbs-holder div.project-thumb")}function add_to_stylesheet(a){if($("style").length==0){$("head").append('<style type="text/css" media="screen"></style>')}$("style").append(a)}function update_image_size(){var c=$(window).width();var b=$(window).height();if(c<500){a("480")}else{if(c<1100&&b<700){a("1000")}else{a("1500")}}function a(d){$("div#images-holder a").each(function(){e($(this),"href")});$("a#splash").each(function(){e($(this),"data-featured-image")});function e(i,h){var g=i.attr(h);var f=g.replace(/-[0-9]*\.jpg/,"-"+d+".jpg");f=f.replace(/projects\/[0-9]*\//,"projects/"+d+"/");i.attr(h,f)}}}function rot13x(d){var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";var a="NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm5678901234";var e=[];var b="";for(z=0;z<f.length;z++){e[f.substr(z,1)]=a.substr(z,1)}for(z=0;z<d.length;z++){var g=d.charAt(z);b+=(g in e?e[g]:g)}return b};
