<!--//

function validateForm()
{
	//check Companyname
	if (document.form1.elements['Companyname'].value == "")
	{
		alert("Companyname is a required field.");
		document.form1.elements['Companyname'].focus();
		return(false);
	}
	//check Contactname
	if (document.form1.elements['Contactname'].value == "")
	{
		alert("Contact name is a required field.");
		document.form1.elements['Contactname'].focus();
        return(false);
   	}
	//check Telephone
	if (document.form1.elements['Telephone'].value == "")
	{
		alert("Telephone is a required field.");
		document.form1.elements['Telephone'].focus();
        return(false);
   	}
	//check Email
	if (document.form1.elements['email'].value == "")
	{
		alert("E-mail is a required field.");
		document.form1.elements['email'].focus();
        return(false);
   	}
	//check geldigheid e-mail
	if (!checkEmail(document.form1.elements['email'].value))
	{
		alert("The submitted e-mail address is invalid.");
		document.form1.elements['email'].focus();
		return(false);
	}			
		
	return(true);
}

function checkEmail(emailAddress) {

	var foundAtSymbol = 0;
	var foundDot = 0;
	var md;

	// Go through each character in the email address.
	for (var x=0; x<emailAddress.length - 1; x++) {
		md = emailAddress.substr(x, 1);
		
		// Is the character an @ symbol?
		if (md == '@') foundAtSymbol++;
		
		// Count how many dots there are after the @ symbol.
		if (md == '.' && foundAtSymbol == 1) foundDot++;
	};
	
	// Is there only one @ symbol, and are there more than one dots?
	if (foundDot > 0 && foundAtSymbol == 1) {
		return true;
	} else {
		return false;
	};

};

//-->
