function createRequestObject() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		ro = new XMLHttpRequest();
	}
	return ro;
}

var browser = navigator.appName;
var http = createRequestObject();

if(browser == "Microsoft Internet Explorer"){
	var meth = "POST";
}
else{
	var meth = "GET";
}

function openfoto(foto){
	var mom = document.getElementById('mom').value;
	setTimeout("sm('box',240,50)",100);
	document.getElementById("box").innerHTML = "<div class='laden'><img src='"+mom+"img/laden.gif' alt='even geduld aub'/></div>";
	
	http = createRequestObject();
	http.onreadystatechange = getFoto;
	
	http.open(meth,mom+"includes/getFoto.php?foto="+foto,true);
	http.setRequestHeader('Content-Type','text/plain');
	http.send(null);
}

function getFoto(){
	 if(http.readyState == 4) { 
		if(http.status  == 200) {
			setTimeout("sm('box',553,442)",100);
			document.getElementById("box").innerHTML = http.responseText;
		}
	}
}

function contactSoort(srt){
	var mom = document.getElementById('mom').value;

	http = createRequestObject();
	http.onreadystatechange = getContact;
	
	http.open(meth,mom+"includes/contactSoort.php?srt="+srt,true);
	http.setRequestHeader('Content-Type','text/plain');
	http.send(null);
}

function getContact(){
	 if(http.readyState == 4) { 
		if(http.status  == 200) {
			document.getElementById("soortContact").innerHTML = http.responseText;
		}
	}
}

function sluiten(){
	setTimeout("hm('box')",40);
}

function checkConForm(){
	if(document.getElementById('con1').value == ""){
		document.getElementById('con1').focus();
		document.getElementById('con1').style.border = "1px solid #FF2222";
		document.getElementById('contactFout').innerHTML = "u moet wel een naam invullen";
		return false;
	}
	else{
		document.getElementById('con1').style.border = "1px solid #6C695A";
		document.getElementById('contactFout').innerHTML = "Alle velden gemarkeerd met een * zijn verplicht om in te vullen";
	}
	if(document.getElementById('con2').value == ""){
		document.getElementById('con2').focus();
		document.getElementById('con2').style.border = "1px solid #FF2222";
		document.getElementById('contactFout').innerHTML = "u moet wel een e-mailadres invullen";
		return false;
	}
	else{
		if(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test(document.getElementById('con2').value)){
			document.getElementById('con2').style.border = "1px solid #6C695A";
			document.getElementById('contactFout').innerHTML = "Alle velden gemarkeerd met een * zijn verplicht om in te vullen";
		}
		else{
			document.getElementById('con2').focus();
			document.getElementById('con2').style.border = "1px solid #FF2222";
			document.getElementById('contactFout').innerHTML = "u moet wel een <b>geldig</b> e-mailadres invullen";
			return false;
		}
	}
	if(document.getElementById('con3').value == ""){
		document.getElementById('con3').focus();
		document.getElementById('con3').style.border = "1px solid #FF2222";
		document.getElementById('contactFout').innerHTML = "u moet wel een telefoonnummer invullen";
		return false;
	}
	else{
		document.getElementById('contactFout').innerHTML = "Alle velden gemarkeerd met een * zijn verplicht om in te vullen";
		document.getElementById('con3').style.border = "1px solid #6C695A";
	}
}

function checkBelForm(){
	if(document.getElementById('con1').value == ""){
		document.getElementById('con1').focus();
		document.getElementById('con1').style.border = "1px solid #FF2222";
		document.getElementById('contactFout').innerHTML = "u moet wel een naam invullen";
		return false;
	}
	else{
		document.getElementById('con1').style.border = "1px solid #6C695A";
		document.getElementById('contactFout').innerHTML = "Alle velden gemarkeerd met een * zijn verplicht om in te vullen";
	}

	if(document.getElementById('con2').value == ""){
		document.getElementById('con2').focus();
		document.getElementById('con2').style.border = "1px solid #FF2222";
		document.getElementById('contactFout').innerHTML = "u moet wel een telefoonnummer invullen";
		return false;
	}
	else{
		document.getElementById('contactFout').innerHTML = "Alle velden gemarkeerd met een * zijn verplicht om in te vullen";
		document.getElementById('con2').style.border = "1px solid #6C695A";
	}
}
