// Fonction de vérification de validité d'Email
// PARX - 1999

// Version 1.01

// Reçoit l'email en paramètre.
// Retourne True si c'est OK, sinon False
function test_email(str_email)
{
var pos_arob;
var pos_point;
var pos_illegal;

if (str_email == '')		// si chaine vide
	{return false;}

// Obligation d'un seul @
pos_arob = str_email.indexOf('@',0);
last_arob = str_email.lastIndexOf('@');


if (pos_arob < 1)	// si absent ou en 1er caractère
	{
		return false;
	}
	
if (pos_arob != last_arob)	// si plusieurs arobace!
	{
		return false;
	}
		
// Obligation d'un '.' aprés le '@'
pos_point = str_email.lastIndexOf('.');
if (pos_point < pos_arob)	// si point absent ou seulement avant l'arobace
	{
		return false;
	}
	
// Test des caractères interdits
pos_illegal1 = str_email.indexOf(' ',0);		// espace
pos_illegal2 = str_email.indexOf(',',0);		// virgule
pos_illegal3 = str_email.indexOf(';',0);		// point virgule

if (pos_illegal1 != -1 || pos_illegal2 != -1 || pos_illegal3 != -1)
	{
		return false;
	} 		

// Si on arrive ici, c'est normalement bon
	return true;

}
