// Written by Paolo Wales (paolo@taize.fr) starting on a basis by Samrat Sen.
// Please send me comments or suggested improvements.

function eMailCheck(eMailadr)
{

var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
var check=/@[\w\-]+\./;
var checkend=/\.[a-zA-Z]{2,3}$/;

	if(((eMailadr.search(exclude) != -1)||(eMailadr.search(check)) == -1)||(eMailadr.search(checkend) == -1))
		{
		 return 1;
		}
	else
		{
		 return 0;
		}
}

/*
Notes:
'exclude' checks 5 conditions:
a) characters that should not be in the address
b) characters that should not be at the start
c) & d) characters that shouldn't be together
e) there's not more than one '@'
'check' checks there's at least one '@', later followed by at least one '.'
'checkend' checks the address ends with a period followed by 2 or 3 alpha characters
N.B. Javascript 1.2 only works with version 4 browsers and higher.
*/


