function x () {
return;
}

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

function insertAtCaret (textEl, text) {
	if (textEl.createTextRange && textEl.caretPos) {
		var caretPos = textEl.caretPos;
		caretPos.text =
			caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
			text + ' ' : text;
	} else {
		textEl.value  = textEl.value + text; // for non MSIE browsers just append it
	}

	return true;
}// fn




function DoSmilie(addSmilie) {
	var revisedMessage;
	var currentMessage = document.formularz_posta.tresc.value;
	revisedMessage = currentMessage+addSmilie;
	document.formularz_posta.tresc.value=revisedMessage;
	document.formularz_posta.tresc.focus();
	return;
}

function DoColor(color) {

	insertAtCaret(document.formularz_posta.tresc, ' ' + "[kolor:" +color + "]  [/kolor]" + ' ' );
	document.formularz_posta.tresc.focus();
	return;
	
}

	function DoPrompt(action) {
		var currentMessage = document.formularz_posta.tresc.value;

		if (action == "url") {
			var thisURL = prompt("Wprowadź pełny adres URL do odnośnika którego chcesz dodać.", "http://");
			if (thisURL == null){return;}

			var thisTitle = prompt("Wprowadź nazwę (tekst który się pojawi na ekranie).", "jakiś tekst");
			if (thisTitle == null){return;}

			insertAtCaret(document.formularz_posta.tresc, ' ' + "<a target=_blank href=" + thisURL + ">" + thisTitle + "</a>" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

                if (action == "color") {
                  var thisColor = prompt("Wprowad nazwę (np: red, blue) lub definicję (np: #ff1123) koloru.","");
                  if (thisColor == null) {return; }
                  insertAtCaret(document.formularz_posta.tresc, ' ' + "[kolor:" + thisColor + "] [/kolor] ");
                  document.formularz_posta.tresc.focus();
                  return;
                }

		if (action == "email") {
			var thisEmail = prompt("Wprowadź pełny adres mailowy.", "");
			if (thisEmail == null){return;}

			insertAtCaret(document.formularz_posta.tresc, ' ' + "<a href=mailto:" + thisEmail + ">" + thisEmail + "</a>" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

		if (action == "bold") {
			var thisBold = prompt("Wprowad tekst który będzie pogrubiony.", "");
			if (thisBold == null){return;}

			insertAtCaret(document.formularz_posta.tresc, ' ' + "[b]" + thisBold + "[/b]" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

		if (action == "italics") {
			var thisItal = prompt("Wprowad tekst który będzie pochylony.", "");
			if (thisItal == null){return;}

			insertAtCaret(document.formularz_posta.tresc, ' ' + "[i]" + thisItal + "[/i]" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

		if (action == "image") {
			var thisImage = prompt("Wprowad pełny adres URL obrazka który chcesz wywietlić.", "http://");
			if (thisImage == null){return;}

			insertAtCaret(document.formularz_posta.tresc, ' ' + "[image]" + thisImage + "[/image]" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

		if (action == "quote") {
			insertAtCaret(document.formularz_posta.tresc, ' ' + "[quote]  [/quote]" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

		if (action == "code") {
			insertAtCaret(document.formularz_posta.tresc, ' ' + "[code]  [/code]" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

		if (action == "liststart") {
			insertAtCaret(document.formularz_posta.tresc, ' ' + "[list]" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

		if (action == "listend") {
			insertAtCaret(document.formularz_posta.tresc, ' ' + "[/list]" + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

		if (action == "listitem") {
			var thisItem = prompt("Enter the new list item.  Note that each list group must be preceded by a List Start and the entire list group must end with a List End (in order to display properly).", "");

			if (thisItem == null){return;}

			insertAtCaret(document.formularz_posta.tresc, ' ' + "[*]" + thisItem + ' ' );
			document.formularz_posta.tresc.focus();
			return;
		}

// -->


	}
