var reEmail = /^.+\@.+\..+$/
var defaultEmptyOK = false
var iEmail = "This field must be a valid email address (e.g. user@domain.com). Please reenter it now."

function isEmpty(s) {
	return ((s == null) || (s.length == 0))
}

function isEmail (s) {
	if (isEmpty(s)) 
       if (isEmail.arguments.length == 1) return defaultEmptyOK;
       else return (isEmail.arguments[1] == true);
    
    else {
       return reEmail.test(s)
    }
}

function warnInvalid (theField, s) {
	theField.focus()
    theField.select()
    alert(s)
    return false
}

function checkEmail (theField, emptyOK) {
	if (checkEmail.arguments.length == 1)
		emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value)))
    	return warnInvalid (theField, iEmail);
// 3/1/2000 Was return true but
    else if (!isEmail(theField.value, false)) 
       return warnInvalid (theField, iEmail);
    else 
		return true;
}

function openEmailWin(url) {
	if (checkEmail(document.EmailForm.email, true)) {
		val = document.EmailForm.email.value;
		url = url + val;
		box = window.open(url, "box", "toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=600,height=500");
	}
}

function doClearField(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = "";
     }
}