function footergravity(){$("#main").css("min-height",$(window).height()-$("footer").outerHeight()-parseInt($("#main").css("margin-top")))}function activateFooterGravity(){footergravity();$(window).resize(footergravity)}function activateTooltips(){$("*[rel=tooltip]").tooltip()}function redirectToIndexPath(){if(window.location.pathname.search(/\/index.html$/)!=-1){window.location.href=window.location.href.replace("index.html","")}}function activateSlideshow(){var start=window.location.hash?window.location.hash.replace("#",""):1;if(start>1){var items=$("#slideshow .item");$(items[start-1]).addClass("active");$(items[0]).removeClass("active")}$("#slideshow").carousel({pause:""}).on("slid",function(e){var $active=$("#slideshow").find(".active");var pos=$active.parent().children().index($active);window.location.hash="#"+(pos+1)}).carousel("pause")}function toggleGuideMenu(e){$menu=$("#guides");if($menu.css("display")=="none"){$menu.css("display","block");$("body").on("click",toggleGuideMenu);return false}else{$menu.css("display","none");$("body").unbind("click");return $(e.target).closest("#guides dd").length>0?true:false}}function activateGuideMenuControl(){$("#guides_menu, .guides_menu").on("click",toggleGuideMenu)}function activateScrollingToc(sections){var $toc=$("#toc");$toc.localScroll({hash:true});var currentSection=false;var sectionOffsets={};$.each(sections,function(idx,section){sectionOffsets[section]=$("#"+section).position().top});var tocMetrics={top:$toc.position().top,height:$toc.outerHeight()};var bottomBumper=$("#guide").outerHeight()+$("#guide").offset().top-25;var $firstLink=$("#toc a").first();var linkColor=$firstLink.css("color");var linkTextDecoration=$firstLink.css("text-decoration");var selectedColor=$firstLink.parent().css("color");var selectedTextDecoration=(linkTextDecoration=="underline"?"none":"underline");var updateToc=function(){var scrollY=$(window).scrollTop();positionToc(scrollY);highlightSectionInToc(scrollY)};var positionToc=function(scrollY){if(scrollY>tocMetrics.top){if($toc.css("position")!="fixed"){$toc.css("width",$toc.width()+"px");$toc.css("position","fixed")}var remainingHeight=bottomBumper-scrollY;if(remainingHeight<tocMetrics.height){$toc.css("top",0-(tocMetrics.height-remainingHeight))}else{$toc.css("top",5)}}else{if($toc.css("position")!="static"){$toc.css({position:"static",top:0})}}};var highlightSectionInToc=function(scrollY){var numSections=sections.length;if(numSections==0){return}if(scrollY<sectionOffsets[sections[0]]){toggleSelection(false)}else{if(scrollY+$(window).height()==$(document).height()){toggleSelection(sections[numSections-1])}else{$.each(sections,function(idx,section){if(scrollY>sectionOffsets[section]&&(idx==numSections-1||scrollY<sectionOffsets[sections[idx+1]])){toggleSelection(section)}})}}};var toggleSelection=function(section){if(!section||section!=currentSection){if(currentSection){$("#"+currentSection+"_link").css({textDecoration:linkTextDecoration,color:linkColor})}currentSection=section;if(section){$("#"+section+"_link").css({textDecoration:selectedTextDecoration,color:selectedColor})}}};updateToc();$(window).scroll(updateToc)}function activateToTopControl(){$toTop=$("#toTop");if($toTop.css("display")=="none"){return}$("#banner").click(function(e){if($(e.target).closest("a").length==0){$("html, body").animate({scrollTop:0});return false}});if(window.location.pathname.search(/^\/(guides\/[^\/]+)(\/|$)/)<0){return}var tuckedAway=true;var bannerFixed=$("#banner").css("position")=="fixed";var showOffset=(bannerFixed?$("#banner").height()+20:20)+"px";var hideOffset="-50px";var triggerOffset=250;$(window).bind("scroll",function(){if($(this).scrollTop()>=triggerOffset){if(tuckedAway){$toTop.animate({top:showOffset})}tuckedAway=false}else{if(!tuckedAway){$toTop.animate({top:hideOffset})}tuckedAway=true}});$("#toTop").on("click",function(){$("html, body").animate({scrollTop:0},"slow");return false})};