var peerReview=false;var lessonPlanPeerReview=false;var currentRequest=null;var submittedComment=false;function submit_comment_rating(B,C){var A="/submissions/submit_comment_rating/comment_id:"+B+"/rating:"+C;var E=document.getElementById("submission_comment_rating_"+B);var D=new Ajax.Request(A,{method:"get",onSuccess:function(G){var F=G.responseText;E.innerHTML=F}})}function submitComments(){var G=5;var H=false;var K=0;if(submittedComment){return }submittedComment=true;gaTrackEvent("Submissions","Submissions - Submission Review");if(tinyMCE.get("SubmissionComments")!=null){comment_content=tinyMCE.get("SubmissionComments").getContent()}else{comment_content=$("SubmissionComments").innerHTML}audio_url=document.getElementById("comment_audio_url");var F=new Array();for(var C=1;C<=G;C++){var D="ratingValue_"+C;if(document.getElementById(D)){F.push(document.getElementById("ratingValue_"+C))}}var A=document.getElementById("msg_length_SubmissionComments");if(A.innerHTML!=""){alert(A.innerHTML);return }for(C=0;C<F.length;C++){if(F[C]!=null&&F[C].value==""){K++}}if(K>0&&K<F.length){rating_error_div=document.getElementById("rating_error");rating_error_div.style.display="block";H=true}if(K==F.length&&comment_content.length==0&&audio_url.value.length==0){comment_error_div=document.getElementById("comment_error");comment_error_div.style.display="block";H=true}var E=document.getElementById("comment_duration");if(E&&typeof commentStartTime!="undefined"&&commentStartTime&&commentStartTime>0){var J=new Date();E.value=J.getTime()-commentStartTime}if(H){submittedComment=false;return }if(!lessonPlanPeerReview){document.comment_form.submit()}else{if(tinyMCE.get("SubmissionComments")!=null){tinyMCE.triggerSave(true,true)}var B=Form.serialize(document.comment_form);currentRequest=new Ajax.Request("/submissions/ajax_submit_comments/submission_id:"+document.getElementById("SubmissionReviewingSubmissionId").value,{evalScripts:true,method:"post",parameters:B,onSuccess:function(L){Modalbox.hide();currentRequest=null},onFailure:function(L){currentRequest=null}})}function I(L){}}