// allows syntax highlight in Visual Interdev or other <script language="javascript">

// this function check the login and password validity input
function IsValid(theform)
{
	var sMesMsg="Gelieve de BESCHRIJVING in te vullen";
	var sUserNameMsg="Gelieve de NAAM in te vullen";
    var sEmailMsg="Gelieve de EMAIL in te vullen";
	

		
	var sMes=(theform.mes.value);	
	var sUserName=(theform.nom.value);
	var sEmail=(theform.mail.value);
	
	if (sMes.length <= 0) {
		alert(sMesMsg);
		theform.mes.value="";
		theform.mes.focus();
		return false;
	}
	
	
	if (sUserName.length <= 0) {
		alert(sUserNameMsg);
		theform.nom.value="";
		theform.nom.focus();
		return false;
	}
		
	if (sEmail.length <= 0) {
		alert(sEmailMsg);
		theform.mail.value="";
		theform.mail.focus();
		return false;
	}

	if (sEmail.length > 0) {
		var arobase=sEmail.indexOf("@");
		var lastPoint=sEmail.lastIndexOf(".");
		var space=sEmail.indexOf(' ');
		var strLength=sEmail.length;
		if (strLength <= 0) {
			alert(sEmailMsg);
			theform.mail.focus();
			return false;
		}
		if (strLength < 6) {
			alert("Incorrect adresse, te weinig caracters");
			theform.mail.focus();
			return false;
		}
		if (arobase < 1) {
			alert("U e-mail is incorrect, het moet een apestaartje bevatten");
			theform.mail.focus();
			return false;
		}
		if (lastPoint < arobase+1) {
			alert("U e-mail is incorrect, het moet een punt na de apestaartje bevatten");
			theform.mail.focus();
			return false;
		}
		if (lastPoint<strLength-5 || lastPoint>strLength-3) {
			alert("U e-mail is incorrect, het deel na de apestaartje is incorrect");
			theform.mail.focus();
			return false;
		}
		if (space >= 0) {
			alert("Er is een spacie in de e-mail");
			theform.mail.focus();
			return false;
		}
	}

return(true);
}
