var replyuids = new Array();
function replyComment(cid,uid,nick) {
	var com_textarea = $('commenttext');
	if(com_textarea ) {
		if(com_textarea.value.indexOf('@' + nick + ':') == -1){
			replyuids[uid] = 1;
			com_textarea.focus();
			if (document.selection) {
				sel = document.selection.createRange();
				sel.text = '@' + nick + ': ';
			}
			else if(com_textarea.selectionStart || com_textarea.selectionStart == '0') {
				var startPos = com_textarea.selectionStart;
				var endPos = com_textarea.selectionEnd;
				com_textarea.value = com_textarea.value.substring(0,startPos) + '@' + nick + ': ' + com_textarea.value.substring(endPos,com_textarea.value.length);
			}
			else com_textarea.value += '@' + nick + ': ';

			var commentReplies = $('replies');

			if(commentReplies){
				if(commentReplies.value == "") commentReplies.value = '' + cid + ':' + uid;
				else commentReplies.value += ',' + cid + ':' + uid;
			}
		}
		else com_textarea.focus();
	}
}
