function checkContact() {
	if (document.contactform.bnaam.value == "") {
		alert("Vul uw bedrijfsnaam in")
		document.contactform.bnaam.focus()
		return false
	} else if (document.contactform.naam.value == "") {
		alert("Vul uw naam in")
		document.contactform.naam.focus()
		return false
	} else if (document.contactform.adres.value == "") {
		alert("Vul uw adres in")
		document.contactform.adres.focus()
		return false
	} else if (document.contactform.postcode.value == "") {
		alert("Vul uw postcode in")
		document.contactform.postcode.focus()
		return false
	} else if (document.contactform.plaats.value == "") {
		alert("Vul uw woonplaats in")
		document.contactform.plaats.focus()
		return false
	} else if (document.contactform.tel.value == "") {
		alert("Vul uw telefoonnummer in")
		document.contactform.tel.focus()
		return false
	} else if (!isTelNummer(document.contactform.tel.value)) {
		alert("Het door u ingevulde telefoonummer is onjuist")
		document.contactform.tel.focus()
		return false
	} else if (document.contactform.mail.value == "") {
	    alert("Vul uw e-mailadres in")
		document.contactform.mail.focus()
		return false
	} else if (!checkEmail(document.contactform.mail.value)) {
		alert("Het is door u ingevulde e-mailadres in onjuist")
		document.contactform.mail.focus()
		return false
	} else if (document.contactform.codeI.value == "") {
		alert("Vul de code in")
		document.contactform.codeI.focus()
		return false
	} else
		document.contactform.submit()
}

function checkEmail(strEmail) {
	strtmpEmail = String(strEmail)

	// Er moet een @ en een . voorkomen in een emailadres
	if (strtmpEmail.indexOf("@")== -1 || strtmpEmail.indexOf(".")== -1) {
		return false
	}

	nAt = strtmpEmail.indexOf("@")

	if (nAt > 0) {
		strCheck = strtmpEmail.slice(nAt + 1)
		// De @ komt voor de .  xxx.ppibv@nl, maar tim@ppibv.nl moet ook kunnen
		// Indien de . direct na de @ komt is dat ook fout  tim@.nl
		if (strCheck.indexOf(".") <= 0 ) {
			return false
		} else {
			// Na de punt minimaal 2 tekens tim@ppibv.n
			return ((parseInt(strCheck.length) -1) - parseInt(strCheck.indexOf("."))  > 1 )
		}
	} else
		return false
}

function isTelNummer(str) {
  if(!str) return false;
  for(var i=0; i<str.length; i++){
    var ch=str.charAt(i);
    if ("0123456789-() +".indexOf(ch) ==-1) return false;
  }
  return true;
}
