// @version 8.6

function validateEmail(email)
{
	var errors;
	var carac_inv = "<>()[]\,;:";
	errors = false;

	if (email.length < 1)
	{
		errors = true;
	}
	else
	{
		if (email.indexOf('@') < 0)
		{
			errors = true;
		}
		else if (email.indexOf('.') < 0)
		{
			errors = true;
		}
		else if (email.indexOf('.') == 0)
		{
			errors = true;
		}
		else if (email.indexOf('@') == 0)
		{
			errors = true;
		}
		else if (email.lastIndexOf('@') == email.length - 1)
		{
			errors = true;
		}
		else if (email.lastIndexOf('.') == email.length - 1)
		{
			errors = true;
		}
		else if (email.lastIndexOf('@') != email.indexOf('@'))
		{
			errors = true;
		}
		else if (email.indexOf('.@') > 0)
		{
			errors = true;
		}
		else if (email.indexOf('@.') > 0)
		{
			errors = true;
		}
		else
		{
			emailIngr = email.split("");
			for ( j = 0; j < email.length; j++)
			{
				if (carac_inv.indexOf(emailIngr[j]) != -1)
				{
					errors = true;
					break;
				}
			}
		}
	}
	if (errors)
	{
		return false;
	}
	else
	{
		return true;
	}
}
