function bb_pic() {
url=prompt("Bitte gebe die URL des Bildes ein","http://");
if(url!=null&&url!=""&&url!="http://") {
document.forms[0].text.value=document.forms[0].text.value + "[img]" + url + "[/img]";}
document.forms[0].text.focus();
}

function bbcode(v)
 {
 if (document.selection) // für IE
   {
    var str = document.selection.createRange().text;
    document.formular.text.focus();
    var sel = document.selection.createRange();
    sel.text = "[" + v + "]" + str + "[/" + v + "]";
    return;
   }
  else if (document.getElementById && !document.all) // für Mozilla
   {
    var txtarea = document.forms['formular'].elements['text'];
    var selLength = txtarea.textLength;
    var selStart = txtarea.selectionStart;
    var selEnd = txtarea.selectionEnd;
    if (selEnd == 1 || selEnd == 2)
    selEnd = selLength;
    var s1 = (txtarea.value).substring(0,selStart);
    var s2 = (txtarea.value).substring(selStart, selEnd)
    var s3 = (txtarea.value).substring(selEnd, selLength);
    txtarea.value = s1 + '[' + v + ']' + s2 + '[/' + v + ']' + s3;
    return;
   }
  else input('[' + v + '][/' + v + '] ');
 }

function input(what)
 {
  if (document.formular.text.createTextRange)
   {
    document.formular.text.focus();
    document.selection.createRange().duplicate().text = what;
   }
  else if (document.getElementById && !document.all) // Mozilla
   {
    var tarea = document.forms['formular'].elements['text'];
    var selEnd = tarea.selectionEnd;
    var txtLen = tarea.value.length;
    var txtbefore = tarea.value.substring(0,selEnd);
    var txtafter =  tarea.value.substring(selEnd, txtLen);
    tarea.value = txtbefore + what + txtafter;
   }
  else
   {
    document.entryform.text.value += what;
   }
 }
 
// smielies im popup 
function opensmiliewindow(x,y,sessionhash) 
	{
// um... opens smilie overflow window.
		window.open("smilies.php"+sessionhash, "smilies", "toolbar=no,scrollbars=yes,resizable=yes,width="+x+",height="+y);
	}

// flagen im popup 
function openflagwindow(x,y,sessionhash) 
	{
// um... opens smilie overflow window.
		window.open("flags.php"+sessionhash, "smilies", "toolbar=no,scrollbars=yes,resizable=yes,width="+x+",height="+y);
	}

//schrft größe
function groesse() {
i = document.formular.gross.selectedIndex;
gr = document.formular.gross[i].value;
document.formular.text.value+=gr;
}

//farbe wählen
function farbe() {
i = document.formular.farb.selectedIndex;
gr = document.formular.farb[i].value;
document.formular.text.value+=gr;
}

function maps() {
i = document.formular.map.selectedIndex;
gr = document.formular.map[i].value;
document.formular.text.value+=gr;
}