function insertext(open, close, spot){

	// Inlocuiti id_formular cu id-ul formularului si nume_textarea cu numele campului textarea
camp_mesaj = document.forms['id_formular'].elements['nume_textarea'];

if (document.selection && document.selection.createRange){
camp_mesaj.focus();
sel = document.selection.createRange();
sel.text = open + sel.text + close;
camp_mesaj.focus();
}
else if (camp_mesaj.selectionStart || camp_mesaj.selectionStart == '0'){
var startPos = camp_mesaj.selectionStart;
var endPos = camp_mesaj.selectionEnd;
camp_mesaj.value = camp_mesaj.value.substring(0, startPos) + open + camp_mesaj.value.substring(startPos, endPos) + close + camp_mesaj.value.substring(endPos, camp_mesaj.value.length);
camp_mesaj.selectionStart = camp_mesaj.selectionEnd = endPos + open.length + close.length;
camp_mesaj.focus();
}
else {
camp_mesaj.value += open + close;
camp_mesaj.focus();
}
return;
}
