window.vBulletin=window.vBulletin||{};window.vBulletin.phrase=window.vBulletin.phrase||{};window.vBulletin.phrase.precache=window.vBulletin.phrase.precache||[];window.vBulletin.phrase.precache=$.merge(window.vBulletin.phrase.precache,["forum"]);(function(A){A(document).ready(function(){vBulletin.conversation=vBulletin.conversation||{};var C=vBulletin.conversation.$activityStreamWidget=A(".activity-stream-widget"),G=vBulletin.conversation.$activityStreamTab=A("#activity-stream-tab"),M=vBulletin.conversation.$subscribedTab=A("#subscribed-tab"),K=vBulletin.conversation.$activityStreamList=A(".conversation-list",G),J=vBulletin.conversation.$subscribedList=A(".conversation-list",M),O,P,N;var D=A("ul.ui-tabs-nav li",C);D.sort(function(T,R){var S=parseInt(A(T).attr("data-order"))||-1,Q=parseInt(A(R).attr("data-order"))||-1;return S-Q});A("ul.ui-tabs-nav",C).empty().html(D);C.filter(".widget-tabs").tabs({select:function(S,T){H.hideFilterOverlay();if(N){N.hideFilterOverlay()}var R=C.find(".widget-tabs-panel .ui-tabs-panel:visible");var Q=R.find(".list-item-body-wrapper.edit-post .edit-conversation-container");if(Q.length>0){openAlertDialog({title:vBulletin.phrase.get("edit_conversation"),message:vBulletin.phrase.get("you_have_a_pending_edit_unsaved"),iconType:"warning",onAfterClose:function(){vBulletin.animateScrollTop(Q.closest(".list-item").offset().top,{duration:"slow"})}});return false}},show:function(Q,R){if(R.tab.hash=="#activity-stream-tab"){if(N){N.toggleNewConversations(false)}if(H){H.updatePageNumber(1);H.applyFilters(false,true)}}else{if(R.tab.hash=="#subscribed-tab"){if(H){H.toggleNewConversations(false)}if(!O){O=A(".conversation-toolbar-wrapper.scrolltofixed-floating",M);P=new vBulletin.scrollToFixed({element:O,limit:L(O)});N=vBulletin.conversation.subscribedFilter=new vBulletin.conversation.filter({context:M,scrollToTop:C,onContentLoad:function(){P.updateLimit(L(O));vBulletin.conversation.processPostContent(J);vBulletin.truncatePostContent(J)}})}if(N){N.updatePageNumber(1);N.applyFilters(false,true)}}else{if(R.tab.hash=="#forum-tab"){if(A("#forum-tab").hasClass("dataLoaded")){return false}A("#forum-tab .list-empty").css("visibility","hidden");A.post(pageData.baseurl+"/activity/forumlist",{parentid:-1,depth:3,template:"display_Forums"},function(S){A("#forum-tab").html(S).addClass(function(){return(A(".list-empty",this).length==0)?"dataLoaded":""})},"html").error(function(U,T,S){openAlertDialog({title:vBulletin.phrase.get("forum"),message:"HTTP {0} - {1}".format(U.status,S),iconType:"error"})}).complete(function(){vBulletin.markreadcheck()})}}}}});var I=0;C.find(".ui-tabs-nav li").each(function(){I+=A(this).width()});var F=C.find(".ui-tabs-nav").width();if(I>C.find(".ui-tabs-nav").width()){C.find(".widget-tabs-nav, .module-title").height(C.find(".ui-tabs-nav").height())}var E=A(".conversation-toolbar-wrapper.scrolltofixed-floating",G);var B=false;var H=vBulletin.conversation.activityStreamFilter=new vBulletin.conversation.filter({context:G,autoCheck:A(".toolbar-filter-overlay input[type=radio][value=conversations_on]",C).is(":checked"),scrollToTop:C,onContentLoad:function(){if(!B){B=new vBulletin.scrollToFixed({element:E,limit:L(E)})}B.updateLimit(L(E));vBulletin.conversation.processPostContent(K);vBulletin.truncatePostContent(K)}});vBulletin.conversation.processPostContent(K);vBulletin.truncatePostContent(K);function L(Q){var R=(C.offset().top+(C.outerHeight()-parseFloat(C.css("border-bottom-width")))-Q.height());return R}A(".list-item-poll .view-more-ctrl").live("click",function(R){var Q=A(this).closest("form.poll");var S=Q.find("ul.poll");A(this).addClass("hide");S.css("max-height","none").find("li.hide").slideDown(100,function(){Q.find(".action-buttons").removeClass("hide").next(".view-less-ctrl").removeClass("hide");vBulletin.animateScrollTop(Q.offset().top,{duration:"fast"})});return false});A(".list-item-poll .view-less-ctrl").live("click",function(R){var Q=A(this).closest("form.poll");vBulletin.conversation.limitVisiblePollOptionsInAPost(Q,3);Q.find("ul.poll").css("max-height","").find("li.hide").slideUp(100);return false});A(".post-controls li.ipAddress",C).live("click",vBulletin.conversation.showIp);A(".post-controls li.editCtrl",C).live("click",function(Q){vBulletin.conversation.editPost.apply(this,[Q,H])});A(".post-controls li.ipAddress",C).live("click",vBulletin.conversation.showIp);A(".post-controls li.voteCtrl",C).live("click",vBulletin.conversation.votePost);A(".post-info li.votecount",C).live("click",vBulletin.conversation.showWhoVoted);A(".post-controls .flagCtrl",C).live("click",vBulletin.conversation.flagPost);A(".post-controls .commentCtrl").live("click",vBulletin.conversation.toggleCommentBox);A(".comment-entry-box .post-comment-btn").live("click",function(Q){vBulletin.conversation.postComment.apply(this,[Q,function(){H.updatePageNumber(1).applyFilters(false,true)}])});vBulletin.conversation.bindEditFormEventHandlers("all")})})(jQuery);