function applyChanges(obj, getCommentId, getCommentType, cancel) {
	if(!cancel) {
		var textObj = $(obj).parent().siblings(0).val();
		$.post("/commentsForUser.htj", {
			comment_content: textObj,
			comment_id: getCommentId,
			comment_type: getCommentType
			}, 
			function(txt){ 
				// alert(txt);
			}
		);
	}
	else {
		var textObj = cancel;
	}
	if (textObj =='') {
		alert("Please enter comment.");
		return false;
	}
	textObj = textObj.replace(/\n/gi,"<br>");
	$(obj).parent().parent().after('<div class="comments_text" id="admin_editable_' + getCommentId + '">' + textObj + '</div>').remove();
}


function getEdiable(obj, getCommentId, getCommentType) {
	var currentContent = $(obj).html();
	currentContent = currentContent.replace(/<br>/gi,"\n");
	var textarea = '<div><textarea rows="5" cols="40">' + currentContent + '</textarea>';
	var button	 = '<div><input type="image" value="SAVE" class="submitButton" src="/images/user_profile/btn_submit_comment.gif" /> <input type="image" value="SAVE" src="/images/user_profile/btn_cancel_comment.gif" class="cancelButton" /></div></div>';
	var revertHTML = $(obj).html();
	$(obj).after(textarea+button).remove();
	$('.submitButton').click(function(){applyChanges(this, getCommentId, getCommentType, false);});
	$('.cancelButton').click(function(){applyChanges(this, getCommentId, getCommentType, revertHTML);});
}
