var theform=this.document.getElementById("formReactie");
function openWindow(url,title,width,height) { 
var url='html/'+url+'.html'; 
window.open(url,title,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+width+",height="+width+""); 
}
function DoPrompt(action){
var code='';
	switch(action){
		case 'url': 
			var url = prompt("Vul hier de url van de webpagina of het emailadres in, bv: http://www.jvd.nl of info@jvd.nl", "");
			var title = prompt("Vul nu de titel van de web-pagina of van het emailadres in. Bijvoorbeeld: JVD Homepage of Email JVD",setPtext());
				if(!(url=="null" || title=="null")){
					
					if(url!='http://' && title!='titel web-pagina' && url!='' && title!=''){
						code = "[URL=" + url + "]" + title + "[/URL]";
						}
					}
				break;
		case 'bold':
			var text = prompt("Vul hier de tekst in die u dikgedrukt wilt hebben.",setPtext());
				if(text!='')code="<B>"+text+"</B>";
				break;
		case 'italics':
			var text = prompt("Vul hier de tekst in die u schuingedrukt wilt hebben.",setPtext());
				if(text != '') code = '<I>'+text+'</I>';
			break;
		case 'underline':
			var text = prompt("Vul hier de tekst in die u onderlijnd wilt hebben.",setPtext());
				if(text != '') code = '<u>'+text+'</u>';
			break;
		case 'image':
			var image = prompt("Vul het complete url in voor het plaatje dat u wilt laten zien.", "http://");
				if(image != "http://")
					code = "[IMG]"+image+"[/IMG]";
				break;
		case 'hr':
			code = "[HR]\n";
			break;
		}
	if(code!="")
		AddText(code);
}
function DoColor(nr){if(nr!="0"){var text=prompt("Vul hier de tekst in die u met deze kleur wilt hebben.",setPtext());if(text!=''){var colorcode="[COLOR="+nr+"]"+text+"[/COLOR]";AddText(colorcode);}return;}}
function DoSmilie(smilie){AddText(smilie);}
function DoFont(nr){if(nr!="0"){var text=prompt("Vul hier de tekst in die u met dit lettertype wilt hebben.",setPtext());if(text!=''){var fontcode="[FONT="+nr+"]"+text+"[/FONT]";AddText(fontcode);}return;}}
function DoSize(nr){if(nr!="0"){var text=prompt("Vul hier de tekst in die u met deze grootte wilt hebben.",setPtext());if(text!=''){var sizecode="[SIZE="+nr+"]"+text+"[/SIZE]";AddText(sizecode);}return;}}
var text='';AddTxt='';
function getActiveText(selectedtext){text=(document.all) ? document.selection.createRange().text : document.getSelection();if(selectedtext.createTextRange){selectedtext.caretPos=document.selection.createRange().duplicate();}return true;}
function AddText(NewCode){var theform=this.document.getElementById("formReactie");if(theform.message.createTextRange && theform.message.caretPos){var caretPos=theform.message.caretPos;caretPos.text=caretPos.text.charAt(caretPos.text.length-1)==' ' ? NewCode + ' ' : NewCode;}else theform.message.value+=NewCode;theform.message.focus();AddTxt = "";}
function setPtext(){if(text){return text;}else{return '';}}
function CheckLength(){if(this.document.form.submit.value=="Bezig.."){return false};var str=new String(this.document.form.message.value);if(str.length>2000){alert('Sorry, uw bericht mag maar max. 2000 tekens lang zijn! Verwijder minimaal '+(str.length-2000)+' tekens.');return false;}else{this.document.form.submit.value="Bezig..";return true;}}

var a=0;var b=0;var c=0;var d=0;
function combo(list){type=new Array('hidden','visible');if(list==0){if(c==0) myFunc('menu').innerHTML=writeSmilies();c=1;b=0;a=(a==0)? 1 : 0;}else{if(d==0) myFunc('menu2').innerHTML=writeCodes();d=1;a=0;b=(b==0)? 1 : 0;}myFunc('menu').style.visibility=type[a];myFunc('menu2').style.visibility=type[b];}
function myFunc(elemID){var obj;if(document.all){obj=document.all(elemID);}else if(document.getElementById){obj=document.getElementById(elemID);}else if(document.layers){obj=document.layers[elemID];}return obj;}
function writeSmilies() {
  var content = '<TABLE ALIGN="center" BGCOLOR="'+bgcolorBar+'" BORDER="0" WIDTH="'+width+'" CELLPADDING="3" CELLSPACING="0" STYLE="border-width:0px 1px 1px 1px;border-style:solid;border-color:#000000;"><TR><TD vALIGN="top" ALIGN="left" CLASS="msg">';
  var smilies = new Array(':confused:',':cool:',':eek:',':(',':mad:',':)',':P',';)');
  var name = new Array('confused','cool','eek','frown','mad','smile','tongue','wink');
  for(var i=0;i<smilies.length;i++) {
    content += '<A HREF="javascript:void(0);" onClick="DoSmilie(\' '+smilies[i]+' \');"><IMG SRC="'+base_url+'/images/smilies/'+name[i]+'.gif" BORDER="0"></a> ';
  }
  content += '</TD></TR></TABLE>';
  return content;
}

