function SearchClosestSuburb(n){var t=$("#search_keyword").val();t.indexOf(",")!=-1&&(n=t.substring(t.indexOf(",")+1),t=t.substring(0,t.indexOf(",")));$("#search_keyword").addClass("loading-icon");$(".search-icon").hide();$.getJSON("/SearchClosestSuburb",{value:t,state:n},function(n){n.status&&n.states!==null?($(".state-list-box").show(),$("#stateList option").remove(),n.states.forEach(function(n){$("#stateList").append($("<li>").text(n))}),$(".search-box, .footer-section").hide()):n.status?window.location.href="/contact-us/"+n.closestOffice:($("#search_keyword").removeClass("loading-icon"),$(".search-icon, .error-message").show(),$("#search_keyword").text("Enter postcode or suburb"),$(".footer-section").hide())})}function initialize(){var t=new google.maps.StyledMapType([{featureType:"landscape",elementType:"geometry.fill",stylers:[{weight:.1},{visibility:"on"},{color:"#dcdcdc"}]},{featureType:"road.highway",stylers:[{color:"#d0cdcd"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#aaaaaa"}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#cccccc"}]},{featureType:"poi",stylers:[{color:"#cccccc"}]},{},{featureType:"road.arterial",stylers:[{color:"#dadada"}]},{featureType:"road.local",stylers:[{color:"#cfcfcf"}]},{featureType:"transit",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"labels.icon",stylers:[{visibility:"off"}]}],{name:"Styled Map"}),i={zoom:13,center:new google.maps.LatLng(-33.8699,151.09),mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,"map_style"]}},n=new google.maps.Map(document.getElementById("map-canvas"),i);n.mapTypes.set("map_style",t);n.setMapTypeId("map_style")}(function(){var n,t,i,r;$(".state-list-box, .error-message").hide();n=$.fn.bmt("getQueryString","BD-Call")[0];n!=null?($(".banner-bg").hide(),$("#enquiry-form").attr("action","/BD-call-request"),t="<input id='Source' name='Source'class='hide' type='hidden' value='"+n+"'>",$("#Content").after(t),$("#PreferredTimeToCall").show(),i="BD Call request from website. Source: "+n,$("#Content").val(i),$("#Content, #Email").hide(),r="<div><center><h2 class='pt75 pt50-xs'>We'll call you <\/h2> <\/center> <\/div>",$(".form-text").after(r),$(".form-text").hide(),$("#submit-enquiry").val("Call Me")):$("#PreferredTimeToCall").hide();$("#search_keyword").autocomplete({source:function(n,t){$.ajax({url:"/SuburbPrediction",dataType:"json",data:{suburb:n.term},success:function(n){t(n)}})},minLength:3,open:function(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top")},close:function(){$(this).removeClass("ui-corner-top").addClass("ui-corner-all")}});$(".search-icon").click(function(){SearchClosestSuburb("")});$("#search_keyword").keyup(function(n){$(".error-message").hide();$(".footer-section").show();n.which==13&&SearchClosestSuburb("")});$(".ui-autocomplete").on("click","li",function(){SearchClosestSuburb("")});$("#stateList").on("click","li",function(){var n=$(this).text();SearchClosestSuburb(n)});$("#search_keyword").click(function(){$(".error-message").hide();$(".footer-section").show()});$(document).on("keyup","input.error",function(){$(this).removeClass("error");$("label[class='error']").hide();$(".error").remove()});$(document).on("click","input.error",function(){$(this).removeClass("error");$("label[class='error']").hide()});$("#enquiry-form").validate({rules:{Name:{required:!0},Email:{required:{depends:function(){return n==null?!0:!1}},email:{depends:function(){return n==null?!0:!1}}}},messages:{Name:{required:"Please enter your name"},Email:{required:"Please enter your email",email:"Please enter a valid email address"}}})})(jQuery)