var CoasterBuzz,PopForums;$(function(){});CoasterBuzz={};CoasterBuzz.navTop=null;CoasterBuzz.getLoader=function(){var n=$("#Loader").clone();return n.css("visibility","visible"),n};CoasterBuzz.searchItem=function(n){var t=$("input[name=searchG]:checked").val();switch(t){case"SearchP":return"<a href='/AmusementParks/"+n.urlName+"'>"+n.label+"<br />"+n.loc+"<\/a>";case"SearchC":return"<a href='/RollerCoasters/"+n.urlName+"'>"+n.label+"<br />"+n.loc+"<\/a>";default:return""}};CoasterBuzz.searchLink=function(n){var t=$("input[name=searchG]:checked").val();switch(t){case"SearchP":return"/AmusementParks/"+n.urlName;case"SearchC":return"/RollerCoasters/"+n.urlName;default:return""}};CoasterBuzz.getSearchRadio=function(){var n=$("input[name=searchG]:checked").val();switch(n){case"SearchP":return"/CoasterBuzzHome/SearchPark";case"SearchC":return"/CoasterBuzzHome/SearchCoaster";default:return""}};CoasterBuzz.userTabs=function(){$("a[data-toggle='tab']").on("show.bs.tab",function(n){var t=$($(n.target).attr("href")),i=$(this).attr("data-tab-url"),r;i&&(r=CoasterBuzz.getLoader(),t.append(r),t.load(i,function(){t.remove(".loader")}))})};CoasterBuzz.parkTabs=function(){$("a[data-toggle='tab']").on("show.bs.tab",function(n){var t=$($(n.target).attr("href")),i=$(this).attr("data-tab-url"),r;i&&(r=CoasterBuzz.getLoader(),t.append(r),t.load(i,function(){t.remove(".loader");t[0].id=="Map"&&CoasterBuzz.loadMap()}))})};CoasterBuzz.map=null;CoasterBuzz.mapCred="ArxxoqQB9Ae5xrkJPjVpj3SeCNCMsT3CEip8iKS5hRuA-bFl4HdvMag8RPHh65Vb";CoasterBuzz.loadMap=function(){CoasterBuzz.map=new Microsoft.Maps.Map($("#MapCanvas")[0],{credentials:CoasterBuzz.mapCred});var n="http://dev.virtualearth.net/REST/v1/Locations?query="+encodeURI($("#ParkAddress").val())+"&output=json&key="+CoasterBuzz.mapCred+"&jsonp=CoasterBuzz.mapCallback&callback=?";$.getJSON(n)};CoasterBuzz.mapCallback=function(n){var t=n.resourceSets[0].resources[0].bbox,i=Microsoft.Maps.LocationRect.fromLocations(new Microsoft.Maps.Location(t[0],t[1]),new Microsoft.Maps.Location(t[2],t[3]));CoasterBuzz.map.setView({bounds:i,mapTypeId:Microsoft.Maps.MapTypeId.birdseye})};CoasterBuzz.postTRAssociations=function(){$("#AddPark").click(function(){var n=$("#ParkList option:selected").clone();$("#AssociatedList").append(n);CoasterBuzz.updateTRAssociations()});$("#RemovePark").click(function(){$("#AssociatedList option:selected").remove();CoasterBuzz.updateTRAssociations()})};CoasterBuzz.updateTRAssociations=function(){var i=$("#TopicID").val(),n=[],t;$("#AssociatedList option").each(function(){n.push($(this).val())});t={topicID:i,parkIDs:n.join(",")};$("#AssociatedParks").load("/AmusementParks/Action/SetTripReportAssociations",t)};CoasterBuzz.rateTrackRecord=function(n,t,i){var r={rating:n,coasterID:t,parkID:i};$.post("/TrackRecord/Rate",r)};CoasterBuzz.parkTrackRecord=function(){$(".trackOver").click(function(){CoasterBuzz.trackRecordToggle($(this))})};CoasterBuzz.detailTrackRecord=function(){var n=$("#TrackRecord");n.length!==0&&(n.click(function(){CoasterBuzz.trackRecordToggle($(this))}),CoasterBuzz.detailTrackRecordRating())};CoasterBuzz.detailTrackRecordRating=function(){for(var r=[],t,n=0;n<=5;n++)t=document.createElement("img"),t.src="/content/images/rate/rate"+n+".png",r.push(t);var i=$("#YourRating"),u=i.attr("data-cid"),f=i.attr("data-pid");i.load("/TrackRecord/YourRating",{coasterID:u,parkID:f},function(){$(".rate div").click(function(){var n=$(this).parent(),r=n.find("div"),i=r.index(this),t;n.removeClass();n.addClass("rate rate"+i);t=n.attr("data-id").split("-");CoasterBuzz.rateTrackRecord(i,t[0],t[1])})})};CoasterBuzz.trackRecordToggle=function(n){var t=n.attr("data-cid"),i=n.attr("data-pid"),r={coasterID:t,parkID:i};$.post("/TrackRecord/Toggle",r,function(t){t.IsIn==!0?(n.attr("src","/Content/Images/tminus.png"),CoasterBuzz.detailTrackRecordRating()):(n.attr("src","/Content/Images/tplus.png"),$("#YourRating").empty())})};CoasterBuzz.detailParkRecordRating=function(){var t=$("#YourRating"),u,n,i,r;if(t.length!==0){for(u=[],n=0;n<=5;n++)i=document.createElement("img"),i.src="/content/images/rate/rate"+n+".png",u.push(i);r=t.attr("data-pid");t.load("/ParkRecord/YourRating",{parkID:r},function(){$(".rate div").click(function(){var n=$(this).parent(),i=n.find("div"),t=i.index(this);n.removeClass();n.addClass("rate rate"+t);CoasterBuzz.rateParkRecord(t,r)})})}};CoasterBuzz.rateParkRecord=function(n,t){var i={rating:n,parkID:t};$.post("/ParkRecord/Rate",i)};$(function(){var r=$("#ForumContainer #TopBreadcrumb"),n,t,i;if(r.length>0){$(window).scroll(function(){PopForums.checkScroll()});$(window).on("resize",function(){PopForums.checkScroll()});PopForums.checkScroll()}if(window.location.hash){for(n=window.location.hash;n.charAt(0)=="#";)n=n.substr(1);if(t=$("div[data-postID='"+n+"']"),$("#PostStream").has(t).length>0&&(i=t.offset(),i)){var u=$("#ForumContainer #FixedBreadcrumb"),f=u.outerHeight(),e=parseInt($(".postItem").css("margin-top"),10),o=i.top,s=o-f-e+PopForums.navOffset;$("html,body").animate({scrollTop:s},"fast")}$(window).load(function(){setTimeout(function(){PopForums.checkScroll()},1e3)})}});PopForums={};PopForums.areaPath="/Forums";PopForums.contentPath="/Content/PopForums";PopForums.currentTopicState=null;PopForums.navOffset=0;PopForums.editorCSS="/Content/bootstrap.min.css,/Content/PopForums/PopForums.css";PopForums.postNoImageToolbar="cut copy paste | bold italic | bullist numlist blockquote removeformat | link";PopForums.editorSettings={script_url:"/scripts/tinymce/tinymce.min.js",theme:"modern",plugins:"paste lists image link",content_css:PopForums.editorCSS,init_instance_callback:"PopForums.richEditorComplete",menubar:!1,toolbar:"cut copy paste | bold italic | bullist numlist blockquote removeformat | link | image",statusbar:!1,target_list:!1,link_title:!1,image_description:!1,image_dimensions:!1,browser_spellcheck:!0};PopForums.checkScroll=function(){var n=$("#ForumContainer #FixedBreadcrumb"),i=$("#ForumContainer #TopBreadcrumb"),t,r;i.length>0&&(PopForums.crumbTop=i.offset().top+PopForums.navOffset);t=document.documentElement.scrollTop||document.body.scrollTop;t>PopForums.crumbTop&&n.css("display")=="none"?(r=$("#ForumContainer #TopBreadcrumb").outerWidth(),n.css("width",r+"px"),n.css("top",PopForums.navOffset),n.fadeIn(150)):t<PopForums.crumbTop&&n.fadeOut(150)};PopForums.processLogin=function(){PopForums.processLoginBase("/Authorization/Login")};PopForums.processLoginExternal=function(){PopForums.processLoginBase("/Authorization/LoginAndAssociate")};PopForums.processLoginBase=function(n){$.ajax({url:PopForums.areaPath+n,type:"POST",data:{email:$("#EmailLogin").val(),password:$("#PasswordLogin").val(),persistCookie:$("#PersistCookie").is(":checked")},dataType:"json",success:function(n){var t=$("#LoginResult"),i;switch(n.Result){case!0:i=$("#Referrer").val();location=i;break;default:t.html(n.Message);t.removeClass("hide")}},error:function(){var n=$("#LoginResult");n.html("There was an unknown error while attempting login");n.removeClass("hide")}})};PopForums.topicListSetup=function(n){PopForums.topicPreviewSetup();PopForums.startTimeUpdater();var t=$("#NewTopicButton");t.click(function(){var i=$("#NewTopic");i.load(PopForums.areaPath+"/Forum/PostTopic/"+n,function(){var r=$("#IsImageEnabled").val().toLowerCase()=="true",n;r||(PopForums.editorSettings.toolbar=PopForums.postNoImageToolbar);n=$("#IsPlainText").val().toLowerCase()=="true";n||$("#NewTopic #FullText").tinymce(PopForums.editorSettings);i.slideDown();t.hide();$("#PreviewModal").on("shown.bs.modal",function(){PopForums.previewPost()})})})};PopForums.loadReply=function(n,t,i,r){$(window).off("scroll",PopForums.ScrollLoad);var f=$("#NewReply"),u=PopForums.areaPath+"/Forum/PostReply/"+n;t!=null&&(u+="?quotePostID="+t);i!=null&&(u+=t==null?"?replyID="+i:"&replyID="+i);f.load(u,function(){var u=$("#IsImageEnabled").val().toLowerCase()=="true",t,i;u||(PopForums.editorSettings.toolbar=PopForums.postNoImageToolbar);t=$("#IsPlainText").val().toLowerCase()=="true";t||$("#NewReply #FullText").tinymce(PopForums.editorSettings);f.slideDown();$("#ReplyButton").hide();PopForums.scrollToElement("NewReply");$("#MorePostsBeforeReplyButton").click(function(){$.get(PopForums.areaPath+"/Forum/TopicPartial/"+n+"?lastPost="+PopForums.currentTopicState.lastVisiblePost+"&lowpage="+PopForums.currentTopicState.lowPage,function(n){var t=$(n),r=t.find(".pagerLinks").detach(),u=t.find(".lastPostID").detach(),i;PopForums.currentTopicState.lastVisiblePost=u.val();i=$("#PostStream");i.append(t);r.replaceAll(".pagerLinks");$(".postItem img:not('.avatar')").addClass("postImage");$(".morePostsButton").remove();PopForums.setReplyMorePosts(PopForums.currentTopicState.lastVisiblePost)})});r&&(i=$.connection.topics,i.server.getLastPostID(n).done(function(n){PopForums.setReplyMorePosts(n)}));$("#PreviewModal").on("shown.bs.modal",function(){PopForums.previewPost()});PopForums.TopicState.replyLoaded=!0})};PopForums.loadComment=function(n,t){var u=$("[data-postid*='"+t+"']"),i=u.find(".commentHolder"),r=PopForums.areaPath+"/Forum/PostReply/"+n;t!=null&&(r+="?replyID="+t);i.load(r,function(){var t=$("#IsImageEnabled").val().toLowerCase()=="true",n;t||(PopForums.editorSettings.toolbar=PopForums.postNoImageToolbar);n=$("#IsPlainText").val().toLowerCase()=="true";n||$(".postForm #FullText").tinymce(PopForums.editorSettings);i.slideDown();$("#PreviewModal").on("shown.bs.modal",function(){PopForums.previewPost()})})};PopForums.previewPost=function(){var n=$("#ParsedFullText");$.ajax({url:PopForums.areaPath+"/Forum/PreviewText",type:"POST",data:{FullText:$(".postForm #FullText").val(),IsPlainText:$(".postForm #IsPlainText").val()},dataType:"json",converters:{"text json":!0},success:function(t){n.html(t)},error:function(){n.html("There was a problem getting the preview.")}})};PopForums.loadFeed=function(){var n=$.connection.feed;n.client.notifyFeed=function(n){var i=$("#FeedList"),t=PopForums.populateFeedRow(n);i.prepend(t);t.fadeIn()};$.connection.hub.start();PopForums.startTimeUpdater()};PopForums.populateFeedRow=function(n){var t=$("#ActivityFeedTemplate").clone();return t.removeAttr("id"),t.find(".feedItemText").html(n.Message),t.find(".fTime").attr("data-utc",n.Utc),t.find(".fTime").text(n.TimeStamp),t};PopForums.setReplyMorePosts=function(n){var t=n==PopForums.currentTopicState.lastVisiblePost;t?$("#MorePostsBeforeReplyButton").css("visibility","hidden"):$("#MorePostsBeforeReplyButton").css("visibility","visible")};PopForums.topicSetup=function(n,t,i,r){var f,u;PopForums.startTimeUpdater();f=$("#LastPostID").val();PopForums.currentTopicState=new PopForums.TopicState(t,f,i,n);u=$.connection.topics;u.client.fetchNewPost=function(n){PopForums.TopicState.replyLoaded||PopForums.currentTopicState.highPage!=PopForums.currentTopicState.pageCount||($.get(PopForums.areaPath+"/Forum/Post/"+n,function(n){var t=$(n);t.appendTo("#PostStream");t.effect("highlight",1500)}),$("#LastPostID").val(n),PopForums.currentTopicState.lastVisiblePost=n)};u.client.notifyNewPosts=function(n){PopForums.setReplyMorePosts(n)};$.connection.hub.start().done(function(){u.server.listenTo(n)});$(".postItem img:not('.avatar')").addClass("postImage");$(document).on("click","#ReplyButton,.replyLink",function(){PopForums.loadReply(n,null,r,!0)});$(document).on("click",".quoteLink",function(){var t=$(this).parents(".postItem").attr("data-postID");PopForums.loadReply(n,t,r,!0)});$(document).on("click",".postNameLink",function(){var n=$(this).parents(".postItem").find(".miniProfileBox"),t=$(this).parents(".postItem").attr("data-userID"),i=$(this).find(".twirl");PopForums.loadMiniProfile(t,n,i)});$(document).on("click",".voteCount",function(){var n=$(this).parents(".postItem"),t=n.attr("data-postID");n.find(".voters").slideDown(function(){$(this).load(PopForums.areaPath+"/Forum/Voters/"+t);$(this).mouseleave(function(){$(this).hide()})}).css("display","block")});$(document).on("click",".voteUp",function(){var n=$(this).parents(".postItem"),t=n.attr("data-postID"),i=$(this).closest(".postToolContainer").children(".voteCount");$.ajax({url:PopForums.areaPath+"/Forum/VotePost/"+t,type:"POST",success:function(t){i.html(t);var r=n.find(".voteUp");r.replaceWith("<li>Voted<\/li>")}})});PopForums.SetupSubscribeButton(n);PopForums.SetupFavoriteButton(n);$("#TopicModLogButton").click(function(){var t=$("#TopicModerationLog");t.is(":hidden")?t.load(PopForums.areaPath+"/Moderator/TopicModerationLog/"+n,function(){t.slideDown()}):t.slideUp()});$(document).on("click",".postModLogButton",function(){var t=$(this).attr("data-postID"),n=$(this).closest(".postToolContainer").find(".moderationLog");n.is(":hidden")?n.load(PopForums.areaPath+"/Moderator/PostModerationLog/"+t,function(){n.slideDown()}):n.slideUp()});$(document).on("click",".morePostsButton",function(){PopForums.LoadMorePosts(n,this)});$(document).on("click",".previousPostsButton",function(){PopForums.currentTopicState.addStartPage();var i=PopForums.currentTopicState.lowPage,r=n,t=$("#PostStream"),u=$(this).detach();$.get(PopForums.areaPath+"/Forum/TopicPage/"+r+"?page="+i+"&low="+PopForums.currentTopicState.lowPage+"&high="+PopForums.currentTopicState.highPage,function(n){var i=$(n),r=i.find(".pagerLinks").detach();t.prepend(i);i.effect("highlight",1500);r.replaceAll(".pagerLinks");PopForums.currentTopicState.lowPage>1&&t.prepend(u);$(".postItem img:not('.avatar')").addClass("postImage");PopForums.currentTopicState.highPage==PopForums.currentTopicState.pageCount&&PopForums.currentTopicState.lowPage==1&&$(".pagerLinks").remove()})});$(window).on("scroll",PopForums.ScrollLoad)};PopForums.qaTopicSetup=function(n){PopForums.startTimeUpdater();$(".postItem img:not('.avatar')").addClass("postImage");$(document).on("click",".commentLink",function(){var t=$(this).parents(".postContainer").attr("data-postid");PopForums.loadComment(n,t)});$(document).on("click","#ReplyButton",function(){var t=$(this).parents(".postContainer").attr("data-postid");PopForums.loadReply(n,null,t)});$(document).on("click",".postNameLink",function(){var n=$(this).parents(".postUserData").find(".miniProfileBox"),t=$(this).parents(".postUserData").attr("data-userID"),i=$(this).find(".twirl");PopForums.loadMiniProfile(t,n,i)});$(document).on("click",".voteUp",function(){var n=$(this).parents(".postContainer"),t=n.attr("data-postid"),i=$(this).parents(".answerData").find(".voteCount");$.ajax({url:PopForums.areaPath+"/Forum/VotePost/"+t,type:"POST",success:function(t){i.html(t);var r=n.find(".voteUp");r.html("Voted");r.removeClass("btn-link")}})});$(document).on("click",".answerButton",function(){var n=$(this),t=n.parents(".postContainer"),i=t.attr("data-postid"),r=t.attr("data-topicid");$.ajax({url:PopForums.areaPath+"/Forum/SetAnswer/",type:"POST",data:{postID:i,topicID:r},success:function(){$(".answerButton").removeClass("text-success glyphicon-ok").addClass("text-muted glyphicon-asterisk");n.addClass("text-success glyphicon-ok")}})});PopForums.SetupSubscribeButton(n);PopForums.SetupFavoriteButton(n);$("#TopicModLogButton").click(function(){var t=$("#TopicModerationLog");t.is(":hidden")?t.load(PopForums.areaPath+"/Moderator/TopicModerationLog/"+n,function(){t.slideDown()}):t.slideUp()});$(document).on("click",".postModLogButton",function(){var t=$(this).attr("data-postID"),n=$(this).closest(".postToolContainer").find(".moderationLog");n.is(":hidden")?n.load(PopForums.areaPath+"/Moderator/PostModerationLog/"+t,function(){n.slideDown()}):n.slideUp()})};PopForums.SetupSubscribeButton=function(n){var t=$("#SubscribeButton");t.click(function(){var i=$("#AsyncResponse");$.ajax({url:PopForums.areaPath+"/Subscription/ToggleSubscription/"+n,type:"POST",dataType:"json",success:function(n){switch(n.Data.isSubscribed){case!0:t.val("Unsubscribe");break;case!1:t.val("Subscribe");break;default:i.html(n.Message)}},error:function(){i.html("There was an unknown error while attempting to use subscription")}})})};PopForums.SetupFavoriteButton=function(n){var t=$("#FavoriteButton");t.click(function(){var i=$("#AsyncResponse");$.ajax({url:PopForums.areaPath+"/Favorites/ToggleFavorite/"+n,type:"POST",dataType:"json",success:function(n){switch(n.Data.isFavorite){case!0:t.val("Remove From Favorites");break;case!1:t.val("Make Favorite");break;default:i.html(n.Message)}},error:function(){i.html("There was an unknown error while attempting to use favorites")}})})};PopForums.ScrollLoad=function(){var n=$(window),i=$("#StreamBottom").offset().top,r=n.scrollTop()+n.height(),u=i-r,t;!PopForums.currentTopicState.loadingPosts&&u<250&&PopForums.currentTopicState.highPage<PopForums.currentTopicState.pageCount&&(PopForums.currentTopicState.loadingPosts=!0,t=$(".morePostsButton"),PopForums.LoadMorePosts(PopForums.currentTopicState.topicID,t))};PopForums.LoadMorePosts=function(n,t){PopForums.currentTopicState.addEndPage();var r=PopForums.currentTopicState.highPage,u=n,i=$("#PostStream"),f=$(t).detach();$.get(PopForums.areaPath+"/Forum/TopicPage/"+u+"?page="+r+"&low="+PopForums.currentTopicState.lowPage+"&high="+PopForums.currentTopicState.highPage,function(n){var t=$(n),r=t.find(".pagerLinks").detach(),u=t.find(".lastPostID").detach(),e=t.find(".pageCount").detach();PopForums.currentTopicState.lastVisiblePost=u.val();PopForums.currentTopicState.pageCount=e.val();t=$("<div>").append(t);i.append(t);r.replaceAll(".pagerLinks");PopForums.currentTopicState.highPage!=PopForums.currentTopicState.pageCount&&i.append(f);PopForums.currentTopicState.highPage==PopForums.currentTopicState.pageCount&&PopForums.currentTopicState.lowPage==1&&$(".pagerLinks").remove();$(".postItem img:not('.avatar')").addClass("postImage");PopForums.currentTopicState.loadingPosts=!1})};PopForums.TopicState=function(n,t,i,r){this.lowPage=n;this.highPage=n;this.lastVisiblePost=t;this.pageCount=i;this.loadingPosts=!1;this.topicID=r;this.replyLoaded=!1};PopForums.TopicState.prototype.addEndPage=function(){this.highPage++};PopForums.TopicState.prototype.addStartPage=function(){this.lowPage--};PopForums.topicPreviewSetup=function(){$(document).on("click",".topicPreviewButton",function(){var t=$(this).attr("data-topicID"),n=$("#TopicPreview"+t);n.is(":hidden")?(n.html("<p>Loading...<\/p>"),n.slideDown(),$.ajax({url:PopForums.areaPath+"/Forum/FirstPostPreview/"+t,type:"GET",dataType:"json",success:function(t){n.html(t.Data.FullText)},error:function(){n.html("<p>There was an unknown error getting the preview<\/p>")}})):n.slideUp();$(this).toggleClass("glyphicon glyphicon-chevron-right glyphicon glyphicon-chevron-down")})};PopForums.postNewTopic=function(){$("SubmitNewTopic").attr("disabled","disabled");$.ajax({url:PopForums.areaPath+"/Forum/PostTopic",type:"POST",data:{Title:$("#NewTopic #Title").val(),FullText:$("#NewTopic #FullText").val(),IncludeSignature:$("#NewTopic #IncludeSignature").is(":checked"),ItemID:$("#NewTopic #ItemID").val(),IsPlainText:$("#NewTopic #IsPlainText").val()},dataType:"json",success:function(n){var t=$("#PostResponseMessage");switch(n.Result){case!0:window.location=n.Redirect;break;default:t.html(n.Message);$("#SubmitNewTopic").removeAttr("disabled");t.show()}},error:function(){var n=$("#PostResponseMessage");n.html("There was an unknown error while trying to post");$("#SubmitNewTopic").removeAttr("disabled");n.show()}})};PopForums.postReply=function(){$("#SubmitReply").attr("disabled","disabled");$.ajax({url:PopForums.areaPath+"/Forum/PostReply",type:"POST",data:{Title:$("#NewReply #Title").val(),FullText:$("#NewReply #FullText").val(),IncludeSignature:$("#NewReply #IncludeSignature").is(":checked"),ItemID:$("#NewReply #ItemID").val(),CloseOnReply:$("#CloseOnReply").is(":checked"),IsPlainText:$("#NewReply #IsPlainText").val(),ParentPostID:$("#NewReply #ParentPostID").val()},dataType:"json",success:function(n){var t=$("#PostResponseMessage");switch(n.Result){case!0:window.location=n.Redirect;break;default:t.html(n.Message);$("#SubmitReply").removeAttr("disabled");t.show()}},error:function(){var n=$("#PostResponseMessage");n.html("There was an unknown error while trying to post");$("#SubmitReply").removeAttr("disabled");n.show()}})};PopForums.loadMiniProfile=function(n,t,i){t.is(":hidden")?t.load(PopForums.areaPath+"/Account/MiniProfile/"+n,function(){t.slideDown()}):t.slideUp();i.toggleClass("glyphicon-chevron-right glyphicon-chevron-down")};PopForums.scrollToElement=function(n){var t=document.getElementById(n),i=0,r;if(t.offsetParent)while(t.offsetParent)i+=t.offsetTop,t=t.offsetParent;else t.y&&(i+=t.y);r=$("#TopBreadcrumb");r&&(i-=r.outerHeight());i+=PopForums.navOffset;scrollTo(0,i)};PopForums.homeSetup=function(){var n=$.connection.forums;n.client.notifyForumUpdate=function(n){PopForums.updateForumStats(n)};$.connection.hub.start();PopForums.startTimeUpdater()};PopForums.recentListen=function(n){var t=$.connection.recent;t.client.notifyRecentUpdate=function(t){var r=$('#TopicList tr[data-topicID="'+t.TopicID+'"]'),u,i;r.length!=0?(r.fadeOut(),r.remove()):(u=$("#TopicList tr:not('#TopicTemplate')"),u.length==n&&u.last().remove());i=PopForums.populateTopicRow(t).hide();i.removeClass("hidden");$("#TopicList").prepend(i);i.fadeIn()};$.connection.hub.start().done(function(){t.server.register()})};PopForums.forumListen=function(n,t){var i=$.connection.forums;i.client.notifyUpdatedTopic=function(t){var r=$('#TopicList tr[data-topicID="'+t.TopicID+'"]'),u,i;r.length!=0?(r.fadeOut(),r.remove()):(u=$("#TopicList tr:not('#TopicTemplate')"),u.length==n&&u.last().remove());i=PopForums.populateTopicRow(t).hide();i.removeClass("hidden");$("#TopicList").prepend(i);i.fadeIn()};$.connection.hub.start().done(function(){i.server.listenTo(t)})};PopForums.populateTopicRow=function(n){var t=$("#TopicTemplate").clone();return t.attr("data-topicID",n.TopicID),t.removeAttr("id"),t.find(".startedByName").text(n.StartedByName),t.find(".indicatorLink").attr("href",n.Link),t.find(".titleLink").text(n.Title),t.find(".titleLink").attr("href",n.Link),t.find(".topicPreview").attr("id","TopicPreview"+n.TopicID),t.find(".topicPreviewButton").attr("data-topicID",n.TopicID),t.find(".forumTitle").text(n.ForumTitle),t.find(".viewCount").text(n.ViewCount),t.find(".replyCount").text(n.ReplyCount),t.find(".lastPostTime").text(n.LastPostTime),t.find(".lastPostName").text(n.LastPostName),t.find(".fTime").attr("data-utc",n.Utc),t.find(".newIndicator img").attr("src",PopForums.contentPath+"/"+n.Image),t};PopForums.updateForumStats=function(n){var t=$("[data-forumID='"+n.ForumID+"']");t.find(".topicCount").text(n.TopicCount);t.find(".postCount").text(n.PostCount);t.find(".lastPostTime").text(n.LastPostTime);t.find(".lastPostName").text(n.LastPostName);t.find(".fTime").attr("data-utc",n.Utc);t.find(".newIndicator img").attr("src",PopForums.contentPath+"/"+n.Image)};PopForums.startTimeUpdater=function(){setTimeout(function(){PopForums.startTimeUpdater();PopForums.updateTimes()},6e4)};PopForums.updateTimes=function(){var n=[],t=$(".fTime");$.each(t,function(){var t=$(this).attr("data-utc");(new Date-new Date(t+"Z"))/36e5<48&&n.push(t)});n.length>0&&$.ajax({url:PopForums.areaPath+"/Time/GetTimes",type:"POST",data:{times:n},dataType:"json",traditional:!0,success:function(n){$.each(n,function(){$(".fTime[data-utc='"+this.Key+"']").text(this.Value)})},error:function(){}})}