/* Copyright (c) 1999 internet.com LLC. To receive the right to license
* this code to use on your site the original code must be copied from
* Webreference.com. License is granted if and only if this entire copyright 
* notice is included, and you link from the page on which the code is used 
* to Webreference at http://www.webreference.com for the latest version.
* By Andy King. v1.57 990120
*/
function evaluate(s,stdtext) {
	var rex=true;
	if (window.RegExp) {
		st="a";
		ex=new RegExp(st);
		if (st.match(ex)) {
			r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
			r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			b=(!r1.test(s)&&r2.test(s));
		} else {
			rex=false;
		}
	} else {
		rex=false;
	}
	if(!rex) b=(s.indexOf("@")>0&&s.indexOf(".")>0&&s!=""&&s!=stdtext);
	return (b);
}
function f(h) {
	h.focus();
	h.select();
}
function validate(fld, stdtext, txt1, txt2, txt3) {
	var s = fld.value;
	if(evaluate(s, stdtext)) {
		if(confirm(txt1 + s + txt2))
			return true;
		else {
			f(fld);
			return false;
		}
	} else {
		alert(txt3);
		f(fld);
		return false;
	}
}