function CF_Quote(otextarea, oauthor) {
  var otext = document.getElementById(otextarea);
  var otextCommentArea = document.getElementById("comment");
  if (window.getSelection)
	 var sel = window.getSelection();
  else if (document.getSelection)
	 var sel = document.getSelection();
  else if (document.selection) {
	 var sel = document.selection.createRange().text; }
  if (otext.innerText){
	  if (sel != "") otextCommentArea.value += "<b>" + oauthor + "</b> пишет:\n<blockquote>" + sel + "</blockquote>\n"; 
		else otextCommentArea.value += "<b>" + oauthor + "</b> пишет:\n<blockquote>" + otext.textContent + "</blockquote>\n";
  }
  else { 
	  if (sel != "") otextCommentArea.value += "<b>" + oauthor + "</b> пишет:\n<blockquote>" + sel + "</blockquote>\n"; 
		else otextCommentArea.value += "<b>" + oauthor + "</b> пишет:\n<blockquote>" + otext.textContent + "</blockquote>\n";
  }
  otextCommentArea.focus();
}
function CF_Reply(oauthor) {
  var otextCommentArea = document.getElementById("comment");
  otextCommentArea.value += "<b>@ " + oauthor + "</b>:\n";
  otextCommentArea.focus();
}
	//
    function yus_replyTo(commentID,author) {
		var inReplyTo='@<a href="#comment'+commentID+'">'+author+'<\/a>: ';
    	var myField;
        if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
    		myField = document.getElementById('comment');
    	} else {
    		return false;
    	}
    	if (document.selection) {
    		myField.focus();
    		sel = document.selection.createRange();
    		sel.text = inReplyTo;
    		myField.focus();
    	}
    	else if (myField.selectionStart || myField.selectionStart == '0') {
    		var startPos = myField.selectionStart;
    		var endPos = myField.selectionEnd;
    		var cursorPos = endPos;
    		myField.value = myField.value.substring(0, startPos)
    					  + inReplyTo
    					  + myField.value.substring(endPos, myField.value.length);
    		cursorPos += inReplyTo.length;
    		myField.focus();
    		myField.selectionStart = cursorPos;
    		myField.selectionEnd = cursorPos;
    	}
    	else {
    		myField.value += inReplyTo;
    		myField.focus();
    	}
   	}