/*
2 -------------------------------------------------------------------------
3 JavaScript Form Validator (gen_validatorv31.js)
4 Version 3.1
5 Copyright (C) 2003-2008 JavaScript-Coder.com. All rights reserved.
6 You can freely use this script in your Web pages.
7 You may adapt this script for your own needs, provided these opening credit
8 lines are kept intact.
9
10 The Form validation script is distributed free from JavaScript-Coder.com
11 For updates, please visit:
12 http://www.javascript-coder.com/html-form/javascript-form-validation.phtml
13
14 Questions & comments please send to support@javascript-coder.com
15 -------------------------------------------------------------------------
16*/ 
/*
Original file with more validators:
http://www.javascript-coder.com/html-form/gen_validatorv31.js
*/
function isEmail(input) {
	var email = $.trim(input);
	
	var splitted = email.match("^(.+)@(.+)$");

	if (splitted == null) return false;
	if (splitted[1] != null ) {
		var regexp_user=/^\"?[\w-_\.]*\"?$/;
		if (splitted[1].match(regexp_user) == null) return false;
	}
	if(splitted[2] != null) {
		var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
		
		if(splitted[2].match(regexp_domain) == null) {
			var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
			if(splitted[2].match(regexp_ip) == null) return false;
		}// if

		return true;
	}

	return false;
}
