var PAGE=function(n,t,i){"use strict";function st(n,t,r,u){if(typeof n=="undefined"||n.length===0){u(n);return}var f=n.concat(),s=r===i||r==null,e=0,o=function(){var l=+new Date,h,c;do h=f.shift(),c=r,s&&(c=h),h===i,t.call(c,h,e),e++;while(f.length>0&&+new Date-l<50);f.length>0?setTimeout(o,25):u(n)};setTimeout(o,25)}function l(t,i,r){var u=n.Deferred();return st(t,i,r,function(){u.resolveWith(r)}),u}function it(n){var t=document.createElement("div");return t.innerHTML=n,t.childNodes.length===0?"":t.childNodes[0].nodeValue}var r,f,o={},v,u=n(t).width(),e=navigator.userAgent.toLowerCase(),k=Modernizr.touch||e.match(/(iphone|ipod|ipad)/)||e.match(/(android)/)||e.match(/(iemobile)/)||e.match(/iphone/i)||e.match(/ipad/i)||e.match(/ipod/i)||e.match(/blackberry/i)||e.match(/bada/i),y=function(n,t){var a=n("#main-header"),r,e=!1,s=0,h=400,v,o=!1,u=!1,c=0,y=0,i=null,l=function(){var t=n("#refine-results-button");t.length!=0&&(e=a.css("position")=="fixed",r=a.height(),s=t.offset().top,h=t.get(0).getBoundingClientRect().width,v=t.height())},f=function(){var a=n(t).scrollTop(),w,f,b,l,k;w=e?s-a-r:s-Math.max(a,r);var d=n("#search-results").data("jsp"),tt=function(){var t=0;return t=typeof d!="undefined"?d.getContentPositionY():n("#search-results").scrollTop(),t>150&&n("#back-to-top").fadeIn("slow"),t},it=tt();if(w-=it,w<=0){if(f=0,f=e?r:r-a,f<0&&(f=0),b=n("#refine-results-button"),l=b.offset().left-n(t).scrollLeft(),o){(f!=c||l!=y)&&i.css({position:"fixed",top:f,left:l,zIndex:"10",width:h+"px"});var g=n("#map-canvas"),rt=g.offset().top+g.height(),nt=a+v+20;e&&(nt+=r);k=rt>nt;k&&!u?(i.show(),u=!0):!k&&u&&(i.hide(),u=!1)}else i=b.clone(!0),i.css({position:"fixed",top:f,zIndex:"10",width:h+"px",left:l,marginLeft:0,marginRight:0}),n(document.body).append(i),o=!0,u=!0;c=f;y=l}else p()},p=function(){o&&(i.remove(),i=null);o=!1;c=0},w=function(){var r=n("#refine-results-button"),i;if(n("#refine-results-button").length!=0&&n("#map-canvas").length!=0){l();f();n(t).resize(function(){l();f()});i=n(document);i.scroll(f);i.on("touchmove gesturechange",f)}};return{init:w,updateButtonOffset:l,removeFixedRefine:p,customRefine:f}}(jQuery,t),rt=function(){function o(){n(".shortcut-show-vacancies.hide-only-mobile").on("click",function(){var t=n(this).parents(".search-results-item_inner").find(".calendar-vacancies"),i,r;n(t).show();i=t.offset();r=i.top;t.is(":visible")&&n("html, body").animate({scrollTop:r-70},400)})}function c(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return""}var e,r,s,h;typeof parentCentreFavourites!="undefined"&&parentCentreFavourites!=null&&parentCentreFavourites.initMapResult();navigator.userAgent.indexOf("Safari")!=-1||k?(v="_parent",n(".has-tip").click(function(){n("body").find("span.tooltip").css("display","none")})):v="_newtab";k&&navigator.userAgent.indexOf("Firefox")!=-1&&(n("html").removeClass("touch"),n("html").addClass("no-touch "));n(".jumptoSection").prop("selectedIndex",0);e={contact:"contact-us-modal",waitlist:"waitllist-login-modal","rating-tags":"rating-tag-modal",reviewpost:"post-review-modal","share-friend":"share-with-friends-modal","get-directions":"get-directions-modal","request-tour":"request-tour-modal","request-tour-embedded":"embedded-requesttour-modal"};n(document).on("change",".jumptoSection",function(){var h=n(this),r=h.find("option:selected"),o=r.val(),f=r.attr("go-url"),s=!1,c,l,a;f!==i?(o=="view-profile"?t.open(f,v):o=="waitlist"?(APP.analyticsTrackOutgoingLinkEvent(f,r.get(0)),t.open(f,v)):(APP.analyticsTrackOutgoingLinkEvent(f,r.get(0)),t.open(f,"_parent")),s=!0):(c=e[o],c&&(l=r.attr("data-reveal-ajax"),l&&n("#"+c).foundation("reveal","open",r.attr("data-reveal-ajax")),s=!0),u<990&&(o=="vacancies"||o=="fees")&&(a=h.parents(".search-results-item_inner").find(".row-vacancy-fees").find(".calendar-vacancies"),n(a).show(),s=!0));s&&h.prop("selectedIndex",0)});n(document).on("change",".place-on-map .jump-to > .jumptoSection",function(){var r=n(this).find("option:selected"),t=r.val(),i=n(this).parents(".search-results-item_inner").find(".row-vacancy-fees").find(".calendar-vacancies");(t=="vacancies"||t=="fees")&&(n(i).show(),f.setContent(f.getContent()),n(this).prop("selectedIndex",0));t=="fees"&&setTimeout(function(){var n=i.find(".vacanciesInfo").height()+10;i.scrollTop(n)},200)});n("#add-additional-carer").length>0&&n("#add-additional-carer").click(function(){var t=n(this).parents(".additional-btn");return t.before('<div class="additiona-row-added margin-top-15"><div class="row"><div class="large-12 columns"><h6>additional carer<\/h6><\/div><\/div><div class="row"><div class="medium-4 large-4 columns"><label>Salutation<input type="text" placeholder="Salutation"><\/label><\/div><div class="medium-4 large-4 columns"> <label>First name*<input type="text" placeholder="First name"><\/label><\/div><div class="medium-4 large-4 columns"> <label>Last name*<input type="text" placeholder="Last name"><\/label><\/div><\/div><!--/row--><div class="row"><div class="medium-6 large-6 columns"><label>Occupation<input type="text" placeholder="Occupation"><\/label><\/div> <div class="medium-6 large-6 columns"><label>Employer<input type="text" placeholder="Employer"><\/label><\/div><\/div><!--/row--><div class="row"><div class="large-12 columns"><label>Home address<input type="text" placeholder="Home address"><\/label><\/div><\/div><div class="row"><div class="medium-4 large-4 columns"><label>Suburb*<input type="text" placeholder="Suburb"><\/label><\/div><!--/col--><div class="medium-4 large-4 columns"><label>Postcode*<input type="text" placeholder="Postcode"><\/label><\/div><div class="medium-4 large-4 columns"><label>State*<input type="text" placeholder="State"><\/label><\/div><\/div><div class="row"><div class="medium-4 large-4 columns"><label>Home phone*<input type="text" placeholder="Home phone"><\/label><\/div> <div class="medium-4 large-4 columns"><label>Work phone*<input type="text" placeholder="Work phone"><\/label><\/div><div class="medium-4 large-4 columns"><label>Mobile phone*<input type="text" placeholder="Mobile phone"><\/label><\/div><\/div><div class="row"><div class="large-12 columns"><label>Email address*<input type="text" placeholder="Email address"><\/label><\/div><\/div><\/div><!--/addtional row end-->'),!1});n("#search-results").jScrollPane({verticalDragMinHeight:80,verticalDragMaxHeight:80,horizontalDragMinWidth:20,horizontalDragMaxWidth:20,verticalGutter:20});y.init();n(t).resize(function(){u=n(t).width();u<990?n("#search-results").data("jsp")!=null&&n("#search-results").data("jsp").destroy():(n("#search-results").jScrollPane({verticalDragMinHeight:80,verticalDragMaxHeight:80,horizontalDragMinWidth:20,horizontalDragMaxWidth:20,verticalGutter:15}),y.updateButtonOffset(),n("#map-canvas").length>0&&nt())});n(document).on("click",".accordion a.acTab",function(t){t.preventDefault();var i=n(this).attr("href");n(i).toggle();u>=990&&f.setContent(f.getContent())});n(document).on("click",".place-on-map .ribbon.vacancy.available, .place-on-map .shortcut-show-vacancies",function(t){t.preventDefault();var i=n(this).parents(".search-results-item_inner").find(".calendar-vacancies");n(i).show();u>=990&&f.setContent(f.getContent())});if(u<990){n(".ribbon.vacancy.available").on("click",function(t){var i=n(this).parents(".search-results-item_inner").find(".calendar-vacancies"),r;n(i).show();r=n(this).offset();i.is(":visible")&&n("html, body").scrollTop(r.top);t.preventDefault();t.stopPropagation()});o()}n(t).resize(function(t){if(u<990){n(".ribbon.vacancy.available").on("click",function(){var t=n(this).parents(".search-results-item_inner").find(".calendar-vacancies"),i;n(t).show();i=n(this).offset();t.is(":visible")&&n("html, body").scrollTop(i.top)});t.preventDefault();t.stopPropagation()}o()});n(document).on("click",".place-on-map .marker_close",function(){f!==i&&(f.close(),f=i,n("div.gm-style-iw").next("div").removeClass("gmaps-close-icon"),n(".jumptoSection").prop("selectedIndex",0),n(".map-refresh-controlr").removeClass("hide"))});if(n("#map-canvas").length>0&&u>=990&&nt(),n("#map-canvas").length>0&&navigator.platform==="iPad"){if(r=function(){n("#flipMEssage").remove();n("#flip_bg").remove()},t.matchMedia("(orientation: portrait)").matches&&(s=c("childCare-flip"),s=="")){h=n('<div id="flip_bg" style=""><\/div><div id="flipMEssage"><a class="close-flip">X<\/a><div class="flImg"><img src="'+c4k.urls.assets+'img/flipIcon.png"><\/div><div class="flcont"><h5>Want a better view? <\/h5><p>Flip sideways...<\/p><\/div><\/div>');n("body").append(h);n(document).on("click",".close-flip",r);document.cookie="childCare-flip=flipPortrait"}t.onorientationchange=function(){t.matchMedia("(orientation: landscape)").matches&&r()}}et.init();ut.init();ft.init();ot.init();n("#map-zero-result-modal").foundation("reveal","open");setTimeout(function(){n(".prompt_mappage").addClass("load").delay(15e3).queue(function(){n(this).removeClass("load")})},2e3)},ut=function(n){var t=function(){var t=n("#carer-search-form");if(t.length>0){n(function(){var n=APP.urlFormatters.carerResults.parseCurrentUrl();if(n==null){alert("markg: could not parse current url to get the carer filter values. is the url in the correct format? note: the design template page does not have the correct format");return}t.find("select[name=numChildren]").val(n.numChildren);t.find("input[type=checkbox][name=questionIds]").prop("checked",!1);n.questionIds&&forEach(n.questionIds,function(n){t.find("input[type=checkbox][name=questionIds][value="+n+"]").prop("checked",!0)});t.find("input[type=checkbox][name=additionalLanguageIds]").prop("checked",!1);n.additionalLanguageIds&&forEach(n.additionalLanguageIds,function(n){t.find("input[type=checkbox][name=additionalLanguageIds][value="+n+"]").prop("checked",!0)});t.find("#childCareType-error").hide()});n("#apply-filters").on("click",function(i){var r,u;i.preventDefault();i.stopPropagation();r=[];t.find("input[type=checkbox][name=additionalLanguageIds]:checked").each(function(t){r[t]=n(this).val()});u=[];t.find("input[type=checkbox][name=questionIds]:checked").each(function(t){u[t]=n(this).val()});var f=t.find("select[name=numChildren]").val(),e={numChildren:f,questionIds:u,additionalLanguageIds:r},o=t.find("input.autocomplete-search"),s=o.data("currentItem"),h=APP.urlFormatters.carerResults.parseCurrentUrl(),c=n.extend({},h,s,e),l=APP.urlFormatters.carerResults.format(c);document.location.href=l;return})}};return{init:t}}(jQuery,t),ft=function(n){var t=function(){var t=n("#babysitter-search-form");if(t.length>0){n(function(){var n=APP.urlFormatters.babysitterResults.parseCurrentUrl();if(n==null){alert("markg: could not parse current url to get the babysitter filter values. is the url in the correct format? note: the design template page does not have the correct format");return}t.find("input[name=date]").val(n.date);t.find("input[name=startTime]").val(n.startTime);t.find("input[name=endTime]").val(n.endTime);t.find("#childCareType-error").hide()});n("#apply-filters").on("click",function(i){i.preventDefault();i.stopPropagation();var r=t.find("input[name=date]").val(),u=t.find("input[name=startTime]").val(),f=t.find("input[name=endTime]").val(),e={date:r,startTime:u,endTime:f},o=t.find("input.autocomplete-search"),s=o.data("currentItem"),h=APP.urlFormatters.babysitterResults.parseCurrentUrl(),c=n.extend({},h,s,e),l=APP.urlFormatters.babysitterResults.format(c);document.location.href=l;return})}};return{init:t}}(jQuery,t),et=function(n,t,i){var r=function(){var r=n("#search-refine-maps"),t;if(r.length>0){t=r.find("form");n(document).on("open.fndtn.reveal","#search-refine-maps[data-reveal]",function(r){var u,f,e,o,l;if(r.namespace==="fndtn.reveal"){if(u=APP.urlFormatters.mapResults.parseCurrentUrl(),u===null){alert("markg: could not parse current url to get the refine modal values. is the url in the correct format? note: the design template page does not have the correct format");return}t.find("input[type=radio][name=showServices][value="+u.show+"]").prop("checked",!0);t.find("input[type=checkbox][name=childCareType]").prop("checked",!1);u.types?n.isArray(u.types)&&u.types.length>1&&forEach(u.types,function(n){t.find("input[type=checkbox][name=childCareType][value="+n+"]").prop("checked",!0)}):u.providerType==="child-care"?t.find("input[type=checkbox][name=childCareType]").prop("checked",!0):t.find("input[type=checkbox][name=childCareType][value="+u.providerType+"]").prop("checked",!0);t.find("input[type=checkbox][name=daysOfWeek]").prop("checked",!1);u.day&&forEach(u.day,function(n){t.find("input[type=checkbox][name=daysOfWeek][value="+n+"]").prop("checked",!0)});t.find("select[name=childAge]").val(u.childAge);t.find("select[name=childAgeUnit]").val(u.childAgeUnit);f=typeof u.overnightCare!="undefined"&&u.overnightCare&&u.overnightCare.toLowerCase()==="true";e=t.find("#overnightCare");e.prop("checked",f);o=e.next("span").children("i");f?o.addClass("pc-icon"):o.removeClass("pc-icon");t.find("[name=location]").val(u.postcode);var h=t.find("input.autocomplete-search"),s=i,a=u.suburbSlug,c=document.getElementById("results-suburb-autocomplete-current-item");c!==null&&(l=it(c.getAttribute("data-json")),s=JSON.parse(l));typeof s=="undefined"||a===null?h.val(u.postcode):h.customAutocomplete("setCurrentItem",s);t.find("#childCareType-error").hide();r.stopPropagation();r.preventDefault()}});t.on("submit",function(i){var f,o,u,p,v;if(i.preventDefault(),i.stopPropagation(),f=[],t.find("input[type=checkbox][name=childCareType]:checked").each(function(t){f[t]=n(this).val()}),o=t.find(".autocomplete-search.ui-autocomplete-input"),f.length==0||o.val().length==0)return f.length==0&&t.find("#childCareType-error").css("display","inline-block"),o.val().length==0&&o.addClass("invalid"),!1;var e=APP.urlFormatters.mapResults.parseCurrentUrl(),w=t.find("input[type=radio][name=showServices]:checked").val(),b=t.find("select[name=childAge]").val(),k=t.find("select[name=childAgeUnit]").val(),a=t.find("#overnightCare:checked").val();typeof a=="undefined"&&(a=null);u={show:w,childAge:b,childAgeUnit:k,overnightCare:a};f.length==1?(u.types=null,u.providerType=f[0]):(u.providerType="child-care",p=f.length==n("input[type=checkbox][name=childCareType]").length,u.types=p?null:f.sort());v=[];t.find("input[type=checkbox][name=daysOfWeek]:checked").each(function(t){v[t]=n(this).val()});u.day=v;var g=t.find("input.autocomplete-search"),y=g.data("currentItem"),c=!1;y!==null&&(c4k.countryCode==="AU"?c=e!==null&&e.postcode!==u.postcode:c4k.countryCode==="NZ"&&(c=e!==null&&e.featureId!==u.featureId),c&&n("form[data-autocomplete-form].autocomplete-header .autocomplete-search").each(function(){var t=n(this);t.customAutocomplete("setCurrentItem",y)}));var l=n.extend({},e,y,u),nt=APP.urlFormatters.mapResults.format(l),tt={method:"map search",autocompleteItem:null,searchCriteria:l};d(tt,"search",nt);r.foundation("reveal","close");c||!s.isSearchWhenMoveChecked()?h(l,!0,!1,!0):s.searchCurrentBounds(l,!0);return})}};return{init:r}}(jQuery,t),ot=function(n){var t=function(){var t=n("#agency-search-form");if(t.length>0){n(function(){var n=APP.urlFormatters.agencyResults.parseCurrentUrl();if(n===null){alert("markg: could not parse current url to get the agency filter values. is the url in the correct format? note: the design template page does not have the correct format");return}t.find("input[type=checkbox][name=services]").prop("checked",!1);n.services&&forEach(n.services,function(n){t.find('input[type=checkbox][name=services][value="'+n+'"]').prop("checked",!0)});t.find("#childCareType-error").hide()});n("#apply-filters").on("click",function(i){var r;i.preventDefault();i.stopPropagation();r=[];t.find("input[type=checkbox][name=services]:checked").each(function(t){r[t]=n(this).val()});var u={services:r},f=t.find("input.autocomplete-search"),e=f.data("currentItem"),o=APP.urlFormatters.agencyResults.parseCurrentUrl(),s=n.extend({},o,e,u),h=APP.urlFormatters.agencyResults.format(s);document.location.href=h;return})}};return{init:t}}(jQuery,t),p="state"in t.history&&t.history.state!==null,d=function(n,t,i){p=!0;history.pushState(n,t,i)},s,c,h;t.addEventListener("popstate",function(n){var i=n.state!==null?n.state.searchCriteria:null,r,u,f;if(typeof i!="undefined"&&i!==null)p=!0,h(i,!0,!1,!0);else{if(!p){p=!0;return}r=!0;t.history.state!==null&&typeof t.history.state.searchCriteria!="undefined"&&(i=t.history.state.searchCriteria,u=APP.urlFormatters.mapResults.format(i),f=location.pathname+(location.search!=null&&location.search!=""?"?"+location.search:""),r=f!=u);r&&(i=APP.urlFormatters.mapResults.parseCurrentUrl(),i!==null?h(i,!0,!1,!0):t.location.reload(!0))}});s=function(n,t){function p(n,t,i){return t!=null&&(n=Math.max(n,t)),i!=null&&(n=Math.min(n,i)),n}function w(n){return n*(Math.PI/180)}function b(n){return n/(Math.PI/180)}function u(){this.pixelOrigin_=new google.maps.Point(r/2,r/2);this.pixelsPerLonDegree_=r/360;this.pixelsPerLonRadian_=r/(2*Math.PI)}function o(n,t){var e=new u,i=e.fromLatLngToPoint(n),f=new google.maps.Point(i.x*Math.pow(2,t),i.y*Math.pow(2,t));return new google.maps.Point(Math.floor(f.x/r),Math.floor(f.y/r))}var r=256;u.prototype.fromLatLngToPoint=function(n,t){var i=this,r=t||new google.maps.Point(0,0),f=i.pixelOrigin_,u;return r.x=f.x+n.lng()*i.pixelsPerLonDegree_,u=p(Math.sin(w(n.lat())),-.9999,.9999),r.y=f.y+.5*Math.log((1+u)/(1-u))*-i.pixelsPerLonRadian_,r};u.prototype.fromPointToLatLng=function(n){var t=this,i=t.pixelOrigin_,r=(n.x-i.x)/t.pixelsPerLonDegree_,u=(n.y-i.y)/-t.pixelsPerLonRadian_,f=b(2*Math.atan(Math.exp(u))-Math.PI/2);return new google.maps.LatLng(f,r)};var l=!0,f=null,i=null,e=!1,k=function(){e=!0},d=function(){e=!1},a=function(t,i){var tt=f,a=tt.getBounds(),b,et,ot,e,k,l;if(typeof a!="undefined"){c.show();i||(i=!1);for(var d=a.getNorthEast(),g=a.getSouthWest(),it=new google.maps.LatLng(d.lat(),g.lng()),rt=new google.maps.LatLng(g.lat(),d.lng()),v=12,y=[],r=o(it,v),p=o(rt,v),w=p.x-r.x+1,ut=p.y-r.y+1,st=Math.pow(2,v),ft=r.x,nt=r.y;ut--;){while(w--)y.push({x:ft+w,y:nt});nt++;w=p.x-r.x+1}for(b=[],et=new u,t||(t=APP.urlFormatters.mapResults.parseCurrentUrl()),t?(delete t.postcode,delete t.suburb,delete t.featureId):t={},ot=APP.urlFormatters.mapResults.format(t),e=0;e<y.length;e++)k=y[e],l=n.extend({},t),l.x=k.x,l.y=k.y,b.push(l);h(b,i,!0,!1,function(){s.setEnabled(!0)})}},v=function(){s.setEnabled(!1);i!=null&&(t.clearTimeout(i),i=null);a()},y=15,g=function(){if(!e){i!=null&&(t.clearTimeout(i),i=null);var n=f;if(n.getZoom()<y){c.hide();return}l&&(i=t.setTimeout(v,50))}},nt=function(){var i=f,t=n(".map-auto-refreshr");i.getZoom()<y?(t.find("input").prop("disabled",!0),t.attr("title",'Please zoom in closer to enable "Search When I Move"'),t.attr("data-toggle","tooltip"),t.attr("data-placement","bottom"),t.find("small").css("color","#aaaaaa")):(t.find("input").prop("disabled",!1),t.attr("title",null),t.attr("data-toggle",null),t.find("small").css("color",""))},tt=function(t){var r=n("input.map-auto-refresh-checkbox"),i=null,u=null,e=null,o=null;r.length!=0&&(f=t,o=google.maps.event.addListener(t,"zoom_changed",nt),r.change(function(){var f=n(this),r=f.prop("checked");r&&i==null?(v(),i=google.maps.event.addListener(t,"idle",g),u=google.maps.event.addListener(t,"dragstart",k),e=google.maps.event.addListener(t,"dragend",d)):r||i==null||(google.maps.event.removeListener(i),i=null,google.maps.event.removeListener(u),u=null,google.maps.event.removeListener(e),e=null)}),r.trigger("change"))};return{init:tt,setEnabled:function(n){l=n},isSearchWhenMoveChecked:function(){var t=n("input.map-auto-refresh-checkbox");return t.prop("checked")},searchCurrentBounds:a}}(jQuery,t);n.ajaxTransport("+document",function(n,i,r){if(t.FormData&&n.dataType&&n.dataType=="document")return{send:function(t,i){var r=new XMLHttpRequest,u=n.url,f=n.type,e=n.data||null;r.addEventListener("load",function(){var t={};t[n.dataType]=r.response;i(r.status,r.statusText,t,r.getAllResponseHeaders())});r.open(f,u,!0);r.responseType="document";r.send(e)},abort:function(){r.abort()}}});c=function(n,t){var i=null,r=function(){i&&(t.clearTimeout(i),i=null)},u=function(){r();n(".refine-loading").show()},f=function(u){r();var f=50;u&&(f=500);i=t.setTimeout(function(){n(".refine-loading").hide();i=null},f)};return{show:u,hide:f}}(jQuery,t);h=function(i,f,e,h,a){var p,d,nt,tt,g,b,k,it,rt,ut,v;if(n(".reveal-modal.open").foundation("reveal","close"),n("#map-zero-result-modal").remove(),p=null,f?p=n.wait(1).then(function(){var f=n("#search-results .search-results-listing"),i,t,r,u;if(f.prop("innerHTML",""),o){for(i=Object.keys(o),t=0;t<i.length;t++)r=i[t],u=o[r],u.setMap(null);o={}}}):(d=r!==null?r.getBounds():t.undefined,typeof d=="undefined"?p=n.Deferred().resolve():(nt=function(t){var u=n(t),f=u.data("latLng"),i,r;d.contains(f)||(i=t.id,r=o[i],r&&(r.setMap(null),delete o[i]),t.parentNode.removeChild(t))},tt=n.makeArray(n("#search-results .search-results-listing .search-results-item")),p=l(tt,nt))),g=function(t){var i=n.Deferred();return n.ajax(c4k.urls.searchListResults,{data:t,cache:!0,traditional:!0,dataType:"document"}).done(function(t){p.then(function(){var i=null;if(typeof t=="string")i=n(t);else if(t&&t.body)i=n(t.body.children),t.head&&(i=n(t.head.children).add(i));else throw"could not handle data response of search/listresults";return ht(i,e)}).then(function(){typeof parentCentreFavourites!="undefined"&&parentCentreFavourites!==null&&(parentCentreFavourites.init(),parentCentreFavourites.initMapResult())}).then(i.resolve)}),i},c.show(),b=[],n.isArray(i))for(k=0;k<i.length;k++)it=i[k],rt=g(it),b.push(rt);else ut=g(i),b.push(ut);v=n.when.apply(n,b).then(function(){return vt()});h!==!1&&(v=v.then(w));f&&(v=v.then(function(){at()}));v.then(function(){var t,i,r;n.isFunction(a)&&a();t=n("#search-results").data("jsp");t&&t.reinitialise();y.updateButtonOffset();u>=1030?t&&t.scrollTo(0,0):u>=990&&(i=n("#search-results"),i.scrollTop(0));n("html, body").animate({scrollTop:0},800,function(){n("#map-zero-result-modal").foundation("reveal","open")});y.removeFixedRefine();r=s.isSearchWhenMoveChecked&&w;c.hide(r)})};n.wait=function(i){return n.Deferred(function(n){t.setTimeout(n.resolve,i)})};var g=function(){if(typeof google=="undefined"||typeof google.maps=="undefined"||typeof google.maps.LatLngBounds=="undefined")return null;var n=pageVars.countryBounds;return new google.maps.LatLngBounds(new google.maps.LatLng(n.south,n.west),new google.maps.LatLng(n.north,n.east))}(),a=null,ht=function(i,u){for(var c,v,y=n("#search-results .search-results-listing"),f=n.makeArray(i),s=null,h=null,o=f.length-1;o>=0;o--){var e=f[o],p=e.id==="search-results-item-add",w=e.classList.contains("search_results-neighbouring-suburbs");(e.nodeType===3||p||w)&&(f.splice(o,1),p?s=e:w&&(h=e))}if(s!==null&&f.push(s),h!==null&&f.push(h),googletag.cmd.push(function(){googletag.pubads().refresh([adSlots.searchResult])}),c=function(t){var r=t.getAttribute("data-latitude"),u=t.getAttribute("data-longitude"),i=new google.maps.LatLng(parseFloat(r),parseFloat(u));return n(t).data("latLng",i),i},v=function(n){var i=y.get(0),w=n.getAttribute("data-sort"),s=n.id==="search-results-item-add",b=n.classList.contains("search_results-neighbouring-suburbs"),u=!1,k=i.ownerDocument!==n.ownerDocument,f,e,h,l,c,o,t,r,v,p;if(k){if(f=null,e=null,a===null&&(h=n.getElementsByClassName("infoContainer"),h.length>0))for(f=h[0].classList,t=0;t<f.length;t++)if(f[t]==="infoContainer"){e=t;break}try{n=a?i.ownerDocument.importNode(n,!0):i.ownerDocument.adoptNode(n)}catch(d){n=i.ownerDocument.importNode(n,!0)}a===null&&e!==null&&(l=f[e]==="infoContainer",l?a=!1:(n=i.ownerDocument.importNode(n,!0),a=!0))}if(b&&(i.lastChild.insertAdjacentElement("afterend",n),u=!0),!u)for(c=y.find(".search-results-item"),o=0,t=0;t<c.length;t++)if(r=c[t],s){if(v=!r.classList.contains("featured"),v&&(o++,o===2)){r.parentNode.insertBefore(n,r);u=!0;break}}else if(p=r.getAttribute("data-sort"),p>w){r.parentNode.insertBefore(n,r);u=!0;break}u||(!s||s&&o>0)&&i.appendChild(n)},u){var d=r!==null?r.getBounds():t.undefined,k=[],g=function(n){var t=n,i,r;document.getElementById(t.id)||(i=t.id==="search-results-item-add",r=c(t),(i||d.contains(r))&&(k.push(t),v(t)))},nt=l(f,g);return nt.then(function(){return b(k)})}return l(f,function(n){typeof google!="undefined"&&typeof google.maps!="undefined"&&c(n);v(n)}).then(function(){return b(f)})},nt=function(){var t,i,u;typeof google!="undefined"&&typeof google.maps!="undefined"&&typeof google.maps.Map!="undefined"&&(r||(t={mapTypeId:google.maps.MapTypeId.ROADMAP,scrollwheel:!1,mapTypeControl:!1,styles:[{featureType:"poi.attraction",stylers:[{visibility:"off"}]},{featureType:"poi.business",stylers:[{visibility:"off"}]},{featureType:"poi.sports_complex",stylers:[{visibility:"off"}]},{featureType:"transit",stylers:[{visibility:"off"}]},{featureType:"poi.government",stylers:[{visibility:"off"}]}]},i=document.getElementById("map-canvas"),r=new google.maps.Map(i,t),s.init(r),w(),u=n("#search-results .search-results-listing .search-results-item"),b(u)))},w=function(){if(!r||typeof google=="undefined"||typeof google.maps=="undefined")return n.Deferred().resolve().promise();var t=new google.maps.LatLngBounds,i=!1,u=n.makeArray(n("#search-results .search-results-listing .search-results-item")),f=function(){var u=n(this),f=this.getAttribute("data-latitude"),e=this.getAttribute("data-longitude"),r=new google.maps.LatLng(parseFloat(f),parseFloat(e));u.data("latLng",r);g.contains(r)&&(t.extend(r),i=!0)},e=l(u,f);return e.then(function(){var n,u;if(i)n=google.maps.event.addListenerOnce(r,"bounds_changed",function(){r.getZoom()>16&&r.setZoom(16)}),setTimeout(function(){google.maps.event.removeListener(n)},2e3),r.fitBounds(t),r.panBy(250,0);else if(u=APP.urlFormatters.mapResults.parseCurrentUrl(),u!=null)return ct()})},ct=function(){var f=n.Deferred(),i="Sydney, 2000",e,t,u,o,s;return c4k.countryCode=="NZ"&&(i="Wellington"),e=APP.urlFormatters.mapResults.parseCurrentUrl(),e!=null&&(t=null,u=document.getElementById("results-suburb-autocomplete-current-item"),u!==null&&(o=it(u.getAttribute("data-json")),t=JSON.parse(o)),t!=null&&(i=t.label)),s=new google.maps.Geocoder,s.geocode({address:i,region:c4k.countryCode},function(n){var t,i;n&&n.length>0&&(t=n[0].geometry,typeof t.bounds!="undefined"?(r.fitBounds(t.bounds),r.panBy(250,0)):(i={lat:t.location.lat(),lng:t.location.lng()},r.setCenter(i),r.setZoom(14)),f.resolve())}),f},b=function(t){var f=c4k.urls.mapMarkerIconWithVacancy,i=c4k.urls.mapMarkerIconWithoutVacancy,e;if(u<1180&&(f=c4k.urls.mapMarkerIconWithMiniVacancy,i=c4k.urls.mapMarkerIconWithoutMiniVacancy),c4k.countryCode!=="AU"&&(e=n(t).find(".vacancy.available").length!==0,e||(f=c4k.urls.mapMarkerIcon,i=c4k.urls.mapMarkerIcon),i=c4k.urls.mapMarkerIcon),!r||typeof google=="undefined"||typeof google.maps=="undefined")return n.Deferred().resolve().promise();var s=function(t){if(typeof t.infoWindow=="undefined"){var i=n(t.resultListElement),r=n("<ul/>").attr("class","no-bullet search-results-listing").append('<li class="search-results-item">'+i.html()+"<\/li>"),u=n("<div/>").addClass("place-on-map").append(r).find(".infoContainer").attr("class","infoContainer").end();t.infoWindow=u}tt(t,t.infoWindow)},h=function(t){if(typeof t.infoWindowVacancies=="undefined"){var r=n(t.resultListElement),u=n("<ul/>").attr("class","no-bullet search-results-listing").append('<li class="search-results-item">'+r.html()+"<\/li>"),i=n("<div/>").addClass("place-on-map").append(u).find(".infoContainer").attr("class","infoContainer").end();i.find(".accordion").find(".calendar-vacancies").show();t.infoWindowVacancies=i}tt(t,t.infoWindowVacancies)},c=function(t,e){var l=n(t),a=l.data("latLng"),v,c;if(a&&g.contains(a)){v=l.find(".vacancy.available").length!==0?f:i;c=new google.maps.Marker({position:a,map:r,icon:v,zIndex:1e4-e});c.resultListElement=t;o[t.id]=c;l.on("click",".shortcut-show-on-map, .info h3.search-results-item-title",function(n){n.preventDefault();n.stopPropagation();s(c)});l.on("click",".shortcut-show-vacancies, .ribbon.vacancy.available",function(t){t.preventDefault();t.stopPropagation();n("#map-canvas").is(":hidden")||h(c)});l.on("change",".jumptoSection",function(t){if(u>=990){var r=n(this).find("option:selected"),i=r.val();(i==="vacancies"||i==="fees")&&(h(c),n(this).prop("selectedIndex",0),t.preventDefault(),t.stopPropagation());i==="fees"&&setTimeout(function(){var t=n(".place-on-map").find(".accordion").find(".content.calendar-vacancies"),i=t.find(".vacanciesInfo").height()+10;t.scrollTop(i)},200)}});google.maps.event.addListener(c,"click",function(){var n=this;s(n)})}};return lt(),l(n.makeArray(t),c)},lt=function(){var u=document.getElementById("bp");if(u===null||n(".map-auto-refresh-checkbox").is(":checked"))r.data.forEach(function(n){r.data.remove(n)});else{var f=require("buffer").Buffer,e=require("wkx"),o=new f(u.getAttribute("data-bp"),"base64"),i=e.Geometry.parse(o);console.log(i);r.data.setStyle(function(n){var t={clickable:!0,fillOpacity:0,strokeColor:"#bbb"};return n.getProperty("type")==="current"?(t.clickable=!1,t.strokeColor="#bbb"):(t.clickable=!0,t.strokeWeight=0,t.fillOpacity=.3,t.fillColor="#ddd"),t});r.data.addListener("click",function(n){var i=n.feature.getProperty("url");i&&(t.location=i)});r.data.addListener("mouseover",function(n){n.feature.getProperty("type")==="neighbour"&&(r.data.revertStyle(),r.data.overrideStyle(n.feature,{strokeWeight:8}))});r.data.addListener("mouseout",function(n){n.feature.getProperty("type")==="neighbour"&&r.data.revertStyle()});r.data.forEach(function(n){r.data.remove(n)});n(".search_results-neighbouring-suburbs ul li a").each(function(n,t){var i=new f(t.getAttribute("data-bp"),"base64"),u=e.Geometry.parse(i);r.data.addGeoJson({type:"Feature",geometry:u.toGeoJSON(),properties:{type:"neighbour",url:t.getAttribute("href")}})});r.data.addGeoJson({type:"Feature",geometry:i.toGeoJSON(),properties:{type:"current"}});t.geom=i}},at=function(){var t=APP.urlFormatters.mapResults.parseCurrentUrl(),i,r;t!==null&&(i=n("[data-bind='text: childCareCost']"),r={postcode:t.postcode,featureId:t.featureId},n.getJSON(c4k.urls.childCareCosts,r,function(n){i.html(n.perDayText)},"html").error(function(){i.html("N/A")}))},vt=function(){var t=APP.urlFormatters.mapResults.parseCurrentUrl(),r,i;t!==null&&(n.wait(1).then(function(){var i="Child Care";t.providerType==="child-care-centre"?i="Child Care Centres":t.providerType==="pre-school"?i="Pre-Schools":t.providerType==="before-after-school-care"?i="Before/After School Care":t.providerType==="family-day-care"?i="Family Day Care":t.providerType==="occasional-care"?i="Occasional Care":t.providerType==="vacation-care"&&(i="Vacation Care");n("[data-bind='text: childCareTypeDescription']").html(i)}).then(function(){return n.wait(1).then(function(){var o=document.getElementById("results-page-title"),s,r,h,i,u,f,e;o!==null&&(s=o.getAttribute("data-title"),document.title=s);r=document.getElementById("results-meta-description");r!==null&&(h=r.getAttribute("data-meta-description"),n("meta[name=description]").attr("content",h));i=t.suburbSlug;u=document.getElementById("results-location");u!==null&&(i=u.getAttribute("data-location"));n("[data-bind='text: location']").html(i);f=document.getElementById("schema-org-contentLocation-address");f!==null&&(e=n(f).children(),e.each(function(){var t=this.getAttribute("data-itemprop");t!==null&&n(this).attr("itemprop",t)}),n("[data-bind='html: schema-org-contentLocation-address']").html(e));n(".autocomplete-search[data-postcode]").each(function(r,u){var f=n(u);f.attr("data-postcode",t.postcode);f.attr("data-suburb-name",i);f.attr("data-suburb-slug",t.suburbSlug);f.customAutocomplete("setCurrentItemFromDataAttributes")});n('script[type="application/ld+json"]').remove()})}).then(function(){return n.wait(1).then(function(){var t=n("#search-results .search-results-listing .search-results-item[id!=search-results-item-add]").length;n("[data-bind='text: resultCount']").html(t);t==0?(n(".result_box_info-vacancy_alert").removeClass("hide"),n(".result_box_info-average_cost").addClass("hide")):(n(".result_box_info-vacancy_alert").addClass("hide"),n(".result_box_info-average_cost").removeClass("hide"))})}).then(function(){return n.wait(1).then(function(){APP.analyticsTrackAjaxMapSearch()})}),u<990&&(r={height:5,padding:0},i=n(".off-canvas-wrap").find(".submenu").not(".parents"),i.css("height",r.height+"px"),i.css("padding",r.padding),i.find("ul").hide(),n(".search-toggle").removeClass("open")))},tt=function(t,e){var l=e.clone(),a,h,v,s,c,o,y;for(l.addClass("info-window-content"),a=l.get(0),h=new google.maps.InfoWindow({content:a,maxWidth:459}),f!==i&&f.close(),h.open(r,t),v=function(){n(".info-window-content").parents("div.gm-style-iw").find("button.gm-ui-hover-effect").hide()},s=150;s<650;s+=100)setTimeout(v,s);c=yt(t);o=0;u>1395?o=700:u>989&&(o=250);c.x>o&&r.panBy(c.x-o,0);f=h;y=n(document).scrollTop();y>100&&n("html, body").animate({scrollTop:0},400);n(".map-refresh-controlr").addClass("hide")},yt=function(n){var t=Math.pow(2,r.getZoom()),f=new google.maps.LatLng(r.getBounds().getNorthEast().lat(),r.getBounds().getSouthWest().lng()),i=r.getProjection().fromLatLngToPoint(f),u=r.getProjection().fromLatLngToPoint(n.getPosition());return new google.maps.Point(Math.floor((u.x-i.x)*t),Math.floor((u.y-i.y)*t))};return n("#wizard").length>0&&n("#wizard").steps({headerTag:"h2",bodyTag:"section",transitionEffect:"fade",labels:{current:"current step:",pagination:"Pagination",finish:"WAITLIST",next:"Next",previous:"Previous",loading:"Loading ..."}}),{init:rt,ajaxMapSearch:h,pushState:d}}(jQuery,this)