$(function(){$(".js-title-select").val()=="Other"?$(".other-title").show():($(".other-title").hide(),$(".other-title").next(".field-validation-error").hide(),$(".other-title").val(""));$(".js-title-select").on("change",function(){$(this).val()=="Other"?($(".other-title").show(),$(".other-title").next(".field-validation-error").show()):($(".other-title").hide(),$(".other-title").next(".field-validation-error").hide(),$(".other-title").val(""))});$("#PostCode").keyup(function(){var t=$("#PostCode").val();t.length>=3&&($(this).focus(),$.ajax({url:"/postcode/"+t,type:"GET",contentType:"application/json; charset=utf-8",success:function(t){$(".js-geolocation-found").html(""),$.each(t,function(t,i){n(i.Suburb,i.State,i.PostCode,i.Suburb+", "+i.State+", "+i.PostCode)}),$(".js-geolocation-found").slideDown(200)},error:function(){$(".js-geolocation-found").html('<li class="no-postcode-results">No matches were found.<\/li>')}}))});var n=function(n,t,i,r){$(".js-geolocation-found").append('<li data-postcode="'+i+'" data-suburb="'+n+'" data-state="'+t+'" class="js-select-address">'+r+"<\/li>"),$(".js-select-address").unbind(),$(".js-select-address").bind("click",function(){$(".js-address-text").val($(this).html()),$(".js-select-address").hide(),$("#Suburb").val($(this).data("suburb")),$("#State").val($(this).data("state")),$("#PostCode").val($(this).data("postcode")),$(".js-geolocation-found").hide()})};$(document).click(function(n){$(n.target).closest(".js-geolocation-found").length||$(".js-geolocation-found").is(":visible")&&$(".js-geolocation-found").hide()})})