ODG.YimbyWeb.ArticleCommentManager=new function(){this.PostButtonDisable=function(){$("#BtnPostComment").hide();$(".SimpleAjaxLoader").show()};this.PostButtonEnable=function(){$(".SimpleAjaxLoader").hide();$("#BtnPostComment").show()};this.CommentReload=function(commentId){var cid="c"+commentId;$("#"+cid).html('<img src="/gfx/ajax-loader.gif" />');$("#"+cid).attr("id","TempTarget");var url=String.Format("/Ajax/ArticleComments.aspx?articleId={0}&commentId={1}&r={2}",ODG.YimbyWeb.ArticleCommentSettings.ArticleId,commentId,ODG.Core.Random.GetString(20));$("#TempLoader").load(url,function(){$("#TempTarget").hide().html($("#"+cid).html());$("#TempLoader").html("");$("#TempTarget").attr("id",cid);$("#BtnPostComment").removeAttr("disabled");$("#"+cid).fadeIn();ODG.YimbyWeb.ArticleCommentManager.PostButtonEnable()})};this.CommentInsert=function(commentId){$("#ErrorBox").hide();$("#TextBoxComment").val("");$(".ArticleCommentsList").append('<div class="Comment" id="c'+commentId+'"></div>');ODG.YimbyWeb.ArticleCommentManager.CommentReload(commentId,true);$(ODG.YimbyWeb.ArticleCommentSettings.LabelCommentsCount).text(ODG.YimbyWeb.ArticleCommentManager.CommentCountGet()+1)};this.ErrorDisplay=function(error){$("#ErrorBox").fadeIn();$("#ErrorMessage").html(error);ODG.YimbyWeb.ArticleCommentManager.PostButtonEnable()};this.CommentCountGet=function(){return parseInt($(ODG.YimbyWeb.ArticleCommentSettings.LabelCommentsCount).text())};this.CommentCountDecrease=function(){$(ODG.YimbyWeb.ArticleCommentSettings.LabelCommentsCount).text(ODG.YimbyWeb.ArticleCommentManager.CommentCountGet()-1)};this.ValidationSet=function(){var fldName=ODG.YimbyWeb.ArticleCommentSettings.FieldName;var pCode=ODG.YimbyWeb.ArticleCommentSettings.PCode;var lnk=$("#frmComment").attr("action");lnk=lnk.Replace("/perma.aspx?","/permaLink.aspx?");$("#frmComment").attr("action",lnk);$("#"+fldName).val(pCode);ODG.YimbyWeb.ArticleCommentManager.PostButtonDisable()}};
