function storeCursor(element)
{
	if ( document.all && element.createTextRange )
		element.cursorPos = document.selection.createRange().duplicate();
}

function emoticon( text )
{
	var target = document.getElementById( "bericht" );
	var text = ' ' + text + ' ';
	if ( target )
	{
		if ( document.all && target.cursorPos)
		{
			var cursorPos = target.cursorPos;
			cursorPos.text = cursorPos.text.charAt(cursorPos.text.length - 1) == ' ' ? text + ' ' : text;
			target.focus();
		}
		else
		{
			target.value += text;
			target.focus();
		}
	}
}
