function ins(name){
if (document.REPLIER) {
var input=document.REPLIER.Post;
input.value=input.value+"[b]"+name+"[/b]"+" \n";
}
}

function paste(text) {
        if (!text) return;
        t = document.forms['REPLIER'].Post;
        t.focus();
        if (document.selection && document.selection.createRange)
                document.selection.createRange().text = text;
        else if (t.setSelectionRange) {
                var start = t.selectionStart;
                var end = t.selectionEnd;
                var sel1 = t.value.substr(0,start);
                var sel2 = t.value.substr(end);
                t.value = sel1 + text + sel2;
                t.setSelectionRange(start+text.length, start+text.length);
        } else
                t.value += text;
        setTimeout(function(){t.focus();},100);
}
selection = '';

function get_selection() {
        var theSelection = '';
        if (window.getSelection) theSelection = window.getSelection();
        if (document.getSelection) theSelection = document.getSelection();
        if (document.selection && document.selection.createRange) theSelection = document.selection.createRange().text;
        selection = theSelection;
        return theSelection;
}

function Insert(text) {
        if (text)
                paste('[quote]'+text+'[/quote]\n');
        else return;
}

/*function Insert(text){
if (text!="") paste("[quote]"+text+"[/quote]\n", 0);
}

function paste(text, flag){
if (document.REPLIER) {
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;
}       */
