function UpdateTocDimensions(){if($("header.scroll")!=null){var n=($("footer").offset().top-$(document).scrollTop()-$(window).height())*-1;$(document).scrollTop()>0?(n=n+200,$(".toc").stop().animate({top:"200px",maxHeight:String($(window).height()-n)+"px"},scrollSpeed)):(n=n+300,$(".toc").stop().animate({top:"300px",maxHeight:String($(window).height()-n)+"px"},scrollSpeed))}}function showModal(n,t){var i=angular.element(document.getElementById(n)).scope();i.showModal(t);i.$apply()}function getICD9CodesFromTable(){var n=[];return $.ajax({type:"GET",url:"/content/GetMedicalCodes/"+window.location.pathname.replace("/content/","")+"/icd9cm",dataType:"json",async:!1,success:function(t){$.each(t,function(i){n.push({code:t[i].Code,description:t[i].Code+" | "+t[i].Descriptions[0].LongDescription})})}}),n}function AddExpanders(n){n.find("li").each(function(n,t){$(this).find(">label").addClass("expander").css({"grid-area":"header"});$("<div class='expander' style='grid-area:plus'><span class='glyphicon glyphicon-plus'><\/span><\/div>").prependTo($(this));t.style="display:grid; grid-template-columns:30px 1fr; grid-template-areas:'plus header' 'content content'";$(this).find("div.duration-content").css({"grid-area":"content"})})}function CollapseAllExpandableDivs(n){var t=n.find(".expandable"),i=n.find(".expander span"),r=n.find("label");t.slideUp();i.removeClass("glyphicon-minus").addClass("glyphicon-plus")}function inRange(n,t,i){return(n-t)*(n-i)<=0}var trackEvent,easingMethod,scrollSpeed,hideOverlay,expandSection,topVisible;$("*[ga-event]").click(function(){trackEvent($(this).attr("ga-event"))});trackEvent=function(n){ga("send",{hitType:"event",eventCategory:"Page Interaction",eventAction:n})};easingMethod="easeInOutBack";$(function(){$("#login-box a").click(function(){$("#login-slide").is(":hidden")?$("#login-slide").slideDown(400,easingMethod):$("#login-slide").slideUp(400,easingMethod)})});$("header.scroll")!=null&&$("header.scroll").data("size","big");scrollSpeed=300;$(".toc")!=null&&$(".toc").css({top:"300px"});$(".content nav")!=null&&$(".content nav").css({top:"230px"});$(window).scroll(function(){$("header.scroll")!=null&&($(document).scrollTop()>0?$("header.scroll").data("size")==="big"&&($("header.scroll").data("size","small"),$("header.scroll").stop().animate({height:"80px",fontSize:"70%"},scrollSpeed),$(".content nav").stop().animate({top:"130px"},scrollSpeed),$("header.scroll").find("h1").stop().animate({opacity:0},scrollSpeed),$("header.scroll").find("h2").stop().animate({top:"-10"},scrollSpeed),$("header.scroll").find(".tags").stop().animate({opacity:0},200),$(".overlay").stop().animate({top:"200px"},scrollSpeed),$(".pinned").stop().animate({top:"200px"},scrollSpeed)):$("header.scroll").data("size")==="small"&&($("header.scroll").data("size","big"),$("header.scroll").stop().animate({height:"180px",fontSize:"100%"},scrollSpeed),$("header.scroll").find("h1").stop().animate({opacity:1},scrollSpeed),$(".content nav").stop().animate({top:"230px"},scrollSpeed),$("header.scroll").find("h2").stop().animate({top:"25px"},scrollSpeed),$("header.scroll").find(".search-title").find("h2").stop().animate({top:"30px"},scrollSpeed),$("header.scroll").find(".tags").stop().animate({opacity:1},scrollSpeed),$(".overlay").stop().animate({top:"300px"},scrollSpeed),$(".pinned").stop().animate({top:"300px"},scrollSpeed)),UpdateTocDimensions())});$(window).resize(function(){UpdateTocDimensions()});$(document).ready(function(){UpdateTocDimensions()});var headerHeight=function(){return $("header").scrollTop()!=null?$("header").scrollTop()+$("header").height():0},contentAreaHeight=function(){return $(window).height()-headerHeight()-40},resizeOverlay=function(){$(".overlay")!=null&&$(".overlay").height(contentAreaHeight())},resizeTable=function(){$("#medical-code-overlay .table tbody")!=null&&$("#medical-code-overlay .table tbody").height(contentAreaHeight()-180)},handleResizing=function(){resizeOverlay();resizeTable()};$(window).resize(function(){handleResizing()});$(window).scroll(function(){handleResizing()});$(function(){handleResizing()});hideOverlay=function(){$(".overlay").is(":visible")&&($("html").css("overflow","visible"),$(".overlay-link").removeClass("active"),$(".overlay").slideUp())};$(function(){$(".overlay-close-button").click(function(){hideOverlay()});$("a.modal-link").on("click",function(){var n=$(this),t=n.attr("data-overlay-name"),r=document.getElementById(t),i;n.attr("overlay-variables")&&(i=JSON.parse(n.attr("overlay-variables")));showModal(t,i)});$("#topicMedicalCodes").on("click",".predictive-model-quicklink",function(){var i=$(this).parent().parent().find("td.code").html(),u=$(this).parent().parent().find("td.description").html(),r=$(this).parent().parent().parent().parent().find("th.code-type").find("h2").html(),n,t;trackEvent("Launch Predictive Model");n=angular.element(document.getElementById("predictiveModelOverlay")).scope();n.modalVisible=!0;n.populateCode(i,u,r);n.$apply();t=[];t.push({DetailKey:"Code",DetailValue:i});t.push({DetailKey:"CodeType",DetailValue:r});$.ajax({type:"POST",url:"/Log/LogUsageEvent",data:{eventType:"PredictiveModelOpen",eventDetails:t},dataType:"json"})});$("#search-results").on("click","a.predictive-model-quicklink",function(){var t=$(this).parent().parent().find("td:first").html(),i=$(this).parent().parent().find("td:first").next("td").find("a").text(),r=$(this).parent().parent().parent().parent().parent().parent().find("h2").html(),n;trackEvent("Launch Predictive Model");n=angular.element(document.getElementById("predictiveModelOverlay")).scope();n.modalVisible=!0;n.populateCode(t,i,r);n.$apply()});$("#predictive-model-topic-link").on("click",function(){var n=angular.element(document.getElementById("predictiveModelOverlay")).scope();n.modalVisible=!0;n.populateFilterCodes(getICD9CodesFromTable());n.$apply()})});expandSection=function(n){var t=$(n).parent().find(".expandable"),i=$(n).parent().find(".expander span"),r=$(n).parent().find("label");t.is(":hidden")?t.slideDown():t.slideUp();i.toggleClass("glyphicon-plus glyphicon-minus")};$(document).on("click",".expander",function(){expandSection(this)});topVisible=!1;$(window).scroll(function(){$(document).scrollTop()>200?$("#to-top").stop().animate({opacity:1},300):$("#to-top").stop().animate({opacity:0},300)});$("#to-top").click(function(){$(document).scrollTo(0,{duration:600,axis:"y"})})