var debugValidation = false;


function validate(el, errorString)
{
	if (el.value == "") return errorString;
    return "";
}

var allowableChar="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_1234567890@.";

function validateEmail(el, errorString)
{
//	alert('here1');
if (debugValidation) alert("validate email");
//	alert('here2');
	var valid = true;
//	alert('here3');
	var str=el.value;
//	alert('here4');
	var atCount = 0;
//	alert('here5');
	var ch = ''; 
//	alert('here6');
	
//	alert('here7');
	for (var i = 0; i < str.length; i++)
	{
//	alert('here8');
		ch = str.charAt(i);
//	alert('here9');
		valid &= allowableChar.indexOf(ch) != -1;
//	alert('here10');
		if (ch == '@') atCount++;
//	alert('here11');
		
	}
	if (atCount != 1) valid = false;
//	alert('here12');
	valid &= str.indexOf("..") == -1;
//	alert('here13');
	
//	alert('here14');
	return valid ? "" : errorString;
}