
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	else 
		countfield.value = maxlimit - field.value.length;
	}

function checkreg_2010_04_12() {
	var HowManyErrors = 0;
	errorColor = '#ffff99';
	normalColor = '#ffffff';
	document.getElementById('ErrorMessages').style.background = normalColor;
	document.getElementById('ErrorMessages').innerHTML = "";
	
	if (document.RegForm.SALUTATION.value=="") { 
			 document.RegForm.SALUTATION.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.SALUTATION.style.background = normalColor; }
	if (document.RegForm.FIRST_NAME.value=="") {
			 document.RegForm.FIRST_NAME.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.FIRST_NAME.style.background = normalColor; }
	if (document.RegForm.LAST_NAME.value=="") {
			 document.RegForm.LAST_NAME.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.LAST_NAME.style.background = normalColor; }
	if (document.RegForm.MAILING_ADDRESS.value=="") {
			 document.RegForm.MAILING_ADDRESS.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.MAILING_ADDRESS.style.background = normalColor; }
	if (document.RegForm.CITY.value=="") {
			 document.RegForm.CITY.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.CITY.style.background = normalColor; }
	if (document.RegForm.PROVINCE.value=="") {
			 document.RegForm.PROVINCE.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.PROVINCE.style.background = normalColor; }
	if (document.RegForm.POSTAL_CODE.value=="") {
			 document.RegForm.POSTAL_CODE.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.POSTAL_CODE.style.background = normalColor; }
	if (document.RegForm.WORK_TELEPHONE.value=="") {
			 document.RegForm.WORK_TELEPHONE.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.WORK_TELEPHONE.style.background = normalColor; }
	if (document.RegForm.EMAIL.value=="") {
			 document.RegForm.EMAIL.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.EMAIL.style.background = normalColor; }
	if (document.RegForm.EMAIL2.value=="") {
			 document.RegForm.EMAIL2.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.EMAIL2.style.background = normalColor; }
	// check that both emails match
	if (document.RegForm.EMAIL.value!=document.RegForm.EMAIL2.value) {
			 document.RegForm.EMAIL.style.background = errorColor;
			 document.RegForm.EMAIL2.style.background = errorColor;
			 HowManyErrors++;
	}
	if (document.RegForm.HEAR_ABOUT.value=="") {
			 document.RegForm.HEAR_ABOUT.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.HEAR_ABOUT.style.background = normalColor; }
	if (document.RegForm.HEAR_ABOUT.value=="Other") {
		if (document.RegForm.HEAR_ABOUT_OTHER.value=="") {
				 document.RegForm.HEAR_ABOUT_OTHER.style.background = errorColor; HowManyErrors++;
		} else { 
			document.RegForm.HEAR_ABOUT_OTHER.style.background = normalColor;
			document.RegForm.HEAR_ABOUT.value = document.RegForm.HEAR_ABOUT_OTHER.value;
		}
	}
	if (document.RegForm.SIGNUP.value=="") {
			 document.RegForm.SIGNUP.style.background = errorColor; HowManyErrors++;
	} else { document.RegForm.SIGNUP.style.background = normalColor; }
	
	
	if(HowManyErrors != 0) {
		messageList = "Please complete the form.";
		document.getElementById('ErrorMessages').style.background = errorColor;
		document.getElementById('ErrorMessages').innerHTML = messageList;
		return false;
	} else {
		startupload();
		return true;
	}
	
}
