// Checks the validity of the given postcode value.
function isValidPostcode(postcodeString) {
errorMsg = 'Australian postcodes are 3 or 4 digit numbers between 200-300\nor 800-9999. Australian postcodes don\'t contain characters.';
var postcodeNum = parseInt(postcodeString);
if ((postcodeNum < 200) || (postcodeNum > 300 && postcodeNum <800)) {
	alert(errorMsg);
	return false;
} 

	// The postcode cannot be NULL.
	if (postcodeString.length == 0) {
		alert('Please enter a postcode');
		return false;
	}

	// Postcode must contain 3 or 4 digits, and no characters.
	numberOfDigits = 0;
	for (i = 0; i < postcodeString.length; i++) {
		digit = parseInt(postcodeString.charAt(i));
		if (isNaN(digit)) {
			alert(errorMsg);
			return false;
		}
		numberOfDigits++;
	}
	if (numberOfDigits != 3 && numberOfDigits != 4) {
		alert(errorMsg);
		return false;
	}

	return true;
}