<!--
function insertBB(strTxt,strTag,strTag2) {
 var row = false;

 if(!strTxt) {
 if(strTag == 'url') {
    row = prompt('Bitte einen Linkname angeben (optional):\n', '');
    strTxt = prompt('Bitte den Text eingeben, der formatiert werden soll:\n['+strTag+']xxx[\/'+strTag+']', strTag2);
   }
  else if (strTag == 'email') {
   row = prompt('Bitte einen Linkname angeben (optional):\n', '');
   strTxt = prompt('Bitte die Emailadresse hier eingeben:\n['+strTag+']xxx[\/'+strTag+']', strTag2);
  }
 else if (strTag == 'color') {
  row = prompt('Bitte geben sie einen Text ein (optional):\n', '');
  strTxt = prompt('Bitte hier den Farbname bzw. Farbcode eingeben\n['+strTag+'=#FF3300]xxx[\/'+strTag+'] oder ['+strTag+'=red]xxx[\/'+strTag+']', strTag2);
 }
}

if(strTxt=='http://' || null ) return '';
   return '['+ strTag + (row ? '='+ strTxt : '') +']'+ (row ? row : strTxt) +'[\/'+ strTag +']';
  }

function bbcode(strTag,strTag2) {
 var objEditor = document.getElementById('form').text,

 blnIe    = document.selection,
 intStart = objEditor.selectionStart;
  objEditor.focus();

 if(blnIe) {
  var sel = blnIe.createRange();
  sel.text = insertBB(sel.text,strTag,strTag2);
 } 
else if (intStart) {
 intEnd = objEditor.selectionEnd;
 objEditor.value =
  objEditor.value.substring(0,intStart) +
  insertBB( objEditor.value.substring(intStart,intEnd), strTag, strTag2 ) +
  objEditor.value.substring(intEnd,objEditor.value.length);
 }
else
 objEditor.value += insertBB('',strTag,strTag2);
}
//-->
