function submit_comment() { if ($('id_question') && $('id_question').value !=$('id_answer').value) { alert("Sorry, you answered the question incorrectly."); return false; } for (var e=this.parentNode;e.tagName!='FORM';e=e.parentNode) {} var form_contents = formContents(e); var content=queryString(form_contents[0], form_contents[1]); var d = doXHR("/comments/post/?xhr", { method: "POST", mimeType : 'application/x-www-form-urlencoded', sendContent : content, headers : { 'Content-Type' : 'application/x-www-form-urlencoded'} }); var gotData = function (xhr) { var z; var data = evalJSONRequest(xhr); if (data['errors']) { new_errors = DIV({'id':'errors'}, null); for (k in data['errors']) { appendChildNodes(new_errors, P(null, 'Error in '+k+': '+data['errors'][k])); } swapDOM($('errors'), new_errors); return; } var toggle = false; tbody=TBODY(null, null); for (var i=0;i