function trim(val)
{
	var str = val+"";
	if (str.length == 0) return str;
	var re = /^\s*/;
	str = str.replace(re,'');
	re = /\s*$/;
	return str.replace(re,'');
}


function checkEmailAddress(field) {

var goodEmail = field.search(/^[^\.][A-Za-z0-9_\-\.]*[^\.]\@[^\.][A-Za-z0-9_\-\.]+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.biz)|(\.us)|(\.bizz)|(\.coop)|(\..{2,2}))[ ]*$/gi);

if (goodEmail!=-1) {
    return true;
} else {
        return false;
    }
}
