
function validateEventRegForm(aForm) {
	// alert('form name = '+aForm.name);
	payType = aForm.payment_type.options[aForm.payment_type.selectedIndex].value;
	// alert('paymentType = '+payType);
	var alertMsg = '';
	if ( ! aForm.email || ! emailIsValid(aForm.email.value) ) {
		alertMsg = alertMsg + 'You must enter a valid email address.\n';
		focusField = aForm.email;
	}
	// if paymentType is not check, then other CreditCard fields are required
	if ( payType != 'Check' ) {
		if ( ! aForm.ccnum || aForm.ccnum.value == '' ) {
			alertMsg = alertMsg + 'Please enter your credit card number when paying with '+payType+'\n';
			focusField = aForm.ccnum;
		}
		if ( ! aForm.ccsc || aForm.ccsc.value == '' ) {
			alertMsg = alertMsg + 'Please enter your credit card verification code'+'\n';
			focusField = aForm.ccsc;
		}
		if ( ! aForm.expiration || aForm.expiration.value == '' ) {
			alertMsg = alertMsg + 'Please enter your credit card expiration date'+'\n';
			focusField = aForm.expiration;
		}
	}
	if ( alertMsg != '' ) {
		alert(alertMsg);
		// alert('focusField = '+focusField.name);
		focusField.focus();
		return false;
	}
	return true;
}

function emailIsValid(str){
	if( str.indexOf("@") < 1 || str.indexOf(".") < 1 )
		return false;
	return true;
}
