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){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("q-")[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="bbpress_quotes__link"(.*?)>((.|\n)*?)(<\/a>)/ig,"");}
author=jsEncode(author);var quote='\n<blockquote cite="comment-'+postid+'">\n\n<strong><a href="#comment-'+postid+'">'+unescape(author)+'</a></strong>: '+posttext+'</blockquote>\n';var comment=document.getElementById(commentarea);addQuote(comment,quote);return false;}catch(e){alert("Uh Oh! Something went wrong!")}}
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("Uh Oh! Something went wrong!")}}
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){}}
