(function(){namespace='cmSSS';if(!window[namespace])window[namespace]={};window[namespace]['reply']=reply;window[namespace]['quote']=quote;function $(id){return document.getElementById(id)}function reply(authorId,commentId,commentBox){var author=$(authorId).innerHTML;var insertStr='<a href="#'+commentId+'">@'+author.replace(/\t|\n|\r\n/g,"")+':</a> \n';insertComment(insertStr,commentBox);return false}function quote(authorId,commentId,commentBodyId,commentBox){var author=$(authorId).innerHTML;var comment=$(commentBodyId).innerHTML;var insertStr='<blockquote cite="#'+commentBodyId+'">\n<a href="#'+commentId+'">'+author.replace(/\t|\n|\r\n/g,"")+'</a> :\n'+comment.replace(/\t/g,"")+'</blockquote>\n';insertComment(insertStr,commentBox);return false}function insertComment(insertStr,commentBox){if($(commentBox)&&$(commentBox).type=='textarea'){field=$(commentBox)}else{alert("The comment box does not exist!");return false}if(document.selection){field.focus();sel=document.selection.createRange();sel.text=insertStr;field.focus()}else if(field.selectionStart||field.selectionStart=='0'){var startPos=field.selectionStart;var endPos=field.selectionEnd;var cursorPos=startPos;field.value=field.value.substring(0,startPos)+insertStr+field.value.substring(endPos,field.value.length);cursorPos+=insertStr.length;field.focus();field.selectionStart=cursorPos;field.selectionEnd=cursorPos}else{field.value+=insertStr;field.focus()}}})();