function validate_Postcode(postalCode) {
	var postcodeStart = postalCode.substr(0, 2);

	if(postalCode.length > 3) {	
		var validFormat = /(((^[BEGLMNS][1-9]\d?)|(^W[2-9])|(^(A[BL]|B[ABDHLNRST]|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]|F[KY]|G[LUY]|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]|M[EKL]|N[EGNPRW]|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKL-PRSTWY]|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)\d\d?)|(^W1[A-HJKSTUW0-9])|(((^WC[1-2])|(^EC[1-4])|(^SW1))[ABEHMNPRVWXY]))(\s*)?([0-9][ABD-HJLNP-UW-Z]{2}))$|(^GIR\s?0AA$)/i;
		var isValid = validFormat.test(postalCode);
		return isValid;
	}
	else if (postalCode.length == 2 && isPostcodeStartIsland(postcodeStart)) {
		return true;
	}
	else {
		var validFormat = /^[a-z]{1,2}[0-9]{1,2}/i;
		var isValid = validFormat.test(postalCode);
		return isValid;
	}
}

function isPostcodeStartIsland(postcodeStart) {
	switch (postcodeStart.toUpperCase()) {
		case "GY":
		case "IM":
		case "JE":
			return true;
		default:
			return false;
	}
}