// JavaScript Document
function insertText(elname, what) {
	if (document.forms["prispevok"].elements[elname].createTextRange) {
		document.forms["prispevok"].elements[elname].focus();
		document.selection.createRange().duplicate().text = what;
	} else if ((typeof document.forms["prispevok"].elements[elname].selectionStart) != 'undefined') { // for Mozilla
		var tarea = document.forms["prispevok"].elements[elname];
		var selEnd = tarea.selectionEnd;
		var txtLen = tarea.value.length;
		var txtbefore = tarea.value.substring(0,selEnd);
		var txtafter =  tarea.value.substring(selEnd, txtLen);
		var oldScrollTop = tarea.scrollTop;
		tarea.value = txtbefore + what + txtafter;
		tarea.selectionStart = txtbefore.length + what.length;
		tarea.selectionEnd = txtbefore.length + what.length;
		tarea.scrollTop = oldScrollTop;
		tarea.focus();
	} else {
		document.forms["prispevok"].elements[elname].value += what;
		document.forms["prispevok"].elements[elname].focus();
	}
}

