//

// Wordpress Comment Toolbar plugin: Javascript functions

//

// Plugin release:   1.4.2 

// Author:           Cristiano Fino

// WebSite:          http://www.cristianofino.net

//

function CF_Quote(id, oauthor) {

  var otext = document.getElementById('co_' + id);

  var otextCommentArea = document.getElementById("comment");

	

  if (otextCommentArea == null) 

  { 

	alert("WARNING! Add \"ID=\'comment\'\" into the field <textarea name=\'comment\' ...></textarea> in the file \'comment.php\' of your theme.");

	return;

  } 

  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.innerText + "</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(id, oauthor) {

  var otextCommentArea = document.getElementById("comment");

	

  if (otextCommentArea == null) 

  { 

	alert("WARNING! Add \"ID=\'comment\'\" into the field <textarea name=\'comment\' ...></textarea> in the file \'comment.php\' of your theme.");

	return;

  }  

  otextCommentArea.value += "<b>@ " + oauthor + "</b>:\n";

  otextCommentArea.focus();

}



