﻿function onSaveComment(status, statusText, responseText, responseHTML)
{
   var rmcontent = document.getElementById('rmcontent');
   
   if(responseText != "")
   {
      eval(responseText);
      if(result.success == "1")
      {
         setCookie("comment_author", $("#author").val());
         setCookie("comment_email", $("#email").val());
         setCookie("comment_www", $("#www").val());
         $("#story").val("");

         alert("发布成功!");
         window.location.reload();
		}
   }
}

function initComment()
{
   $("#author").val(getCookie('comment_author'));
   $("#email").val(getCookie('comment_email'));
   $("#www").val(getCookie('comment_www'));
}

/*通过ajax来保持评论*/
function saveComment()
{
   var story = $("story");
   if(story.val() < 10)
   {
      alert("还是多敲几个字吧，至少让每个手指头都有机会碰下键盘:)");
      return;
   }

   var cmd = "save_log_comment";
   var data = buildQSInForm('ajaxComment');
   ajaxExe(onSaveComment, cmd, "POST", data);
}
