Modernizr.load();try{Typekit.load()}catch(e){}$(function(){if($("#gallery").length){$("article").height($("aside").height()+10);var a=$("#gallery img").length;$("#gallery img").each(function(d,c){var f=new Image;$(f).bind("load error",function(){if(--a==0){$(".loading").remove();$("#gallery").show();b()}});f.src=c.src});function b(){var c=0;$("#gallery img").each(function(f,g){c+=$(g).width()});$("#gallery").css("width",c+1);$active=$("#gallery .active");$prev=$("#gallery .prev");$next=$("#gallery .next");reposition($active);var d=(435-$active.width()/2);$("#gallery").css("margin-left",d);$("#gallery").hover(function(){if(!$("#gallery img:first").hasClass("active")){$prev.fadeIn("fast",function(){$(this).css("display","block")})}if(!$("#gallery img:last").hasClass("active")){$next.fadeIn("fast",function(){$(this).css("display","block")})}},function(){$prev.fadeOut();$next.fadeOut()});$prev.click(function(){$active=$("#gallery .active");$active.animate({opacity:0.1},"fast",function(){$(this).removeClass("active");$active.prev().animate({opacity:1},"fast",function(){$(this).addClass("active");reposition($(this));if(!$("#gallery img:first").hasClass("active")){$prev.show()}if(!$("#gallery img:last").hasClass("active")){$next.show()}var g=0;for(var f=0;f<$(this).index();f++){g+=$("#gallery img").eq(f).width()}var h=-g+(435-$(this).width()/2);$("#gallery").animate({"margin-left":h+"px"})})});return false});$next.click(function(){$active=$("#gallery .active");$active.animate({opacity:0.5},"fast",function(){$(this).removeClass("active");$active.next().animate({opacity:1},"fast",function(){$(this).addClass("active");reposition($(this));if(!$("#gallery img:first").hasClass("active")){$prev.show()}if(!$("#gallery img:last").hasClass("active")){$next.show()}var g=0;for(var f=0;f<$(this).index();f++){g+=$("#gallery img").eq(f).width()}var h=-g+(435-$(this).width()/2);$("#gallery").animate({"margin-left":h+"px"})})});return false})}}});var reposition=function(c){var a=c.position();var b=c.width();$prev=$("#gallery .prev");$prev.css({left:(a.left?a.left:0)+"px"});$prev.hide();$next=$("#gallery .next");$next.css({left:((a.left?a.left:0)+b-$next.width())+"px"});$next.hide()};
