/* function to check for a valid email */
function validEmail(text) {
	if (findSpaces(text)
	|| text.indexOf("@") != text.lastIndexOf("@")
	|| text.indexOf("@") < 1
	|| text.indexOf(".", text.lastIndexOf("@") + 2) < 1
	|| text.lastIndexOf(".") + 1 == text.length) {
		return false;
	} else {
		return true;
	}
}

/* function to check for spaces */
function findSpaces(text) {
	for (i = 0; i < text.length; ++i) {
		if (text.charAt(i) == ' ') {
			return true;
		}
	}
	return false;
}
