/* FUNCTIONS FOR ACTION - Comments */

//delete the comment
function fn_CommentDelete(page,linkURL) {
	if (confirm('Are you sure you wish to remove this comment?\n\nNote: Once deleted, it cannot be recovered.')) {
		document.location.href = fn_EncryptURLParamsJS(page, linkURL) + '#comments';
	}
}

//filter the comments
function displayFilter (forceRequery) {
	if (document.cfForm.commentsFilterType.selectedIndex == 0 || forceRequery) {
		//redisplay the comments using the filter	
		document.cfForm.submit();
	} else  {
		//highlight the comments
		var commentDetails = document.getElementsByTagName("span");
		var coachlevelid = document.cfForm.commentsCoachLevelID.options[document.cfForm.commentsCoachLevelID.selectedIndex].value;
		for (var i = 0; i < commentDetails.length; i++) {
			spanID = commentDetails[i].id;
			spanType = spanID.substring(0,7);
			commentLevel = spanID.substring(7,9);
			if (spanType == "comment") {
				if (coachlevelid == "" || commentLevel < coachlevelid) {
					commentDetails[i].className = "";
				} else { 
					commentDetails[i].className = "commentHighlight";
				}
			}
		}
	}
}