function collapseThread(theId) {$("#"+theId).toggleClass("collapsed")} function expandThread(theId) {$("#"+theId).removeClass("collapsed")} function onAddComment() { if (checkDocumentIntegrity()) $("#commentform").submit(); } function moveAddCommentBelow(theId, threadId, collapse) { expandThread(theId); var $addComment = $("#addcomment"); var $comment = $("#"+theId); if(!$addComment.length){alert("Sorry, the comment is currently closed"); return} if(collapse) $comment.children(".comment").addClass("collapsed"); $addComment.appendTo($comment); $("#comment_reply_ID").val(threadId); $("#reroot").show(); $("#comment").focus(); } function checkDocumentIntegrity() { if($("#reroot").length && $("#addcomment").length && $("#comment_reply_ID").length && $(".commentlist").length && $("#comment").length && $("#addcommentanchor").length) { return true } alert("The DOM is not right, \nYou should compare your comments.php with the original comments.php and make sure the required elements have not been removed"); return false; } function reRoot() { $("#reroot").hide(); $("#addcomment").appendTo($(".commentlist")); document.location.href = "#addcommentanchor"; _$ff(); $("#comment_reply_ID").val("0"); } function _$h(){$(".comment").addClass("collapsed"); return false;} function _$s(){$(".comment").removeClass("collapsed"); return false;} function _$ff(){$("#comment").focus();return false;}