// edycja w textarea

function wstaw(co) {
//	xx=document.forms['formularz'];
	xx=document.getElementById? document.getElementById("eumoto") : document.all.eumoto
	if (co=="b") text='<b>'+document.selection.createRange().text+'</b>';
	if (co=="i") text='<i>'+document.selection.createRange().text+'</i>';
	if (co=="u") text='<u>'+document.selection.createRange().text+'</u>';
	if (co=="f") text='<font color="#008000">'+document.selection.createRange().text+'</font>';
	if (co=="a") text='<a href="">'+document.selection.createRange().text+'</a>';
	if (co=="img") text='<img src="" border="1" align="left">';
	if (co=="br") text='<br>';
	if (co=="s") text='&nbsp;';

	if (xx.tresc.createTextRange && xx.tresc.caretPos) {
		var caretPos = xx.tresc.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		xx.tresc.focus();
	} else {
	xx.tresc.value  += text;
	xx.tresc.focus();
//	document.formularz.tresc.value  += text;
//	document.formularz.tresc.focus();
	}
}

function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}