").show();else if(u.length==0)$("#EmptyResults").html("Sorry, we could not retrieve any addresses for the post code entered. Please enter the address manually. ").show();else{for(n.append($("<\/option>").val(0).html("Please select an address")),f=0;f<\/option>").val(u[f].Id).html(u[f].StreetAddress+", "+u[f].Place));$("#EmptyResults").hide();r.show("slow");$("#findAddressBtn").hide();$(".overseas").hide()}},error:function(){alert("Failed to retrieve postcodes.");t.hide()}})}}function displayPostcodes4u(n){n==82?$("p.overseas").is(":visible")&&$(".findAddress").show():($(".company, .country, .county, .city, .address1, .address2").slideDown(),$(".address-lookup").show(),$("#findAddressBtn").hide(),$(".overseas").hide())}$(document).ready(function(){$("#CountryId").change(function(){var n=$(this).val();displayPostcodes4u(n)})});$(function(){$(".ddlPostcodes").change(function(){var e=this.options[this.selectedIndex].value,t=$("#StreetAddress"),i=$("#StreetAddress2"),r=$("#City"),u=$("#ZipPostalCode"),f=$("#Company"),n=$("#StateProvinceId"),o=$(".postcode-results");$(t).val("");$(i).val("");$(r).val("");$(n).val("");$(u).val("");$.ajax({cache:!1,type:"GET",url:"/Postcodes4u/GetAddressById",data:{postcodeId:e},success:function(e){var e=JSON.parse(e),s,h;for(e.length==0&&$("#EmptyResults").html("Sorry, no matching post codes found.").show(),s=e.Address,t.val(s.Line1),s.PostTown!=s.Line2&&i.val(s.Line2),r.val(s.PostTown),u.val(s.Postcode),f!=null&&f.val(s.Company),h=0;h