function isValidEmail(str) {
	var emailisok = true;	//assume it is fine until you can proove the contrary!
	var arobasePos = str.indexOf('@');	//position of the @ in the string
	var dotLastPos = str.lastIndexOf('.');	//position of the LAST dot
	var spacePos = str.indexOf(' ');	//poistion of one space in the string
	var myLength = str.length;
	
	if (arobasePos < 3 ){	// at least one @ must be present and not before position 3 (name at least 2 chars)
		emailisok = false
	}
	if (dotLastPos < arobasePos){	// at least one . (dot) afer the @ is required
		emailisok = false
	}
	if (myLength - dotLastPos <= 2){	// at least two characters [com, uk, fr, ...] must occur after the last . (dot)
		emailisok = false
	}
	if (spacePos != -1){	// no empty space " " is permitted
		emailisok = false
	}
	if (dotLastPos - arobasePos < 4){	// domain is at least 3 chars
		emailisok = false
	}
	return emailisok
}
