var selection='';function Insert(qname,text){if (text!=""){ qname=qname.replace(/[\[\]]/g, "|"); paste("[quote="+qname+"]"+text+"[/quote]\n", 0);} else {alert('Необходимо выделить текст для цитирования.');}} function paste(text,flag){if ((document.selection)&&(flag)) {document.addform.message.focus();document.addform.document.selection.createRange().text = text;} else document.addform.message.value += text;}function get_selection() {if (window.getSelection){selection = window.getSelection();selection = selection.replace(/\r\n\r\n/gi, "_doublecaret_"); selection = selection.replace(/\r\n/gi, " "); while (selection.indexOf(" ") !=-1) selection = selection.replace(/ /gi, ""); selection = selection.replace(/_doublecaret_/gi, "\r\n\r\n"); } else selection = document.selection.createRange().text; }
