var Posting=false;function ReportComment(id){PostComment("report",id);}function DeleteComment(id){if(confirm("Are you sure you want to delete this comment?")){PostComment("delete",id);}}function PostComment(action,id){var ThisFunction=function(){PostComment(Params)};Posting=true;var httpPost=new XmlHttpPost("Comments.aspx?tid=0&rnd="+new Date().getTime(),"action="+action+"&comment="+id,function(responseText){var ResultId=responseText.substr(0,1);var ResultText=responseText.substr(1);if(ResultId=="9")QuickLogin(ThisFunction,ResultText);if(ResultId=="8")ShowMessage(ResultText,false,4000);if(ResultId=="2")ShowMessage("<span class=\"Larger\">"+ResultText+"</span>",true);else if(ResultId=="0")dEl("Comments").innerHTML=HtmlUtility.AddResourceGetHtml(ResultText);else if(ResultId=="5")dEl("Content").removeChild(dEl("Comment"+id));else if(ResultId=="1"){ShowMessage(ResultText,false);};Posting=false;});httpPost.Send();}function CalcCommentLength(){var MaxLength=200;var MaxLines=3;var TextArea=dEl("txtComment");var Length=TextArea.value.replace(/\n/g,"<br />").length;var Lines=TextArea.value.split("\n").length;var elCommentLength=dEl("CommentRemainingLength");elCommentLength.innerHTML="Remaining characters left: "+Math.max(0,MaxLength-Length);elCommentLength.style.color=(Length<MaxLength-5&&Lines<=MaxLines)?"#000000":"#ff0000";if(Lines>MaxLines){elCommentLength.innerHTML="Too many lines";TextArea.value=TextArea.oldText?TextArea.oldText:"";Lines=TextArea.value.split("\n").length;};if(Length>MaxLength)TextArea.value=TextArea.oldText?TextArea.oldText:TextArea.value.substr(0,MaxLength-6*Lines);TextArea.oldText=TextArea.value;}
