(function(){window.MGJS_CMT={};window.MGJS_CMT.reply=function(c,b,a){c=MGJS.$(c).innerHTML;b='<a href="#'+b+'">@'+c.replace(/\t|\n|\r\n/g,"")+" </a> \n";if(MGJS.$(a)&&MGJS.$(a).type=="textarea"){field=MGJS.$(a);if(field.value.indexOf(b)>-1)alert("You've already appended this reply!");else{field.value=field.value.replace(/\s|\t|\n/g,"")==""?b:field.value.replace(/[\n]*$/g,"")+"\n\n"+b;field.focus()}}else alert("The comment box does not exist!")};window.MGJS_CMT.quote=function(c,b,a,d){c=MGJS.$(c).innerHTML; var e=MGJS.$(a).innerHTML;a='<blockquote cite="#'+a+'">';a+='\n<strong><a href="#'+b+'">'+c.replace(/\t|\n|\r\n/g,"")+"</a> :</strong>";a+=e.replace(/\t/g,"");a+="</blockquote>\n";b=a;if(MGJS.$(d)&&MGJS.$(d).type=="textarea"){field=MGJS.$(d);if(document.selection){field.focus();sel=document.selection.createRange();sel.text=b;field.focus()}else if(field.selectionStart||field.selectionStart=="0"){d=field.selectionStart;a=field.selectionEnd;c=d;field.value=field.value.substring(0,d)+b+field.value.substring(a, field.value.length);c+=b.length;field.focus();field.selectionStart=c;field.selectionEnd=c}else{field.value+=b;field.focus()}}else alert("The comment box does not exist!")}})();
