//########### Setzt einen URL-Link ein ########################
function hrclink(hrcform) {
      linktext = prompt("Titel des Links:","");
	
      linkurl = prompt("URL des Links:","http://");

	if ((linkurl != null) && (linkurl != "")) {
		if ((linktext != null) && (linktext != ""))
			hrcform.post.value += "[URL="+linkurl+"]"+linktext+"[/URL] ";
		else
			hrcform.post.value += "[URL]"+linkurl+"[/URL] ";
		}
      hrcform.post.focus();
}


//########### Setzt einen Email-Link ein ########################
function hrcemail(hrcform) {
      linkemail = prompt("EMail Adresse eingeben:","");

	if ((linkemail != null) && (linkemail != "")) {
	  hrcform.post.value += "[EMAIL]"+linkemail+"[/EMAIL] ";
       hrcform.post.focus();
      }
}

//########### Text FETT  ########################
function hrcbold(hrcform) {
      boldtext = prompt("Text der FETT formatiert werden soll:","");

	if ((boldtext != null) && (boldtext != "")) {
	  hrcform.post.value += "[b]"+boldtext+"[/b] ";
       hrcform.post.focus();
      }
}

//########### Text Kursiv  ########################
function hrcitalic(hrcform) {
      italictext = prompt("Text der KURSIV formatiert werden soll:","");

	if ((italictext != null) && (italictext != "")) {
	  hrcform.post.value += "[i]"+italictext+"[/i] ";
       hrcform.post.focus();
      }
}

//########### Text Unterstrichen  ########################
function hrcunderlined(hrcform) {
      ultext = prompt("Text der Unterstrichen formatiert werden soll:","");

	if ((ultext != null) && (ultext != "")) {
	  hrcform.post.value += "[u]"+ultext+"[/u] ";
       hrcform.post.focus();
      }
}

//########### Text Zentriert  ########################
function hrccenter(hrcform) {
      centertext = prompt("Text der ZENTRIERT formatiert werden soll:","");

	if ((centertext != null) && (centertext != "")) {
	  hrcform.post.value += "[center]"+centertext+"[/center] ";
       hrcform.post.focus();
      }
}


//########### Bildeinfügen  ########################
function hrcimg(hrcform) {
      imgurl = prompt("URL zum Bild eingeben:","http://");

	if ((imgurl != null) && (imgurl != "")) {
	  hrcform.post.value += "[img]"+imgurl+"[/img] ";
       hrcform.post.focus();
      }
}


//########### Flasheinfügen  ########################
function hrcflash(hrcform) {
      flashwidth = prompt("Breite vom Flash eingeben:","");
      flashheight = prompt("Höhe vom Flash eingeben:","");
      flashurl = prompt("URL zum Flash eingeben:","http://");

	if ((flashurl != null) && (flashurl != "")) {
		if ((flashwidth != null) && (flashwidth != "") && (flashheight != null) && (flashheight != ""))
			hrcform.post.value += "[flash="+flashwidth+"x"+flashheight+"]"+flashurl+"[/flash] ";
		else
			hrcform.post.value += "[flash=100x100]"+flashurlt+"[/flash] ";
		}
      hrcform.post.focus();
}


//########### Smilies einsetzen ####################
function postsmile(code) {
	code = ' ' + code + ' ';
	if (document.pfform.post.createTextRange && document.pfform.post.caretPos) {
		var caretPos = document.pfform.post.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? code + ' ' : code;
		document.pfform.post.focus();
	} else {
	document.message.post.value  += text;
	document.message.post.focus();
	}
}


// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

