String.prototype.isEmailAddress = function () {return /^[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)*\@[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)+$/.test(this)}

onload = function () {
	document.forms[0].onsubmit = function () {
  	var e, i = 0
  	while (e = this.elements[i++]) {
  		if ((e.type == 'text' || e.type == 'textarea') && !/\S/.test(e.value)) {
  			alert ('Please, all fields are required.');
  			return false;
  		} else {
  			this.elements.hidden.value = 'verified';
  		}
  	}
	}
	
	document.forms[0].elements.address.onchange = function () {
		if (!this.value.isEmailAddress()) {
			alert ('That would not appear to be a valid email address.'); 
			this.value=''; 
			this.focus();
		}
	}
}
