
function posSpeichern(feld){if(feld.createTextRange)
feld.caretPos=document.selection.createRange().duplicate();}
if(typeof document.selection!='undefined'){}
function addElement(feld,type,code,txt)
{var anfang=(type==false?"["+code+"]":"["+type+'='+code+"]"),ende=(type==false?"[/"+code+"]":"[/"+type+"]");var startText=feld.value.substr(0,feld.selectionStart)+anfang;var endText=ende+feld.value.substr(feld.selectionEnd);if(feld.selectionStart!=undefined)
{if(feld.selectionStart==feld.selectionEnd)
{feld.value=startText+(txt!=false?txt:'')+endText;}
else
{feld.value=startText+feld.value.substring(feld.selectionStart,feld.selectionEnd)+endText;}
var pos=startText.length;feld.selectionStart=pos;feld.selectionEnd=pos;}
else if(feld.createTextRange&&feld.caretPos)
{var caretPos=feld.caretPos;caretPos.text=anfang+(txt==false?caretPos.text:txt)+ende;}
else
{feld.value+=anfang+(txt==false?' ':txt)+ende;var pos=startText.length;feld.selectionStart=pos;feld.selectionEnd=pos;}
feld.focus();}
function code(feld,code,art,beispiel){if((feld.selectionStart!=undefined&&feld.selectionStart>0&&feld.selectionEnd>0&&feld.selectionStart!=feld.selectionEnd)||(feld.createTextRange&&feld.caretPos&&feld.caretPos.text.length>0)){addElement(feld,false,code,false);}else{txt=prompt("Text der "+art+" werden soll.\n["+code+"] "+beispiel+" [/"+code+"]:","");if((txt!=null)&&(txt!="")){addElement(feld,false,code,txt);}}}
function schrift(feld,code,type){if(code=="-"){return;}else{if((feld.selectionStart!=undefined&&feld.selectionStart!=feld.selectionEnd)||(feld.createTextRange&&feld.caretPos&&feld.caretPos.text.length>0)){addElement(feld,type,code,false);}else{txt=prompt("Text eingabe, bei dem die "+type+" geändert werden soll in "+code+":","");if((txt!=null)&&(txt!="")){addElement(feld,type,code,txt);}}}
feld.selectedIndex=0;}
function addTextUrl(feld,code,type){if(code=="-"){return;}else{txt=prompt("Bitte gib die URL ein:","http://");if((txt!=null)&&(txt!="")){addElement(feld,type,txt,feld.value.substr(feld.selectionStart,feld.selectionEnd));}}
feld.selectedIndex=0;}
function clearOptions(){document.forms["fh_form"].elements["attachment_select"].options.length=1;}
function addOption(id,dateiname){var end=dateiname.lastIndexOf('.');if(end<1)return;if(dateiname.substr(end+1)=='gif'||dateiname.substr(end+1)=='jpg'||dateiname.substr(end+1)=='png'){document.forms["fh_form"].elements["attachment_select"].options[document.forms["fh_form"].elements["attachment_select"].length]=new Option(dateiname,'[attachment_'+id+']',false,true);document.forms["fh_form"].elements["attachment_select"].selectedIndex=0;}}
aktuellSize=300;function sizeTextarea(size)
{if((aktuellSize<4000&&size>0)||(aktuellSize>=300&&size<0))
aktuellSize+=size;document.getElementById("nachricht").style.height=aktuellSize+"px";}
aktuellSizeWidth=570;function sizeTextareaWidth(size)
{if((aktuellSizeWidth<850&&size>0)||(aktuellSizeWidth>=570&&size<0))
aktuellSizeWidth+=size;document.getElementById("nachricht").style.width=aktuellSizeWidth+"px";}
