
var sCurrCommentDiv = '';

function showComment(id)
{
	el_curr_action = document.getElementById(id);
	el_curr_action.style.display = '';
}

var handleCommentLoadSuccess = function(o) {
	if(o.responseText !== undefined) {
		if (document.getElementById(sCurrCommentDiv))
			document.getElementById(sCurrCommentDiv).innerHTML = document.getElementById(sCurrCommentDiv).innerHTML + o.responseText;
	}
}

var handleCommentLoadFailure = function(o) {
	if(o.responseText !== undefined) {
		//alert("We couldn't add the new comment." + o.responseText);
	}
}

function addNewComment(currSiteActivity, addCommentDiv, addCommentTextArea, charityId, isAdmin) {
	if (document.getElementById(addCommentDiv)) {
		sCurrCommentDiv = addCommentDiv;
		url = '/activity/add-comment?sa_id=' + currSiteActivity + '&comment=' + document.getElementById(addCommentTextArea).value + '&cid=' + charityId +'&isAdmin='+isAdmin;
		var request = YAHOO.util.Connect.asyncRequest('GET', url, { success:handleCommentLoadSuccess, failure: handleCommentLoadFailure });
		document.getElementById(addCommentTextArea).value = '';
	}
}

function addNewFundraiserComment(currSiteActivity, addCommentDiv, addCommentTextArea, charityId, isAdmin) {
	if (document.getElementById(addCommentDiv)) {
		sCurrCommentDiv = addCommentDiv;
		url = '/activity/add-comment-fundraiser?sa_id=' + currSiteActivity + '&comment=' + document.getElementById(addCommentTextArea).value + '&cid=' + charityId +'&isAdmin='+isAdmin;
		var request = YAHOO.util.Connect.asyncRequest('GET', url, { success:handleCommentLoadSuccess, failure: handleCommentLoadFailure });
		document.getElementById(addCommentTextArea).value = '';
	}
}