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 setFoto(foto){
	var mom = document.getElementById('mom').value;
	
	document.getElementById('degrotefoto').src = mom+""+foto;
	
}

function openFoto(foto){
	setTimeout("sm('box',220,19)",10);
	var mom = document.getElementById('mom').value;
	document.getElementById("box").innerHTML = "<div class=\"laden\"><img src=\""+mom+"img/laden.gif\" alt=\"een moment geduld aub\" /></div>";
	
	http = createRequestObject();
	http.onreadystatechange = getFoto;

	http.open(meth,mom+"manip/modalfoto.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',680,580)",100);
			document.getElementById('box').innerHTML = http.responseText;

		}
	}
}

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

function controleer(){
	if(document.getElementById('form1').value == ""){
		document.getElementById('formFout').innerHTML = "naam vergeten in te voeren";
		document.getElementById('form1').style.border = "1px solid #BE1317";
		document.getElementById('form1').style.background = "#FF7F84";
		
		document.getElementById('form1').focus();
		return false;	
	}
	else{
		document.getElementById('formFout').innerHTML = "&nbsp;";
		document.getElementById('form1').style.border = "1px solid #000000";
		document.getElementById('form1').style.background = "#FFFFFF";
	}
	if(document.getElementById('form2').value == ""){
		document.getElementById('formFout').innerHTML = "voorletter(s) vergeten in te voeren";
		document.getElementById('form2').style.border = "1px solid #BE1317";
		document.getElementById('form2').style.background = "#FF7F84";
		
		document.getElementById('form2').focus();
		return false;	
	}
	
	else{
		document.getElementById('formFout').innerHTML = "&nbsp;";
		document.getElementById('form2').style.border = "1px solid #000000";
		document.getElementById('form2').style.background = "#FFFFFF";
	}
	
	if(document.getElementById('form3').value == ""){
		document.getElementById('formFout').innerHTML = "roepnaam vergeten in te voeren";
		document.getElementById('form3').style.border = "1px solid #BE1317";
		document.getElementById('form3').style.background = "#FF7F84";
		
		document.getElementById('form3').focus();
		return false;	
	}
	
	else{
		document.getElementById('formFout').innerHTML = "&nbsp;";
		document.getElementById('form3').style.border = "1px solid #000000";
		document.getElementById('form3').style.background = "#FFFFFF";
	}
	
	if(document.getElementById('form4').value == ""){
		document.getElementById('formFout').innerHTML = "adres vergeten in te voeren";
		document.getElementById('form4').style.border = "1px solid #BE1317";
		document.getElementById('form4').style.background = "#FF7F84";
		document.getElementById('form4').focus();
		return false;	
	}
	else{
		document.getElementById('formFout').innerHTML = "&nbsp;";
		document.getElementById('form4').style.border = "1px solid #000000";
		document.getElementById('form4').style.background = "#FFFFFF";
	}
	
	if(document.getElementById('form5').value == ""){
		document.getElementById('formFout').innerHTML = "postcode en plaats vergeten in te voeren";
		document.getElementById('form5').style.border = "1px solid #BE1317";
		document.getElementById('form5').style.background = "#FF7F84";
		document.getElementById('form5').focus();
		return false;	
	}
	else{
		document.getElementById('formFout').innerHTML = "&nbsp;";
		document.getElementById('form5').style.border = "1px solid #000000";
		document.getElementById('form5').style.background = "#FFFFFF";
	}
	
	if(document.getElementById('form6').value == ""){
		document.getElementById('formFout').innerHTML = "telefoonnummer vergeten in te voeren";
		document.getElementById('form6').style.border = "1px solid #BE1317";
		document.getElementById('form6').style.background = "#FF7F84";
		document.getElementById('form6').focus();
		return false;	
	}
	else{
		document.getElementById('formFout').innerHTML = "&nbsp;";
		document.getElementById('form6').style.border = "1px solid #000000";
		document.getElementById('form6').style.background = "#FFFFFF";
	}
	
	if(document.getElementById('form7').value == ""){
		document.getElementById('formFout').innerHTML = "geboortedatum vergeten in te voeren";
		document.getElementById('form7').style.border = "1px solid #BE1317";
		document.getElementById('form7').style.background = "#FF7F84";
		document.getElementById('form7').focus();
		return false;	
	}
	else{
		document.getElementById('formFout').innerHTML = "&nbsp;";
		document.getElementById('form7').style.border = "1px solid #000000";
		document.getElementById('form7').style.background = "#FFFFFF";
	}

	if(document.getElementById('form8').value == ""){
		document.getElementById('formFout').innerHTML = "e-mailadres vergeten in te voeren";
		document.getElementById('form8').style.border = "1px solid #BE1317";
		document.getElementById('form8').style.background = "#FF7F84";
		document.getElementById('form8').focus();
		return false;	
	}
	else{
		if(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test(document.getElementById('form8').value)){	
			document.getElementById('form8').style.border = "1px solid #000000";
			document.getElementById('form8').style.background = "#FFFFFF";
		}
		else{
			document.getElementById('formFout').innerHTML = "e-mailadres is niet juist";
			document.getElementById('form8').style.border = "1px solid #BE1317";
			document.getElementById('form8').style.background = "#FF7F84";
			document.getElementById('form8').focus();
			return false;		
		}
	}
}

function gm(){
	
	 if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());

		map.setCenter(new GLatLng(53.039787432430536, 7.046163082122803), 17, G_HYBRID_MAP);


		var baseIcon = new GIcon();
		baseIcon.iconSize = new GSize(40, 40);
		baseIcon.iconAnchor = new GPoint(9, 34);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		baseIcon.infoShadowAnchor = new GPoint(18, 25);

		function createMarker(point, index) {
		
			var letter = String.fromCharCode("A".charCodeAt(0) + index);
			var letteredIcon = new GIcon(baseIcon);
			
			var mom = document.getElementById("mom").value;
			
			letteredIcon.image = mom+"img/pointer.png";
		
			markerOptions = { icon:letteredIcon };
			var marker = new GMarker(point, markerOptions);
			return marker;

		}
		var latlng = new GLatLng(53.039787432430536, 7.046163082122803);
		map.addOverlay(createMarker(latlng, 1));

	}
	
}
