function jsEncode(str){str=" "+str;var aStr=str.split(''),i=aStr.length,aRet=[];while(--i){var iC=aStr[i].charCodeAt();if(iC<65||iC>127||(iC>90&&iC<97)){aRet.push('&#'+iC+';');}else{aRet.push(aStr[i]);}}
return aRet.reverse().join('');}
function quote(postid,author,commentarea,commentID,mce){try{var posttext='';if(window.getSelection){posttext=window.getSelection();}
else if(document.getSelection){posttext=document.getSelection();}
else if(document.selection){posttext=document.selection.createRange().text;}
else{return true;}
if(posttext==''){var selection=false;var commentID=commentID.split("div-comment-")[1];var theQuote="q-"+commentID;var posttext=document.getElementById(theQuote).innerHTML;var posttext=posttext.replace(/<div(.*?)>((.|\n)*?)(<\/div>)/ig,"");var posttext=posttext.replace(/<blockquote(.*?)>((.|\n)*?)(<\/blockquote>)/ig,"");var posttext=posttext.replace(/<blockquote(.*?)>((.|\n)*?)(<\/blockquote>)/ig,"");var posttext=posttext.replace(/\s\s/gm,"");var posttext=posttext.replace(/	/g,"");var posttext=posttext.replace(/<p>/g,"");var posttext=posttext.replace(/<\/\s*p>/g,"\n\n");var posttext=posttext.replace(/<br>/g,"")
var posttext=posttext.replace(/&nbsp;/g," ");var posttext=posttext.replace(/<span(.*?)>((.|\n)*?)(<\/span>)/ig,"");while(posttext!=(posttext=posttext.replace(/<blockquote>[^>]*<\/\s*blockquote>/g,"")));var posttext=posttext.replace(/<a class="comment_quote_link"(.*?)>((.|\n)*?)(<\/a>)/ig,"");var posttext=posttext.replace(/<a class="comment_reply_link"(.*?)>((.|\n)*?)(<\/a>)/ig,"");}
if(author){author=jsEncode(author);var quote='\n<blockquote cite="comment-'+postid+'">\n\n<strong><a href="#comment-'+postid+'">'+unescape(author)+'</a></strong>: '+posttext+'</blockquote>\n';}else{var quote='\n<blockquote cite="comment-'+postid+'">\n\n'+posttext+'</blockquote>\n';}
if(mce==true){insertHTML(quote);insertHTML("<p>&nbsp;</p>");}else{var comment=document.getElementById(commentarea);addQuote(comment,quote);}
return false;}catch(e){alert("Quote Comments plugin is having some trouble! It could possibly be a problem with your Wordpress theme. Does it work if you use the default theme? Does it work if you disable all other plugins? If you look in the HTML source of a page with comments, can you find <div id='q-[id]'> where [id] is the ID of the comment?")}}
function inlinereply(postid,author,commentarea,commentID,mce){try{author=jsEncode(author);var quote='\n<strong><a href="#comment-'+postid+'">'+unescape(author)+'</a></strong>, \n\n';if(mce==true){insertHTML(quote);insertHTML("<p>&nbsp;</p>");}else{var comment=document.getElementById(commentarea);addQuote(comment,quote);}
return false;}catch(e){alert("Quote Comments plugin is having some trouble! It could possibly be a problem with your Wordpress theme. Does it work if you use the default theme? Does it work if you disable all other plugins? If you look in the HTML source of a page with comments, can you find <div id='q-[id]'> where [id] is the ID of the comment?")}}
function addQuote(comment,quote){if(document.selection){comment.focus();sel=document.selection.createRange();sel.text=quote;comment.focus();}
else if(comment.selectionStart||comment.selectionStart=='0'){var startPos=comment.selectionStart;var endPos=comment.selectionEnd;var cursorPos=endPos;var scrollTop=comment.scrollTop;if(startPos!=endPos){comment.value=comment.value.substring(0,startPos)+quote+comment.value.substring(endPos,comment.value.length);cursorPos=startPos+quote.length}
else{comment.value=comment.value.substring(0,startPos)+quote+comment.value.substring(endPos,comment.value.length);cursorPos=startPos+quote.length;}
comment.focus();comment.selectionStart=cursorPos;comment.selectionEnd=cursorPos;comment.scrollTop=scrollTop;}
else{comment.value+=quote;}
try{ReloadTextDiv();}
catch(e){}}
