function windowLoad() {
	if (document.images) {
		image_object = new Image();
		image_url = new Array();
		image_url[0] = "../images/home.jpg";
		image_url[1] = "../images/nieuws.jpg";
		image_url[2] = "../images/merken.jpg";
		image_url[3] = "../images/producten.jpg";
		image_url[4] = "../images/contact.jpg";
		var i = 0;
		for(i=0; i<=3; i++) {
			image_object.src = image_url[i];
		}
	}
	if (document.getElementsByTagName) {
		var a = document.getElementsByTagName('a');
		for (var i = 0; i < a.length; i++) {
			a[i].onfocus = function() { this.blur() };
			if (a[i].getAttribute('href') && (a[i].getAttribute('rel') == 'external')) {
				a[i].target = '_blank';
			}
		}
	}
}

function getElement(el) {
	if(document.all) {
		return document.all[el];
	} else if (document.getElementById) {
		return document.getElementById(el);
	} else {
		for (iLayer = 1; iLayer < document.layers.length; iLayer++) {
			if(document.layers[iLayer].id == el) {
				return document.layers[iLayer];
			}
		}
	}
	return false;
}

function checkForm(form) {
	if (form) {
		var fout_nr = 0;
		var fout = '';
		var filter=/^.+@.+\..{2,3}$/;
		if (form.naam.value == '') {
			fout_nr++;
			fout += '- Naam\n';
		}
		if (!filter.test(form.email.value)) {
			fout_nr++;
			fout += '- E-mail\n';
		}
		if (form.onderwerp.value == '') {
			fout_nr++;
			fout += '- Onderwerp\n';
		}
		if (form.bericht.value == '') {
			fout_nr++;
			fout += '- Bericht\n';
		}
		if (fout_nr > 0) {
			alert('Gelieve volgende velden correct in te vullen:\n' + fout);
			return false;
		} else {
			return true;
		}
	} else {
		return false;
	}
}

function checkAlert() {
	var box = getElement('alert');
	if (box) {
		msg = box.innerHTML;
		alert(msg);
	}
}

function popUpFoto(foto, width, height) {
	windowLeft = (screen.width - width) / 2;
	windowTop = (screen.height - height) / 2;
	window.open('foto.php?foto=' + foto, '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + windowLeft + ',top=' + windowTop);
}

window.onload = function() {
	windowLoad();
	checkAlert();
}
