function zip_check(zip) {
	var apcf = document.policy_info;
	zip = apcf.zip_code.value;
	if (zip.length == 3) {
		//Do a check to see if first three characters take the form of a postal code
		postal = apcf.zip_code.value;
		postal = postal.toUpperCase();

		validPostal = /[A-Z].[A-Z]/; //Regular expression for first three chars of a postal code
		newPostal = validPostal.test(postal);

		if (newPostal) {
			appear("d_postal_code");
			apcf.postal_code1.value = apcf.zip_code.value;
			apcf.postal_code2.focus();
//			to_zero_postal();
			apcf.zip_code.value = "";
			disappear("d_zip_code");
		}
	}
}

function postal_check() {
	var apcf = document.policy_info;

	//Check for invalid postal code in first three characters & swap to zip code if it is invalid
	postal = apcf.postal_code1.value;
	postal = postal.toUpperCase();

	validZip = /[0-9]{3}/; //Regular expression for first three digits of a zip code
	newZip = validZip.test(postal);

	if (newZip) {
		disappear("d_postal_code");
		appear("d_zip_code");
		apcf.zip_code.value = apcf.postal_code1.value + apcf.postal_code2.value;
		apcf.postal_code1.value = "";
		apcf.postal_code2.value = "";
		apcf.zip_code.value = apcf.zip_code.value.substring(0,5);
		apcf.zip_code.focus();
	}
	if (apcf.postal_code1.value.length == 3 && apcf.postal_code2.value.length == 3 && !newZip) {
		//Postal code is full, send off to Canadian
		apcf.postal_code1.value = apcf.postal_code1.value.toUpperCase();
		apcf.postal_code2.value = apcf.postal_code2.value.toUpperCase();
		apcf.submit();
		
	}
}

