blog = {};
blog.confirmPostRemoval = function(uid,pid){
	var toDelete = confirm('You are about to delete this post.\n\n Are you sure?');
	if(toDelete){
		window.location.href = '?uid='+uid+'&pid='+pid+'&action=delete';
	}
};
blog.confirmCommentRemoval = function(uid,pid,cid){
	var toDelete = confirm('You are about to delete this comment.\n\n Are you sure?');
	if(toDelete){
		window.location.href = '?uid='+uid+'&pid='+pid+'&cid='+cid+'&action=deleteComment';
	}
};
blog.toggleComment = function(pid,cid,isActive){
	YAHOO.util.Connect.asyncRequest(
		'POST',
		'/includes/JSONGateway.cfm?comp=blogs&method=toggleComment',
		{
			cached:false,
			success:function(o){
				var act = document.getElementById('c'+cid+'-ac');
				var dea = document.getElementById('c'+cid+'-de');
				if(o.responseText.indexOf('true') > -1){
					act.onclick = null;
					act.src = '/commonTemplates/images/16x16/dialog-on.png';
					act.className = '';
					dea.onclick = function(){blog.toggleComment(pid,cid,false)};
					dea.src = '/commonTemplates/images/16x16/dialog-na.png';
					dea.className = 'x-img-click';
				} else {
					act.onclick = function(){blog.toggleComment(pid,cid,true)};
					act.src = '/commonTemplates/images/16x16/dialog-na.png';
					act.className = 'x-img-click';
					dea.onclick = null;
					dea.src = '/commonTemplates/images/16x16/dialog-off.png';
					dea.className = '';
				}
			}
		},
		'BlogPostID='+pid+'&BlogCommentID='+cid+'&isActive='+isActive
	);
}
