


function hide_comment (comment_id) {
	if (confirm('Hide this comment? You can\'t undo this.')) {
		var myAjax = new Ajax.Request('async/project_admin.php',
		  {
			method:'post',
			parameters: {action:'hide_comment',id:comment_id},
			onSuccess: function(transport){
			 var result = transport.responseText.evalJSON(true);
			  if (result.success) {
				  new Effect.BlindUp('comment_'+comment_id);
			  } else {
				  alert(result.error);
			  }
			},
			onFailure: function(){ alert('Communication error...');}
		  });
	}
	return false;
}

function join_request (project_id) {
	if (confirm('Join this group?')) {
		var myAjax = new Ajax.Request('async/project_admin.php',
		  {
			method:'post',
			parameters: {action:'join_project',id:project_id},
			onSuccess: function(transport){
			 var result = transport.responseText.evalJSON(true);
			 if (result.success) {
				  if (result.joined) {
					  alert("You have successfully joined this project.");
					  window.location.href=newURL;
				  } else if (result.requested) {
					  alert("You have requested to join this project. You will be notified when you are accepted");
				  } 
			  } else {
				  alert(result.error);
			  }
			},
			onFailure: function(){ alert('Communication error...');}
		  });
	}
	return false;
}
