function mappostcode(){var alpha1="[abcdefghijklmnoprstuwyz]";var alpha2="[abcdefghklmnopqrstuvwxy]";var alpha3="[abcdefghjkpmnrstuvwxy]";var alpha4="[abehmnprvwxy]";var alpha5="[abdefghjlnpqrstuwxyz]";var pcexp=new Array();pcexp.push(new RegExp("^("+alpha1+"{1}"+alpha2+"?[0-9]{1,2})(\\s*)([0-9]{1}"+alpha5+"{2})$","i"));pcexp.push(new RegExp("^("+alpha1+"{1}[0-9]{1}"+alpha3+"{1})(\\s*)([0-9]{1}"+alpha5+"{2})$","i"));pcexp.push(new RegExp("^("+alpha1+"{1}"+alpha2+"{1}"+"?[0-9]{1}"+alpha4+"{1})(\\s*)([0-9]{1}"+alpha5+"{2})$","i"));pcexp.push(/^(GIR)(\s*)(0AA)$/i);pcexp.push(/^(bfpo)(\s*)([0-9]{1,4})$/i);pcexp.push(/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);pcexp.push(/^([A-Z]{4})(\s*)(1ZZ)$/i);var postCode=$('#pc').val();var valid=false;for(var i=0;i<pcexp.length;i++){if(pcexp[i].test(postCode)){pcexp[i].exec(postCode);postCode=RegExp.$1.toUpperCase()+" "+RegExp.$3.toUpperCase();postCode=postCode.replace(/C\/O\s*/,"c/o ");valid=true;break;}}
if(valid){$('#pc').attr("value",postCode);complete="yes";}else{complete="no";}}
