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

// this function check the login and password validity input
function IsValid(theform)
{

	var sUserNameMsg="Please introduce the NAME";
    var sEmailMsg="Please introduce the EMAIL";
	

		
		
	var sUserName=(theform.nom.value);
	var sEmail=(theform.mail.value);
	

	


	
	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("Invalid email adress, more caracters needed ");
			theform.mail.focus();
			return false;
		}
		if (arobase < 1) {
			alert("Invalid email adress, @ needed");
			theform.mail.focus();
			return false;
		}
		if (lastPoint < arobase+1) {
			alert("Invalid email adress, missing point after the @");
			theform.mail.focus();
			return false;
		}
		if (lastPoint<strLength-5 || lastPoint>strLength-3) {
			alert("Invalid email adress, invalid part after the @");
			theform.mail.focus();
			return false;
		}
		if (space >= 0) {
			alert("There's a space in your email adress");
			theform.mail.focus();
			return false;
		}
	}

return(true);
}