function writeCodes() {
  return '<TABLE ALIGN="center" BGCOLOR="'+bgcolorMessage+'" BORDER="0" WIDTH="'+width+'" CELLPADDING="3" CELLSPACING="0" STYLE="border-width:0px 1px 1px 1px;border-style:solid;border-color:#000000;"><TR><TD vALIGN="top" ALIGN="left"><A HREF="javascript:void(0);" onClick="DoPrompt(\'url\');"><IMG SRC="'+base_url+'/images/url.gif" WIDTH="42" height="13" BORDER="0" ALT="URL-link toevoegen"></a><A HREF="javascript:void(0);" onClick="DoPrompt(\'hr\');"><IMG SRC="'+base_url+'/images/hr.gif" WIDTH="42" height="13" BORDER="0" ALT="Lijn toevoegen"></a><A HREF="javascript:void(0);" onClick="DoPrompt(\'bold\');"><IMG SRC="'+base_url+'/images/bold.gif" WIDTH="42" height="13" BORDER="0" ALT="Dikgedrukte zin toevoegen"></a> <A HREF="javascript:void(0);" onClick="DoPrompt(\'italics\');"><IMG SRC="'+base_url+'/images/italic.gif" WIDTH="42" height="13" BORDER="0" ALT="Schuingedrukte zin toevoegen"></a> <A HREF="javascript:void(0);" onClick="DoPrompt(\'image\');"><IMG SRC="'+base_url+'/images/image.gif" WIDTH="42" height="13" BORDER="0" ALT="Plaatje toevoegen"></a> <BR><select id="colorselect" onchange="DoColor(value);" NAME="colorselect" STYLE="font-size:10px"><option VALUE="0">Kleur</option><option VALUE="skyblue" style="color:skyblue">sky blue</option><option VALUE="royalblue" style="color:royalblue">royal blue</option><option VALUE="blue" style="color:blue">blue</option><option VALUE="darkblue" style="color:darkblue">dark-blue</option><option VALUE="orange" style="color:orange">orange</option><option VALUE="orangered" style="color:orangered">orange-red</option><option VALUE="crimson" style="color:crimson">crimson</option><option VALUE="red" style="color:red">red</option><option VALUE="firebrick" style="color:firebrick">firebrick</option><option VALUE="darkred" style="color:darkred">dark red</option><option VALUE="green" style="color:green">green</option><option VALUE="limegreen" style="color:limegreen">limegreen</option><option VALUE="seagreen" style="color:seagreen">sea-green</option><option VALUE="deeppink" style="color:deeppink">deeppink</option><option VALUE="tomato" style="color:tomato">tomato</option><option VALUE="coral" style="color:coral">coral</option><option VALUE="purple" style="color:purple">purple</option><option VALUE="indigo" style="color:indigo">indigo</option><option VALUE="burlywood" style="color:burlywood">burlywood</option><option VALUE="sandybrown" style="color:sandybrown">sandy brown</option><option VALUE="sienna" style="color:sienna">sienna</option><option VALUE="chocolate" style="color:chocolate">chocolate</option><option VALUE="teal" style="color:teal">teal</option><option VALUE="silver" style="color:silver">silver</option></select> <select name="font" onChange="DoFont(value);" STYLE="font-size:10px"><option VALUE="0">Lettertype</option><option VALUE="arial">Arial</option><option VALUE="times new roman">Times N. Rom.</option><option VALUE="tahoma">Tahoma</option></select> <select name="SIZE" onChange="DoSize(value);" STYLE="font-size:10px"><option VALUE="0">Grootte</option><option VALUE="1">1</option><option VALUE="2">2</option><option VALUE="3">3</option><option VALUE="4">4</option><option VALUE="5">5</option><option VALUE="6">6</option><option VALUE="7">7</option></select></TD></TR></TABLE>';
}