function ins(name){
var input=document.REPLIER.Post;
input.value=input.value+"[b]"+name+"[/b]"+" \n";
}

function Insert(text){
if (text!="") paste("[QUOTE]"+text+"[/QUOTE]\n", 0);
 }
function InsertQ(text){
  if (text !="") document.REPLIER.Post.value = document.REPLIER.Post.value + "[QUOTE]" + text + "[/QUOTE]\n";
}

function paste(text, flag){ 
if ((document.selection)&&(flag)) {
        document.REPLIER.Post.focus();
        document.REPLIER.document.selection.createRange().text = text;
} else document.REPLIER.Post.value += text;
}

function get_selection() {
   if (document.getSelection){
        selection = document.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;
}

