function addTag (tag)  {
	document.getElementById ('bericht').focus ();
	selectedString = document.selection.createRange().text;
	if (selectedString != "")  {
		replaceString = "[" + tag + "]" + selectedString + "[/" + tag+ "]";
		document.selection.createRange().text = replaceString;
	}
}

function addLink ()  {
	document.getElementById ('bericht').focus ();
	selectedString = document.selection.createRange().text;
	if (selectedString != "")  {
		url = prompt ("Geef een url op:", "http://");
		if (url.substring (0, 7) != "http://")
			url = "http://" + url;
		replaceString = "[a " + url + "]" + selectedString + "[/a]";
		document.selection.createRange().text = replaceString;
	}
}

function addMailLink ()  {
	document.getElementById ('bericht').focus ();
	selectedString = document.selection.createRange().text;
	if (selectedString != "")  {
		email = prompt ("Geef een emailadres op:", "");
		if (email.substring (0, 9) == "mailto://")
			email = email.substring (9);
		replaceString = "[m " + email + "]" + selectedString + "[/m]";
		document.selection.createRange().text = replaceString;
	}
}

function addSmiley (text)  {
	var boodschapVeld = document.getElementById ('bericht');
	boodschapVeld.value = boodschapVeld.value + text;
}
