function insertFormat(format, target)
{
var insert = '';
if (!target) 
{
target = 'comment_text';
}

switch(format)
{
case 'url':
var url = prompt("Enter the address of the web page you are linking", "http://");
var title = prompt("Enter the title of the web page you are linking.  For example, if you entered http://schinkengriller.de, you might use 'Schinkengriller'.", url);
insert = "[url="+url+"]"+title+"[/url]";
break;

case 'email':
var email = prompt("Enter the complete email address (someone@somewhere.com) that you wish to add.", "");
var title = prompt("Enter the title of the email address that you wish to add. For example, if you entered webmaster@schinkengriller.de, you might use 'Schinkengriller-Webmaster'.", email);
insert = "[email="+email+"]"+title+"[/email]";
break;

case 'image':
var image = prompt("Enter the complete URL for the image you wish to display.", "http://");
insert = "[img]"+image+"[/img]";
break;

case 'underline':
var underline = prompt("Enter the text that you wish to underline.", "");
insert = "[u]"+underline+"[/u]";
break;

case 'bold':
var bold = prompt("Enter the text that you wish to make bold.", "");
insert = "[b]"+bold+"[/b]";
break;

case 'italics':
var italics = prompt("Enter the text that you wish to italicize.", "");
insert = "[i]"+italics+"[/i]";
break;

case 'quote':
insert = "\n[quote]\n\n[/quote]";
break;

case 'code':
insert = "\n[code]\n\n[/code]";
break;

}
document.getElementById(target).value += insert;
document.getElementById(target).focus();
}

function insertSmilie(smily, target)
{
var insert = '';
if (!target) 
{
target = 'text';
}
insert = "[smilie]"+smily+"[/smilie]";
document.getElementById(target).value += insert;
document.getElementById(target).focus();
}