function checkPersInfo(form) {
	var ftyp = form.ftyp.value;
	if (ftyp == 'don') { // these fields not required for donation 
		//form.First_name.optional = true;
		//form.Last_name.optional = true;
		form.Street.optional = true;
		form.City.optional = true;
		form.State.optional = true;
		form.Zip_code.optional = true; 
		form.Phone_type.optional = true;
	} 
	form.Email_address.optional = false;
	form.RenewReport.optional = true;
	form.State.validate = "state";
	form.Zip_code.validate = "zipcode";
	form.Email_address.validate = "email";
	if (ftyp=='new' || ftyp=='ren') {
		form.Email_address2.optional = true;
		form.Email_address2.validate = "email";
	}	
	
	form.Telephone_number.isValid = isValidTelNo;
	form.Telephone_number.optional = false; //doesn't work at preset, not being a text field

	form.phone_a.ignore = true;
	form.phone_b.ignore = true;
	form.phone_c.ignore = true;
}

function isValidTelNo(e) {
	var err = 0;
	var area = document.getElementsByName("phone_a").item(0);
	var exch = document.getElementsByName("phone_b").item(0);
	var ext = document.getElementsByName("phone_c").item(0);
	if (area.value=="" && exch.value=="" && ext.value=="") return true;
	if (area.value == "" || !isValidInt3(area)) {addErrorToNearestLabel(area); area.className += " error";err++;}
	if (exch.value == "" || !isValidInt3(exch)) {addErrorToNearestLabel(exch); exch.className += " error";err++;}
	if (ext.value == "" || !isValidInt4(ext)) {addErrorToNearestLabel(ext); ext.className += " error";err++;}
	if (err) {
		e.msg = "must be of form 123-456-7890"
		return false;
	}
	return true;
}

function isValidInt3 (e) {
	if(!e.value) return true;
	var x = /^\d{3}$/;
	if (x.test(e.value)) return true;
	e.msg = ": must be 3 digits";
	return false;
}

function isValidInt4 (e) {
	z = !e.value;
	if(!e.value) return true;
	var x = /^\d{4}$/;
	if (x.test(e.value)) return true;
	e.msg = ": must be 4 digits";
	return false;
}


