function checkContactform()
{	i = "";
	if (document.contactform.contactpersoon.value == '') {i += "* Contactpersoon\n";}
	if (document.contactform.bedrijf.value == '') {i += "* Bedrijf\n";}
	if (document.contactform.email.value == '' || !echeck(document.contactform.email.value)) {i += "* E-mail\n";}
	if (document.contactform.telefoon.value == '') {i += "* Telefoon\n";}
	if (document.contactform.adres.value == '') {i += "* Adres\n";}
	if (document.contactform.postcode.value == '') {i += "* Postcode\n";}
	if (document.contactform.plaats.value == '') {i += "* Plaats\n";}
	if (document.contactform.opmerking.value == '') {i += "* Opmerking\n";}
	if(i != ''){
		alert("De volgende gegevens ontbreken of zijn niet juist ingevuld:\n\n"+i);
		return false;
	} else {
		return true;
	}
}

function checkInschrijfform()
{	i = "";
	if (document.inschrijfform.gebruikersnaam.value == '') {i += "* Gebruikersnaam\n";}
	if (document.inschrijfform.wachtwoord.value == '') {i += "* Wachtwoord\n";}
	if (document.inschrijfform.bedrijf.value == '') {i += "* Bedrijf\n";}
	if (document.inschrijfform.afdeling.value == '') {i += "* Afdeling\n";}
	if (!document.inschrijfform.geslacht[0].checked && !document.inschrijfform.geslacht[1].checked) {i += "* Man \\ Vrouw\n";}
	if (document.inschrijfform.contactpersoon.value == '') {i += "* Contactpersoon\n";}
	if (document.inschrijfform.email.value == '' || !echeck(document.inschrijfform.email.value)) {i += "* E-mail\n";}
	if (document.inschrijfform.telefoon.value == '') {i += "* Telefoon\n";}
	if (document.inschrijfform.adres.value == '') {i += "* Adres\n";}
	if (document.inschrijfform.postcode.value == '') {i += "* Postcode\n";}
	if (document.inschrijfform.woonplaats.value == '') {i += "* Woonplaats\n";}
	if (!document.inschrijfform.factuurgegevens.checked) {
		if (document.inschrijfform.fbedrijf.value == '') {i += "* Factuur - bedrijf\n";}
		if (document.inschrijfform.fafdeling.value == '') {i += "* Factuur -Afdeling\n";}
		if (!document.inschrijfform.fgeslacht[0].checked && !document.inschrijfform.fgeslacht[1].checked) {i += "* Factuur - Man \\ Vrouw\n";}
		if (document.inschrijfform.fcontactpersoon.value == '') {i += "* Factuur - Contactpersoon\n";}
		if (document.inschrijfform.fadres.value == '') {i += "* Factuur - Adres\n";}
		if (document.inschrijfform.fpostcode.value == '') {i += "* Factuur - Postcode\n";}
		if (document.inschrijfform.fwoonplaats.value == '') {i += "* Factuur - Woonplaats\n";}
	}
	if(document.inschrijfform.gebruikersnaam.value.length < 4 || document.inschrijfform.gebruikersnaam.value.length > 16)
		i += "* Gebruikernaam bestaat uit te weinig of te veel tekens\n";
	if(document.inschrijfform.wachtwoord.value.length < 6 || document.inschrijfform.wachtwoord.value.length > 16)
		i += "* Wachtwoord bestaat uit te weinig of te veel tekens\n";
	if(i != ''){
		alert("De volgende gegevens ontbreken of zijn niet juist ingevuld:\n\n"+i);
		return false;
	} else {
		return true;
	}
}
function checkSoftwareOrderform()
{	i = "";
	if (document.softwareorder.bedrijf.value == '') {i += "* Bedrijf\n";}
	if (document.softwareorder.afdeling.value == '') {i += "* Afdeling\n";}
	if (!document.softwareorder.geslacht[0].checked && !document.softwareorder.geslacht[1].checked) {i += "* Man \\ Vrouw\n";}
	if (document.softwareorder.contactpersoon.value == '') {i += "* Contactpersoon\n";}
	if (document.softwareorder.email.value == '' || !echeck(document.softwareorder.email.value)) {i += "* E-mail\n";}
	if (document.softwareorder.telefoon.value == '') {i += "* Telefoon\n";}
	if (document.softwareorder.adres.value == '') {i += "* Adres\n";}
	if (document.softwareorder.postcode.value == '') {i += "* Postcode\n";}
	if (document.softwareorder.woonplaats.value == '') {i += "* Woonplaats\n";}
	if (!document.softwareorder.factuurgegevens.checked) {
		if (document.softwareorder.fbedrijf.value == '') {i += "* Factuur - bedrijf\n";}
		if (document.softwareorder.fafdeling.value == '') {i += "* Factuur -Afdeling\n";}
		if (!document.softwareorder.fgeslacht[0].checked && !document.softwareorder.fgeslacht[1].checked) {i += "* Factuur - Man \\ Vrouw\n";}
		if (document.softwareorder.fcontactpersoon.value == '') {i += "* Factuur - Contactpersoon\n";}
		if (document.softwareorder.fadres.value == '') {i += "* Factuur - Adres\n";}
		if (document.softwareorder.fpostcode.value == '') {i += "* Factuur - Postcode\n";}
		if (document.softwareorder.fwoonplaats.value == '') {i += "* Factuur - Woonplaats\n";}
	}
	
	if(i != ''){
		alert("De volgende gegevens ontbreken of zijn niet juist ingevuld:\n\n"+i);
		return false;
	} else {
		return true;
	}
}

function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		return false
	 }

	 return true					
}		
