// JavaScript Document
<!--

	function fromHTMLtoXML(val)
	{
		val = val.replace(/&amp;/g,'%26'); 
		val = val.replace(/&lt;/g,'%3C');
		val = val.replace(/&gt;/g,'%3E');
		val = val.replace(/&nbsp;/g,'%20');
		val = val.replace(/&shy;/g,'%20');
		return val;
	}
	

function modalDialogNieuwsItemShowGastenboek(val) //IE
{
	//alert(val);
	if(navigator.appName.indexOf('Microsoft')!=-1)
	 window.showModalDialog("gastenboek/addgastenboek.php?event_id=" + val,window,
		"dialogWidth:500px;dialogHeight:600px;edge:Raised;center:Yes;help:No;Resizable:no;Maximize:no");
	else
      window.open("gastenboek/addgastenboek.php?event_id=" + val, "" , "width=500px,height=600");
}

function modalDialogShowGastenboek() //IE
{
	if(navigator.appName.indexOf('Microsoft')!=-1)
	 window.showModalDialog("scripts/gastenboek/addgastenboek.php" ,window,
		"dialogWidth:500px;dialogHeight:600px;edge:Raised;center:Yes;help:No;Resizable:no;Maximize:no");
	else
      window.open("scripts/gastenboek/addgastenboek.php", "" , "width=500px,height=600");
}


function handleInsertResponse() {    
  if (http.readyState == 4) 
  { 
    if(http.status==200) 
    { 
    var results=http.responseText;
    //self.status = results;
    //alert(results);
    alert ('Bedankt voor uw bericht. \nNadat de inhoud gecontroleerd is zal deze al dan niet op de website geplaatst worden. \nM.v.g. Judo Essink Support');
		self.close();
		}	
	}
} 
	
	function saveGastenboekRecord(val) { 
	  //alert(val);
		var url = "gastenboek_insert.php"; // The server-side script 
		$titel = fromHTMLtoXML (document.getElementById ('titel').value);
		if ($titel=='') 
		{
			alert ('Titel moet ingevuld zijn!');
			document.getElementById ('titel').focus();
			return;
		}
		//$tekst = fromHTMLtoXML (document.getElementById ('tekst').value);
		$tekst = fromHTMLtoXML (edtVerslag.getHTMLBody());

		if ($tekst=='') 
		{
			alert ('Tekst moet ingevuld zijn!');
			document.getElementById ('tekst').focus();
			return;
		}
		$email = fromHTMLtoXML(document.getElementById ('email').value);
		if (document.getElementById ('email'))
		var param = 'titel=' + $titel + '&tekst=' + $tekst + '&email_adres=' + $email;
		if (val != '') {
		param = param + '&event_id=' + val;
		}
		http.open("POST", url, false); 
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=utf-8');
		http.onreadystatechange = handleInsertResponse; 
		//alert(param);
		http.send(param); 
	}
		
	function getHTTPObject() { 
	var xmlhttp; 

	if(window.XMLHttpRequest){ 
	  xmlhttp = new XMLHttpRequest(); 
	} 
	else if (window.ActiveXObject){ 
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
	  if (!xmlhttp){ 
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	  } 
	} 
	return xmlhttp; 
	} 
	
var http = getHTTPObject(); // We create the HTTP Object 
