/////////////////////////////////////////////////////////////////////////////
// 

function ValidateEmail(name, msg)
{
	// First check if there is anything in the field
	var elem = document.getElementById(name);
	if (elem == null || elem.value == '')
	{
		if (elem != null)
			elem.focus;

		alert(msg);
		return false;
	}

	// Then check if it has the general syntax of an email
	var apos = elem.value.indexOf("@");
	var dotpos = elem.value.lastIndexOf(".");
	if (apos < 1 || dotpos - apos < 2)
	{
		alert(msg);
		return false;
	}

	return true;
}

/////////////////////////////////////////////////////////////////////////////
// 

function ValidateField(name, msg)
{
	// First check if there is anything in the field
	var elem = document.getElementById(name);
	if (elem == null || elem.value == '')
	{
		if (elem != null)
			elem.focus;

		alert(msg);
		return false;
	}
	return true;
}

/////////////////////////////////////////////////////////////////////////////
// 

function ValidateForm()
{
	if (!ValidateField("naam", "Geef uw naam"))
		return false;

	if (!ValidateEmail("email", "Geef uw e-mailadres"))
		return false;

	if (!ValidateField("bericht", "Geef het bericht"))
		return false;

	return true;
}

