// BB-Code
function bb_br(wo) {
	output = "[NEUEZEILE]";
	insertAtCursor(wo, output);
}
function bb_pic(wo) {
url=prompt("Bitte gebe die URL des Bildes ein","http://");
if(url!=null&&url!=""&&url!="http://") {
	output = "[IMG]" + url + "[/IMG]";
	insertAtCursor(wo, output);
	}
}
function bb_italic(wo) {
eingabe=prompt("Bitte gebe den Text ein, der kursiv erscheinen soll","");
if(eingabe!=null&&eingabe!="") {
	output = "[I]" + eingabe + "[/I]";
	insertAtCursor(wo, output);
	}
}
function bb_mail(wo) {
mail=prompt("Bitte gebe die Mailadresse ein","");
if(mail!=null&&mail!="") {
	output = "[EMAIL]" + mail + "[/EMAIL]";
	insertAtCursor(wo, output);
	}
}
function bb_under(wo) {
text=prompt("Bitte gebe den Text ein, der unterstrichen erscheinen soll","");
if(text!=null&&text!="") {
	output = "[U]" + text + "[/U]";
	insertAtCursor(wo, output);
	}
}
function bb_url(wo) {
url=prompt("Bitte gebe die URL ein","http://");
if(url!=""&&url!=null&&url!="http://") {
	output = "[URL]" + url + "[/URL]"
	insertAtCursor(wo, output);
	}
}
function bb_b(wo) {
eingabe=prompt("Bitte gebe den Text ein, der fett erscheinen soll","");
if(eingabe!=null&&eingabe!="") {
	output = "[B]" + eingabe + "[/B]";
	insertAtCursor(wo, output);
	}
}

// Smilies
function smilie(smilietext) {
eintrag.value=eintr.eintrag.value + " "+smilietext+" ";
eintrag.focus();
}

function insertAtCursor(wo, was) {
            wo = document.getElementById(wo)
            
            //IE
            if (document.selection) {
                wo.focus()
                sel = document.selection.createRange()
                sel.text = was
            }
            //MOZILLA/NETSCAPE
            else if (wo.selectionStart || wo.selectionStart == '0') {
                var startPos = wo.selectionStart
                var endPos = wo.selectionEnd
                wo.value = wo.value.substring(0, startPos)
                        + was
                        + wo.value.substring(endPos, wo.value.length)
            } else {
                wo.value += was
            }
            wo.focus()
        }