// ***
// This script assumes that your targetfield is 'bericht'

// TEXT FOR POP-UP PROMPTS
tag_prompt = "Voer de tekst in die je wilt opmaken:";

link_text_prompt = "Voer de tekst in die voor deze link wordt getoond (optioneel)";
link_url_prompt = "Voer de volledige URL in voor deze link";
link_email_prompt = "Voer het e-mail adres voor deze link in";

list_type_prompt = "Wat voor opsomming wil je? Voer '1' in om een genummerde opsomming te krijgen, voer 'a' voor een alfabetische opsomming, of voer niks in om een opsomming te krijgen waarvan de items door een symbool voorafgegaan worden.";
list_item_prompt = "Voer een item voor de opsomming in.\nVoer niets in of kies 'Cancel' om de opsomming af te sluiten.";

// ***

function namedlink(theform,thetype) {
// inserts named url or email link - [url=mylink]text[/url]
	linktext = prompt(link_text_prompt,"");
		var prompttext;
		if (thetype == "URL") {
			prompt_text = link_url_prompt;
			prompt_contents = "http://";
			}
		else {
			prompt_text = link_email_prompt;
			prompt_contents = "";
			}
	linkurl = prompt(prompt_text,prompt_contents);
	if ((linkurl != null) && (linkurl != "")) {
		if ((linktext != null) && (linktext != ""))
			theform.bericht.value += "["+thetype+"="+linkurl+"]"+linktext+"[/"+thetype+"] ";
		else
			theform.bericht.value += "["+thetype+"]"+linkurl+"[/"+thetype+"] ";
		}
	theform.bericht.focus();
}


function customCode(theform,customCode,prompttext) {
// insert [x]yyy[/x] style markup
	if ((customCode=="B") || (customCode=="I") || (customCode=="IMG") || ((customCode=="QUOTE")))  {
		inserttext = prompt(tag_prompt+"\n["+customCode+"]xxx[/"+customCode+"]",prompttext);
		if ((inserttext != null) && (inserttext != ""))
			theform.bericht.value += "["+customCode+"]"+inserttext+"[/"+customCode+"] ";
		}
	theform.bericht.focus();
}

function dolist(theform) {
// inserts list with option to have numbered or alphabetical type
	listtype = prompt(list_type_prompt, "");
	if ((listtype == "a") || (listtype == "1")) {
		thelist = "[list="+listtype+"]\n";
		listend = "[/list="+listtype+"] ";
		}
	else {
		thelist = "[list]\n";
		listend = "[/list] ";
		}
	listentry = "initial";
	while ((listentry != "") && (listentry != null)) {
		listentry = prompt(list_item_prompt, "");
		if ((listentry != "") && (listentry != null))
			thelist = thelist+"[*]"+listentry+"\n";
		}
	theform.bericht.value += thelist+listend;
	theform.bericht.focus();
}
