function iss4ValidateEmail(e)
{
	len = e.length;
	while(len > 4)
	{
		if (e.substr(len-1, 1) != ' ') break;
		len--;
	}
	atom = false; at = false; dot = false;
	var c;
	for (i=0 ; i < len ; i++)
	{
		c = e.substr(i, 1);
		if (c == '.')
		{
			if (atom == false) return false;
			if (at == true) dot = true;
			atom = false;
			continue;
		}
		if (c == '@')
		{
			if (atom == false || at == true) return false;
			atom = false;
			at = true;
			continue;
		}
		if (c <= ' ' || c > 'z') return false;
		if (c == '(' || c == ')' || c == '<' || c == '>' || c == ',' || c == ';' || c == ':' || c == '\\' || c == '\"' || c == '[' || c == ']' || c == '!') return false;
		if (at == true && (c == '_')) return false;
		atom = true;
	}
	if (atom == false || at == false || dot == false) return false;
	
	// Check and reject email addresses of format oucu@open.ac.uk
	i = e.indexOf("@open.ac.uk");
	if (i > 0)
	{
		n = e.substr(0,i);
		l = n.length;
		if (l >= 3 && l <= 8)
		{
			oucu = true;
			if (n.charAt(0) < 'a' || n.charAt(0) > 'z') oucu = false;
			if (n.charAt(l-1) < '0' || n.charAt(l-1) > '9') oucu = false;
			c = 1;
			for (i=1 ; i < l-1 ; i++)
			{
				if (c == 1)
				{
					if (n.charAt(i) >= '0' && n.charAt(i) <= '9')
						c = 2;
					else
					{
						if (n.charAt(i) < 'a' || n.charAt(i) > 'z') oucu = false;
					}
				}
				else
				{
					if (n.charAt(i) < '0' || n.charAt(i) > '9') oucu = false;
				}
			}
			if (oucu == true) return false;
		}
	}
	
	return true;
}

