//credit: www.youngpup.net
function validateForm() {
	
	
	var f = document.registerForm;
	var i = 0;
	var errors = [];

	// Bill-to section
	if (f.first_name.value == "")	
		errors[i++] = "Uw voornaam.";
	if (f.second_name.value == "")	
		errors[i++] = "Uw achternaam.";	
	if (!validEmail(f.email.value))
		errors[i++] = "Vul een geldig e-mail adres in.";

			
	if (errors.length > 0) {
		alert(STD_ERROR_PREFIX + errors.join("\n"))
		return false;
	}
	return true;
}

// as convenient a place as any to store this...
var STD_ERROR_PREFIX = "Er ontbreken gegevens ... "
STD_ERROR_PREFIX += "Wilt u a.u.b. onderstaande gegevens volledig invullen:\n\n"

<!--- Email validation with Regular Expressions --->
<!--- SOURCE: http://www.webreference.com/js/column5/ --->
<!--- Edited by: Bert Votsis (bert@votsis.com) --->
<!--- comma's and spaces are now also non-valid characters --->
function validEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
	var tempStr = "a";
	var tempReg = new RegExp(tempStr);
	if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported)
	return (str.indexOf(".") > 1) && (str.indexOf("@") > 0);
  var reg1 = /(@.*@)|(\.\.)|(\ )|(\,)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; // valid
  return (!reg1.test(str) && reg2.test(str));
}

//credit: http://mobile.lycos.nl/mobile/
if (navigator.appName.indexOf("Netscape") >= 0 &&
	parseInt(navigator.appVersion) >= 4) { var nn4 = true }

//document.registerForm.__event.onkeydown = countChars;
if (nn4) document.captureEvents(Event.KEYDOWN);
