﻿// JavaScript Document
function CreateBlogComment(PostID)
{
	
	_Comment = $("#txtComment").val();
	_PostID = PostID
	if(_Comment == "")
	{
		showTips("false","内容不能为空");
		return false;
	}
	showTipsOnly("tips","数据提交中...");
	$.ajax({
		   type : "Post",
		   url : "/blog/Inc/blog.action.asp",
		   async: false,
		   dataType : "html",
		   data : {"Action":"CreateBlogComment",
		   "Comment":escape(_Comment),
		   "PostID":escape(_PostID)
		  },
		  success : function(msg){
			  if(msg == "timeout")
			  {
			  	showTips("false","登录超时，请登录后进行操作。");
				return;
			  }
			  if(msg == "ban")
			  {
			  	showTips("false","对不起，你被禁止发言。");
				return;
			  }
			  if(msg == "err")
			  {
				  showTips("false","对不起，请稍候再进行发布");
				  return;
			  }
			  showTipsOnly(true,"发布成功");
			  document.location = document.location;
			  },
		  error : function(){
			  showTips("false","操作失败，请刷新后测试");
		  }
		  });
}

function deleteBlogComment(commentID)
{
	showTipsOnly("tips","数据提交中...");
	$.ajax({
		   type : "Post",
		   url : "/blog/Inc/blog.action.asp",
		   async: false,
		   dataType : "html",
		   data : {"Action":"deleteBlogComment",
		   "commentID":escape(commentID)
		  },
		  success : function(msg){
			  if(msg == "timeout")
			  {
			  	showTips("false","登录超时，请登录后进行操作.");
				return;
			  }
			  showTipsOnly(true,"删除成功.");
			  document.location = document.location;
			  },
		  error : function(){
			  showTips("false","操作失败，请刷新后测试");
		  }
		  });
}

function deleteBlogPost(postID,UserID)
{
	showTipsOnly("tips","数据提交中...");
	$.ajax({
		   type : "Post",
		   url : "/blog/Inc/blog.action.asp",
		   async: false,
		   dataType : "html",
		   data : {"Action":"deleteBlogPost",
		   "postID":escape(postID)
		  },
		  success : function(msg){
			  if(msg == "timeout")
			  {
			  	showTips("false","登录超时，请登录后进行操作.");
				return;
			  }
			  showTipsOnly(true,"删除成功.");
transurl = "http://" + window.location.host + "/Blog/i" + UserID + ".html";
			  window.location.href = "/Blog/i" + UserID + ".html";
			  },
		  error : function(){
			  showTips("false","操作失败，请刷新后测试");
		  }
		  });
}

