jq(document).ready(function() { /***************************************************************** * Show the reply button only when Javascript is enabled. * Otherwise hide it, since the reply functions relies on jQuery. *****************************************************************/ jq(".reply-to-comment-button").css("display" , "inline"); /***************************************************************** * Create reply to comment form. *****************************************************************/ jq(".reply-to-comment-button").bind("click", function(e){ var comment_div = jq(this).parents().filter(".comment"); var comment_id = comment_div.attr("id"); var reply_button = comment_div.find(".reply-to-comment-button"); /* Clone the reply div at the end of the page template that contains * the regular comment form and insert it after the reply button of the * current comment. */ var reply_div = jq("#commenting").clone(true); reply_div.appendTo(comment_div).css("display", "none"); /* Remove id="reply" attribute, since we use it to uniquely the main reply form. */ reply_div.removeAttr("id") /* Hide the reply button (only hide, because we may want to show it * again if the user hits the cancel button). */ jq(reply_button).css("display", "none"); /* Fetch the reply form inside the reply div */ var reply_form = reply_div.find("form"); /* Add a hidden field with the id of the comment */ reply_form.append("