/*
    Comments JS
*/

function insert(text)
{
    var elem = document.comments.comment;

    if (document.selection) {
        elem.focus();
        document.selection.createRange().text = ' ' + text + ' ';
    } else if (typeof eval(elem.selectionStart) != "undefined") {
        var start = elem.value.substring(0, elem.selectionStart);
        var pos   = elem.selectionStart + text.length;
        var end   = elem.value.substring(elem.selectionStart, elem.value.length);

        elem.focus();
        elem.value = start + ' ' + text + ' ' + end;
        elem.selectionEnd = pos;
    } else {
        elem.value += ' ' + text + ' ';
        elem.focus();
    }
}

