I found a script that is perfect for my need but it is written for forms textareas and I can seem to get it to work textareas that are not wrapped in form.

<script>function insertAtCursor(sTag,eTag)
{
var obj = document.form.message;
var strPos;
var ie_strPos;
var oSel;
obj.focus();

strPos += sTag.length + eTag.length;
ie_strPos += sTag.length + eTag.length;

if (document.selection && document.selection.createRange) { // Internet Explorer
oSel = document.selection.createRange();
if (oSel.parentElement() == obj) {
oSel.text = sTag + oSel.text + eTag;
ie_strPos += oSel.text.length;
}
oSel.moveStart ('character', ie_strPos);
oSel.moveEnd ('character', 0);
oSel.select ();
}

else if (typeof(obj) != "undefined") { // Firefox
var longueur = parseInt(obj.value.length);
var selStart = obj.selectionStart;
var selEnd = obj.selectionEnd;

obj.value = obj.value.substring(0,selStart) + sTag + obj.value.substring(selStart,selEnd) + eTag + obj.value.substring(selEnd,longueur);
strPos += txtarea.value.substring(selStart,selEnd).length;

obj.selectionStart = strPos;
obj.selectionEnd = strPos;
obj.focus ();
}

else obj.value += sTag + eTag;

obj.focus();
} </script>
<button onclick="insertAtCursor('[blah]','[/blah]')">Test</button>
<form method="post" name="form" action="">
<textarea name="message" cols="50" rows="10"></textarea>
</form>

My textarea:
<textarea id="new_topic_text" class="new-topic-subject-text elastic" style="overflow: hidden;"></textarea>