function resizeFirst(){windowHeight=$(window).height();headerHeight=$("#header").outerHeight();leftover=windowHeight-headerHeight;$(".opening").css("height",leftover)}function vertCenter(){shareHeight=$(".share-buttons").height();$(".share-buttons").css("margin-top",shareHeight/2*-1);tocHeight=$(".toc").height();$(".toc").css("margin-top",tocHeight/2*-1)}$(window).scroll(function(){windowTop=$(window).scrollTop();windowTall=$(window).height();$("section").each(function(){articleTop=$(this).offset().top-$(window).scrollTop();if(articleTop<=windowTall/2){$(this).prev().removeClass("active");$(this).next().removeClass("active");$(this).addClass("active");$(this).addClass("toc-active");$(this).siblings().removeClass("toc-active");whichSlide=$("section.active").attr("id");$("#seed").attr("class",whichSlide)}articleOffset=$(this).offset().top;articlePercentage=articleTop/articleOffset});$("section:last:not(.active)")&&$(".next").html('<span class="icon-arrow-down"></span>');$("section:last").hasClass("active")&&$(".next").html('<span class="icon-arrow-up"></span>');slides=$("section.slide").toArray();tocs=$(".toc_item").toArray();for(var e=0;e<slides.length;e++)$(slides[e]).hasClass("toc-active")?$(tocs[e]).addClass("active"):$(tocs[e]).removeClass("active")});$(document).ready(function(e){resizeFirst();e(".button").click(function(){buttonName=e(this).attr("name");e("[name='"+buttonName+"-target']").slideDown()});e(".close").click(function(){e(this).parent().slideUp()});number_of_slides=e("section.slide").length;for(var t=0;t<number_of_slides-1;t++)e("<div class='toc_item' name='slide_"+(t+2)+"'></div>").appendTo(e(".toc"));e(".toc_item").click(function(){slideTarget=e(this).attr("name");e("html, body").animate({scrollTop:e("#"+slideTarget).offset().top},600,function(){})});vertCenter();Modernizr.cssanimations||e(".active #dude").animate({marginLeft:"273px"},500,function(){});e(".pop-facebook").on("click",function(){var t=e(this).attr("href"),n=window.open(t,"name","left=101,top=169,height=390,width=643,scrollbars=no");return!1});e(".pop-twitter").click(function(){var t=e(this).attr("href"),n=window.open(t,"name","left=101,top=169,height=800,width=728,scrollbars=no");return!1});e(".next").click(function(){e("section:last").hasClass("active")?$target=e("a[name='top']"):$target=e("section.active").next("section");e("html, body").animate({scrollTop:$target.offset().top},600,function(){})})});$(window).resize(function(){resizeFirst()});$(document).keydown(function(e){if(e.keyCode==39){$("section:last").hasClass("active")?$target=$("a[name='top']"):$target=$("section.active").next("section");$("html, body").animate({scrollTop:$target.offset().top},600,function(){});return!1}});$(document).keydown(function(e){if(e.keyCode==37){$("section.active").is("#slide_2")?$target=$("#header"):$target=$("section.active").prev("section");$("html, body").animate({scrollTop:$target.offset().top},600,function(){});return!1}});