function $(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all[id] : null;
}

function addEvent(o, e, f) {
	o.addEventListener ? o.addEventListener(e, f, false) : o.attachEvent ? o.attachEvent("on" + e, f) : o["on" + e] = f;
}

function popCentre(URL, winWidth, winHeight, winParam) {
	var centreX = parseInt((screen.width ? screen.width : screen.availWidth) / 2, 10);
	var centreY = parseInt((screen.height ? screen.height : screen.availHeight) / 2, 10);
	var winX = centreX - parseInt(winWidth / 2, 10);
	var winY = centreY - parseInt(winHeight / 2, 10);
	var allParam = "width=" + winWidth + ", height=" + winHeight + ", left=" + winX + ", top=" + winY;
	if (winParam != "") allParam += ", " + winParam;
	return window.open(URL, "_blank", allParam);
}

function popProd(prodID) {
	popCentre("pop.asp?id=" + prodID, 820, 600, "scrollbars=yes");
}

function checkForm(formFields) {
	var s = "";
	var el;
	var aFormFields = String(formFields).split(",");
	for (var i = 0; i < aFormFields.length; i++) if ((el = document.getElementById(aFormFields[i])) != null) {
		if (el.value == "") {
			s += "- " + aFormFields[i].replace(/'/g, '\'') + "\n";
			el.style.border = "1px solid #DD0000";
		} else el.style.border = "";
	}
	if (s != "") alert("De volgende velden zijn nog niet ingevuld:\n" + s);
	return (s == "");
}

function switchRadio(theradio){
	document.getElementById('contactTel_row').style.display= 'none';
	document.getElementById('contactMail_row').style.display= 'none';
	document.getElementById(theradio+'_row').style.display= '';
}

function checkEmail(str) {
	var testresults = false;
	//uitleg filter: minimaal 1 letter voor @ ; min 1 max 66 letters na @ ; min 2 max 6 letters na punt.
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)) {
		testresults=true;
	}else{
		testresults=false;
	}
	return (testresults);
}	

function switchIt(what) {
	$('digital').style.display='none';
	$('solTable').style.display='none';
	$(what).style.display='';
}

function checkInput(input, was, wordt) {
	if (input.value == was) input.value = wordt;
}

function openMenu(divId) {
	cancelClose();
	closeAll();
	$(divId).style.display='';	
}

function closeAll() {
	var i = 0;
	var el;
	do {
		el = $("nav" + i);
		if (el != null) el.style.display='none';
		i++;
	} while (el != null);
}

function closeMenu(divId) {
	tCloser = setTimeout(function() { closeAll() }, 600);
}

function cancelClose() {
	if (typeof tCloser != "undefined") clearTimeout(tCloser);
}

function openInfo() {
	$('infolarge').style.display = '';
	//$('infosmall').style.display = 'none';
}

function closeInfo() {
	$('infolarge').style.display = 'none';
	//$('infosmall').style.display = '';
}

function toggleInfo() {
	if ($('infolarge').style.display == '') closeInfo(); else openInfo();
}