// JavaScript Document<script language="javascript" type="application/javascript">
function isEmailValid(st) {
	var error = false;
	var at = st.indexOf("@");
	var dot = st.indexOf(".", at);
	var invStringPresent = false;
	var invalidString = ['!', '#', '$', '%', '^', '&', '*', '+', '/', "\\", '(', ')', '[', ']', '{', '}', ';', ':', "'", '\"', '<', '>', ',', '?', '~', '`', ' ', '=', '|'];
	//check for invalid strings
	for (i=0; i<invalidString.length; i++) {
		if (st.indexOf(invalidString[i])>=0) {
			invStringPresent = true;
			//trace("Invalid String "+invalidString[i]+" present");
		}
	}
	//trace("AT = "+at+" , DOT = "+dot);
	switch (true) {
	case invStringPresent :
		// for Invalid Strings
	case (at<0) :
		// 'at' presence
	case (at == 0) :
		// 'at' NOT at the beginning
	case (st.indexOf("@", at+1)>=0) :
		// only one 'at'		
	case (dot<0) :
		// 'dot' presence
	case (dot<at) :
		// 'dot' after at
	case (st.lastIndexOf(".") == st.length-1) :
		// 'dot' not in the last
	case ((dot-at) == 1) :
		// NO 'dot' immediately after 'at'
		error = true;
	}
	//trace("ERROR = "+error);
	return (!error);
}



