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,[]);(function(A){A(document).ready(function(){vBulletin.conversation=vBulletin.conversation||{};var D=A(".channel-content-widget .channel-conversation-list-wrapper");var F=A("#activity-stream-tab",D);var J=A("#recommended-tab",D);var L=A("#subscribed-tab",D);var Y=A("#topic-tab",D);var G=A("#media-tab",D);var M=A(".conversation-list",F);var b=A(".conversation-list",J);var T=A(".conversation-list",L);var Z=A(".conversation-list",Y);var R=A(".conversation-list",D);var H,a,O,U,B;var X,V,P,C;var K=A(".widget-tabs-nav ul.ui-tabs-nav li",D);K.sort(function(f,d){var e=parseInt(A(f).attr("data-order"))||-1,c=parseInt(A(d).attr("data-order"))||-1;return e-c});A(".widget-tabs-nav ul.ui-tabs-nav",D).empty().html(K);D.tabs({select:function(c,d){Q.hideFilterOverlay();if(O){O.hideFilterOverlay()}if(P){P.hideFilterOverlay()}},show:function(c,d){if(d.tab.hash=="#activity-stream-tab"){if(O){O.toggleNewConversations(false)}if(Q){Q.applyFilters(false,true)}}else{if(d.tab.hash=="#subscribed-tab"){if(Q){Q.toggleNewConversations(false)}if(O){O.toggleNewConversations(false)}if(!X){X=A(".conversation-toolbar-wrapper.scrolltofixed-floating",L);V=new vBulletin.scrollToFixed({element:X,limit:N(X)});P=new vBulletin.conversation.filter({context:L,scrollToTop:D,onContentLoad:function(){V.updateLimit(N(X));vBulletin.conversation.processPostContent(T);vBulletin.truncatePostContent(T)}})}if(P){P.applyFilters(false)}}else{if(d.tab.hash=="#topic-tab"){if(Q){Q.toggleNewConversations(false)}if(!H){H=A(".conversation-toolbar-wrapper.scrolltofixed-floating",Y);a=new vBulletin.scrollToFixed({element:H,limit:N(H)});O=new vBulletin.conversation.filter({context:Y,autoCheck:A(".toolbar-filter-overlay input[type=radio][value=conversations_on]",Y).is(":checked"),scrollToTop:D,pagination:W,onContentLoad:function(){a.updateLimit(N(H));vBulletin.markreadcheck()}})}if(O){O.applyFilters(false,true)}}else{if(d.tab.hash=="#media-tab"){if(Q){Q.toggleNewConversations(false)}if(O){O.toggleNewConversations(false)}if(!U){U=A(".conversation-toolbar-wrapper.scrolltofixed-floating",G);B=new vBulletin.scrollToFixed({element:U,limit:N(U)})}if(!C){C=vBulletin.media.calculatePhotosPerPage(vBulletin.media.TARGET_PHOTOS_PERPAGE)}loadGalleryById({nodeid:-2,channelid:pageData.channelid,pageno:1,dateFilter:"anytime",perpage:C},false,0,{complete:function(){B.updateLimit(N(U))}})}}}}}});var E=new vBulletin.pagination({context:F,onPageChanged:function(c,d){Q.updatePageNumber(c);if(!d){Q.applyFilters(false,true)}}});var W=new vBulletin.pagination({context:Y,onPageChanged:function(c,d){O.updatePageNumber(c);if(!d){O.applyFilters(false,true)}}});var I=A(".conversation-toolbar-wrapper.scrolltofixed-floating",F);var S=new vBulletin.scrollToFixed({element:I,limit:N(I)});var Q=new vBulletin.conversation.filter({context:F,autoCheck:A(".toolbar-filter-overlay input[type=radio][value=conversations_on]",F).is(":checked"),scrollToTop:D,pagination:E,onContentLoad:function(){S.updateLimit(N(I));vBulletin.conversation.processPostContent(M);vBulletin.truncatePostContent(M)}});vBulletin.conversation.processPostContent(M);vBulletin.truncatePostContent(M);function N(c){var d=(D.offset().top+(D.outerHeight()-parseFloat(D.css("border-bottom-width")))-c.height());return d}A(".list-item-poll .view-more-ctrl").live("click",function(d){var c=A(this).closest("form.poll");var f=c.find("ul.poll");A(this).addClass("hide");f.css("max-height","none").find("li.hide").slideDown(100,function(){c.find(".action-buttons").removeClass("hide").next(".view-less-ctrl").removeClass("hide");vBulletin.animateScrollTop(c.offset().top,{duration:"fast"})});return false});A(".list-item-poll .view-less-ctrl").live("click",function(d){var c=A(this).closest("form.poll");vBulletin.conversation.limitVisiblePollOptionsInAPost(c,3);c.find("ul.poll").css("max-height","").find("li.hide").slideUp(100);return false});A(".post-controls li.ipAddress",R).live("click",vBulletin.conversation.showIp);A(".post-controls li.editCtrl",R).live("click",function(c){vBulletin.conversation.editPost.apply(this,[c,Q])});A(".post-controls li.voteCtrl",R).live("click",vBulletin.conversation.votePost);A(".post-info li.votecount",R).live("click",vBulletin.conversation.showWhoVoted);A(".post-controls .flagCtrl",R).live("click",vBulletin.conversation.flagPost);A(".post-controls .commentCtrl",R).live("click",vBulletin.conversation.toggleCommentBox);A(".comment-entry-box .post-comment-btn",R).live("click",function(c){vBulletin.conversation.postComment.apply(this,[c,function(){Q.updatePageNumber(1).applyFilters(false,true)}])});vBulletin.conversation.bindEditFormEventHandlers("all")})})(jQuery);