
function checkForm(that) {
	var errmsg = '';
	if(that.Name.value.length < 1) {
		errmsg += '-> Name cannot be blank\n';
	}
	if (that.Phone.value.length < 1) {
		errmsg += '-> Phone cannot be blank\n';
	}
	if (that.Email.value.length < 1) {
		errmsg += '-> E-mail cannot be blank\n';
	} else {
		if (!isValidEmail(that.Email.value)) {
			errmsg += '-> Enter a valid E-mail address\n';
		}
	}
	if (that.location.selectedIndex == 0) {
		errmsg += '-> Select a Location\n';
	} else {
		if (that.classdate.selectedIndex == 0) {
			errmsg += '-> Select a Class Date\n';
		}
	}
	if (errmsg.length > 0) {
		alert ('Please fix the following errors:\n\n'+errmsg);
		return false;
	} else {
		return true;
	}
}

function isValidEmail(address) {
	if (address != '' && address.search) {
		if (address.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
	  	return true;
		} else {
			return false;
	  }
	} else {
		return true;
	}
}

