function insert_at_cursor(inputid, text) {
	e = document.getElementById('editarea_'+inputid);
	if (document.selection) {
		//IE support
		e.focus();
		//in effect we are creating a text range with zero
		//length at the cursor location and replacing it
		//with text
		sel = document.selection.createRange();
		sel.text = text;
	} else if (e.selectionStart || e.selectionStart == '0') {
		////Mozilla/Firefox/Netscape 7+ support

		//Here we get the start and end points of the
		//selection.
		var startPos = e.selectionStart;
		var endPos = e.selectionEnd;
		e.value = e.value.substring(0, startPos)+ text+ e.value.substring(endPos, e.value.length);
	} else {
		e.value += text;
	}
} 
