function dateToStr(n){var t=n.getDate(),i=monthNames[n.getMonth()],r=n.getFullYear();return twoDigNo(t)+"-"+i+"-"+r+" "+twoDigNo(n.getHours())+":"+twoDigNo(n.getMinutes())}function twoDigNo(n){return n>9?""+n:"0"+n}function initTooltip(n){n.tooltip({trigger:"manual",title:""}).on({click:function(){$(this).tooltip("show")},focusout:function(){$(this).tooltip("hide");$(this).attr("data-original-title","");$(this).tooltip("fixTitle")}})}function deleteComment(n,t){var r=$(n).closest(".cctr"),i=r.attr("data-id");confirm("are you sure you want to delete your comment?")&&$.ajax({url:t,type:"POST",data:{commentId:i}}).done(function(){$("#cctr_"+i).parent().remove()}).fail(function(n,t){alert(t)})}var monthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],VoteApp=function(n,t,i,r,u,f,e){this.uniqueId=t;this.currentUserId=i;this.origVote=r-u;this.currVote=r;this.id=n;this.updateVoteUi(n,r,this.origVote);this.postUrl=e;this.createdBy=f},CommentApp;VoteApp.prototype.changeVote=function(n,t){if(this.createdBy==this.currentUserId){$(t).attr("data-original-title","You cannot vote for your own post");$(t).tooltip("fixTitle");return}if(this.currentUserId<=0){$(t).attr("data-original-title","You must be logged on to vote");$(t).tooltip("fixTitle");return}voteChange=n;this.currVote==this.origVote?this.currVote=this.origVote+n:(voteChange=this.currVote>this.origVote?-1:1,this.currVote=this.origVote);this.updateVoteUi();var i=$.ajax({type:"POST",url:this.postUrl,dataType:"json",data:{id:this.id,delta:voteChange},success:function(){}}).responseText};VoteApp.prototype.updateVoteUi=function(){var n=$("#voteUp_"+this.uniqueId),t=$("#voteDn_"+this.uniqueId);n.removeClass("voteUpSelected");t.removeClass("voteDnSelected");this.currVote>this.origVote?n.addClass("voteUpSelected"):this.currVote

'+decodeURI(t)+' '+r+" "+u+" "+(i==this.currentUserId?'
":"")+" "};CommentApp.prototype.closeComments=function(){document.getElementById("addCommentPanel_"+this.pid).style.display="none";document.getElementById("txtComment_"+this.pid).textContent=""};CommentApp.prototype.beginAddComments=function(){if(currentUserId<=0){$("#addComm_"+this.pid).attr("data-original-title","You must be logged on to comment");$("#addComm_"+this.pid).tooltip("fixTitle");return}if(!this.canComment&&this.postOwner!=this.currentUserId){$("#addComm_"+this.pid).attr("data-original-title",this.commentDeniedReason);$("#addComm_"+this.pid).tooltip("fixTitle");return}document.getElementById("addCommentPanel_"+this.pid).style.display="block"}