function saveData(){
	htmlRequest = ajaxFunction();
	if (htmlRequest==null){ // If it cannot create a new Xmlhttp object.
		alert ("Browser does not support HTTP Request");
		return;
	} 

	if(document.shoutbox.shouter.value == "" || document.shoutbox.shouter.value == "NULL" || document.shoutbox.shouter_comment.value == "" || document.shoutbox.shouter_comment.value == "NULL"  || document.shoutbox.shouter_contact.value == "" || document.shoutbox.shouter_contact.value == "NULL"){
		alert('U dient een naam en een bericht achter te laten in de shoutbox!');
		return;
	}


	htmlRequest.open('POST', 'sendshout.php');
	htmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	htmlRequest.send('name='+document.shoutbox.shouter.value+'&message='+document.shoutbox.shouter_comment.value+'&contact='+document.shoutbox.shouter_contact.value); 

	document.shoutbox.shouter_comment.value = ''; // Updates the shout box’s text area to NULL.
	document.shoutbox.shouter_comment.focus(); // Focuses the text area.

} 

function ajaxFunction(){
	var ajaxRequest;

	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				//browsers all not support, rare case
				alert("Gebruik een andere browser bijvoorbeeld Firefox (gratis) www.mozilla.org");
				return false;
			}
		}

	}
	return ajaxRequest;
}

function showData() {
	htmlRequest = ajaxFunction();
	if (htmlRequest==null){ // If it cannot create a new Xmlhttp object.
		alert ("Browser biedt geen support HTTP Request, download Firefox www.mozilla.org");
		return;
	} 

	htmlRequest.onreadystatechange = function(){
		if(htmlRequest.readyState == 4){
			document.getElementById("shoutarea").innerHTML = htmlRequest.responseText;
		}
	}
	htmlRequest.open("GET", "outputshoutbox.php", true);
	htmlRequest.send(null);
}

showData();
setInterval("showData()",1000);