[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"a1homes","theme_token":"BuP5JwqYV1ITzLFkkXeXgW7iOaaGMguJ0qCaiQAZ2iI","jquery_version":"1.10"},"colorbox":{"opacity":"0.85","current":"{current} of {total}","previous":"\u00ab Prev","next":"Next \u00bb","close":"Close","maxWidth":"98%","maxHeight":"98%","fixed":true,"mobiledetect":true,"mobiledevicewidth":"480px","specificPagesDefaultValue":"admin*\nimagebrowser*\nimg_assist*\nimce*\nnode\/add\/*\nnode\/*\/edit\nprint\/*\nprintpdf\/*\nsystem\/ajax\nsystem\/ajax\/*"},"CToolsModal":{"loadingText":"Loading...","closeText":"Close Window","closeImage":"\u003Cimg class=\u0022img-responsive\u0022 src=\u0022https:\/\/www.a1homes.co.nz\/profiles\/minimal_zest\/modules\/contrib\/ctools\/images\/icon-close-window.png\u0022 alt=\u0022Close window\u0022 title=\u0022Close window\u0022 \/\u003E","throbber":"\u003Cimg class=\u0022img-responsive\u0022 src=\u0022https:\/\/www.a1homes.co.nz\/profiles\/minimal_zest\/modules\/contrib\/ctools\/images\/throbber.gif\u0022 alt=\u0022Loading\u0022 title=\u0022Loading...\u0022 \/\u003E"},"bootstrap":{"anchorsFix":"0","anchorsSmoothScrolling":"0","formHasError":1,"popoverEnabled":"1","popoverOptions":{"animation":1,"html":0,"placement":"right","selector":"","trigger":"click","triggerAutoclose":1,"title":"","content":"","delay":0,"container":"body"},"tooltipEnabled":"1","tooltipOptions":{"animation":1,"html":0,"placement":"auto left","selector":"","trigger":"hover focus","delay":0,"container":"body"}}},"merge":true},{"command":"modal_display","title":"Email us","output":"\u003Cstyle\u003E\r\n #_form_29_ { font-size:14px; line-height:1.6; font-family:arial, helvetica, sans-serif; margin:0; }\r\n #_form_29_ * { outline:0; }\r\n ._form_hide { display:none; visibility:hidden; }\r\n ._form_show { display:block; visibility:visible; }\r\n #_form_29_._form-top { top:0; }\r\n #_form_29_._form-bottom { bottom:0; }\r\n #_form_29_._form-left { left:0; }\r\n #_form_29_._form-right { right:0; }\r\n #_form_29_ input[type=\u0022text\u0022],#_form_29_ input[type=\u0022tel\u0022],#_form_29_ input[type=\u0022date\u0022],#_form_29_ textarea { padding:6px; height:auto; border:#979797 1px solid; border-radius:4px; color:#000 !important; font-size:14px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; }\r\n #_form_29_ textarea { resize:none; }\r\n #_form_29_ ._submit { -webkit-appearance:none; cursor:pointer; font-family:arial, sans-serif; font-size:14px; text-align:center; background:#72bf44 !important; border:0 !important; color:#fff !important; padding:6px !important; }\r\n #_form_29_ ._close-icon { cursor:pointer; background-image:url(\u0027https:\/\/d226aj4ao1t61q.cloudfront.net\/esfkyjh1u_forms-close-dark.png\u0027); background-repeat:no-repeat; background-size:14.2px 14.2px; position:absolute; display:block; top:11px; right:9px; overflow:hidden; width:16.2px; height:16.2px; }\r\n #_form_29_ ._close-icon:before { position:relative; }\r\n #_form_29_ ._form-body { margin-bottom:30px; }\r\n #_form_29_ ._form-image-left { width:150px; float:left; }\r\n #_form_29_ ._form-content-right { margin-left:164px; }\r\n #_form_29_ ._form-branding { color:#fff; font-size:10px; clear:both; text-align:left; margin-top:30px; font-weight:100; }\r\n #_form_29_ ._form-branding ._logo { display:block; width:130px; height:14px; margin-top:6px; background-image:url(\u0027https:\/\/d226aj4ao1t61q.cloudfront.net\/hh9ujqgv5_aclogo_li.png\u0027); background-size:130px auto; background-repeat:no-repeat; }\r\n #_form_29_ .form-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0, 0, 0, 0); border:0; }\r\n #_form_29_ ._form-label,#_form_29_ ._form_element ._form-label { font-weight:bold; margin-bottom:5px; display:block; }\r\n #_form_29_._dark ._form-branding { color:#333; }\r\n #_form_29_._dark ._form-branding ._logo { background-image:url(\u0027https:\/\/d226aj4ao1t61q.cloudfront.net\/jftq2c8s_aclogo_dk.png\u0027); }\r\n #_form_29_ ._form_element { position:relative; margin-bottom:10px; font-size:0; max-width:100%; }\r\n #_form_29_ ._form_element * { font-size:14px; }\r\n #_form_29_ ._form_element._clear { clear:both; width:100%; float:none; }\r\n #_form_29_ ._form_element._clear:after { clear:left; }\r\n #_form_29_ ._form_element input[type=\u0022text\u0022],#_form_29_ ._form_element input[type=\u0022date\u0022],#_form_29_ ._form_element select,#_form_29_ ._form_element textarea:not(.g-recaptcha-response) { display:block; width:100%; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; font-family:inherit; }\r\n #_form_29_ ._field-wrapper { position:relative; }\r\n #_form_29_ ._inline-style { float:left; }\r\n #_form_29_ ._inline-style input[type=\u0022text\u0022] { width:150px; }\r\n #_form_29_ ._inline-style:not(._clear) + ._inline-style:not(._clear) { margin-left:20px; }\r\n #_form_29_ ._form_element img._form-image { max-width:100%; }\r\n #_form_29_ ._form_element ._form-fieldset { border:0; padding:0.01em 0 0 0; margin:0; min-width:0; }\r\n #_form_29_ ._clear-element { clear:left; }\r\n #_form_29_ ._full_width { width:100%; }\r\n #_form_29_ ._form_full_field { display:block; width:100%; margin-bottom:10px; }\r\n #_form_29_ input[type=\u0022text\u0022]._has_error,#_form_29_ textarea._has_error { border:#f37c7b 1px solid; }\r\n #_form_29_ input[type=\u0022checkbox\u0022]._has_error { outline:#f37c7b 1px solid; }\r\n #_form_29_ ._error { display:block; position:absolute; font-size:14px; z-index:10000001; }\r\n #_form_29_ ._error._above { padding-bottom:4px; bottom:39px; right:0; }\r\n #_form_29_ ._error._below { padding-top:4px; top:100%; right:0; }\r\n #_form_29_ ._error._above ._error-arrow { bottom:0; right:15px; border-left:5px solid transparent; border-right:5px solid transparent; border-top:5px solid #f37c7b; }\r\n #_form_29_ ._error._below ._error-arrow { top:0; right:15px; border-left:5px solid transparent; border-right:5px solid transparent; border-bottom:5px solid #f37c7b; }\r\n #_form_29_ ._error-inner { padding:8px 12px; background-color:#f37c7b; font-size:14px; font-family:arial, sans-serif; color:#fff; text-align:center; text-decoration:none; -webkit-border-radius:4px; -moz-border-radius:4px; border-radius:4px; }\r\n #_form_29_ ._error-inner._form_error { margin-bottom:5px; text-align:left; }\r\n #_form_29_ ._button-wrapper ._error-inner._form_error { position:static; }\r\n #_form_29_ ._error-inner._no_arrow { margin-bottom:10px; }\r\n #_form_29_ ._error-arrow { position:absolute; width:0; height:0; }\r\n #_form_29_ ._error-html { margin-bottom:10px; }\r\n .pika-single { z-index:10000001 !important; }\r\n #_form_29_ input[type=\u0022text\u0022].datetime_date { width:69%; display:inline; }\r\n #_form_29_ select.datetime_time { width:29%; display:inline; height:32px; }\r\n #_form_29_ input[type=\u0022date\u0022].datetime_date { width:69%; display:inline-flex; }\r\n #_form_29_ input[type=\u0022time\u0022].datetime_time { width:29%; display:inline-flex; }\r\n @media all and (min-width:320px) and (max-width:667px) { ::-webkit-scrollbar { display:none; }\r\n #_form_29_ { margin:0; width:100%; min-width:100%; max-width:100%; box-sizing:border-box; }\r\n #_form_29_ * { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; font-size:1em; }\r\n #_form_29_ ._form-content { margin:0; width:100%; }\r\n #_form_29_ ._form-inner { display:block; min-width:100%; }\r\n #_form_29_ ._form-title,#_form_29_ ._inline-style { margin-top:0; margin-right:0; margin-left:0; }\r\n #_form_29_ ._form-title { font-size:1.2em; }\r\n #_form_29_ ._form_element { margin:0 0 20px; padding:0; width:100%; }\r\n #_form_29_ ._form-element,#_form_29_ ._inline-style,#_form_29_ input[type=\u0022text\u0022],#_form_29_ label,#_form_29_ p,#_form_29_ textarea:not(.g-recaptcha-response) { float:none; display:block; width:100%; }\r\n #_form_29_ ._row._checkbox-radio label { display:inline; }\r\n #_form_29_ ._row,#_form_29_ p,#_form_29_ label { margin-bottom:0.7em; width:100%; }\r\n #_form_29_ ._row input[type=\u0022checkbox\u0022],#_form_29_ ._row input[type=\u0022radio\u0022] { margin:0 !important; vertical-align:middle !important; }\r\n #_form_29_ ._row input[type=\u0022checkbox\u0022] + span label { display:inline; }\r\n #_form_29_ ._row span label { margin:0 !important; width:initial !important; vertical-align:middle !important; }\r\n #_form_29_ ._form-image { max-width:100%; height:auto !important; }\r\n #_form_29_ input[type=\u0022text\u0022] { padding-left:10px; padding-right:10px; font-size:16px; line-height:1.3em; -webkit-appearance:none; }\r\n #_form_29_ input[type=\u0022radio\u0022],#_form_29_ input[type=\u0022checkbox\u0022] { display:inline-block; width:1.3em; height:1.3em; font-size:1em; margin:0 0.3em 0 0; vertical-align:baseline; }\r\n #_form_29_ button[type=\u0022submit\u0022] { padding:20px; font-size:1.5em; }\r\n #_form_29_ ._inline-style { margin:20px 0 0 !important; }\r\n }\r\n #_form_29_ { position:relative; text-align:left; margin:25px auto 0; padding:20px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; *zoom:1; background:#fff !important; border:0px solid #b0b0b0 !important; max-width:500px; -moz-border-radius:0px !important; -webkit-border-radius:0px !important; border-radius:0px !important; color:#686f73 !important; }\r\n #_form_29_ ._form-title { font-size:22px; line-height:22px; font-weight:600; margin-bottom:0; }\r\n #_form_29_:before,#_form_29_:after { content:\u0022 \u0022; display:table; }\r\n #_form_29_:after { clear:both; }\r\n #_form_29_._inline-style { width:auto; display:inline-block; }\r\n #_form_29_._inline-style input[type=\u0022text\u0022],#_form_29_._inline-style input[type=\u0022date\u0022] { padding:10px 12px; }\r\n #_form_29_._inline-style button._inline-style { position:relative; top:27px; }\r\n #_form_29_._inline-style p { margin:0; }\r\n #_form_29_._inline-style ._button-wrapper { position:relative; margin:27px 12.5px 0 20px; }\r\n #_form_29_ ._form-thank-you { position:relative; left:0; right:0; text-align:center; font-size:18px; }\r\n @media all and (min-width:320px) and (max-width:667px) { #_form_29_._inline-form._inline-style ._inline-style._button-wrapper { margin-top:20px !important; margin-left:0 !important; }\r\n }\r\n #_form_29_ .iti.iti--allow-dropdown.iti--separate-dial-code { width:100%; }\r\n #_form_29_ .iti input { width:100%; height:32px; border:#979797 1px solid; border-radius:4px; }\r\n #_form_29_ .iti--separate-dial-code .iti__selected-flag { background-color:#fff; border-radius:4px; }\r\n #_form_29_ .iti--separate-dial-code .iti__selected-flag:hover { background-color:rgba(0, 0, 0, 0.05); }\r\n #_form_29_ .iti__country-list { border-radius:4px; margin-top:4px; min-width:460px; }\r\n #_form_29_ .iti__country-list--dropup { margin-bottom:4px; }\r\n #_form_29_ .phone-error-hidden { display:none; }\r\n #_form_29_ .phone-error { color:#e40e49; }\r\n #_form_29_ .phone-input-error { border:1px solid #e40e49 !important; }\r\n\r\n\u003C\/style\u003E\r\n\u003Clink href=\u0022https:\/\/fonts.googleapis.com\/css2?family=Lato\u0026family=Montserrat\u0026family=Roboto\u0026family=IBM+Plex+Sans:wght@400;600\u0026display=swap\u0022 rel=\u0022stylesheet\u0022\u003E\r\n \u003Clink rel=\u0022stylesheet\u0022 type=\u0022text\/css\u0022 href=\u0022https:\/\/unpkg.com\/intl-tel-input@17.0.18\/build\/css\/intlTelInput.min.css\u0022\/\u003E\r\n \u003Cform method=\u0022POST\u0022 action=\u0022https:\/\/a1homesnz.activehosted.com\/proc.php\u0022 id=\u0022_form_29_\u0022 class=\u0022_form _form_29 _inline-form _dark\u0022 novalidate\u003E\r\n \u003Cinput type=\u0022hidden\u0022 name=\u0022u\u0022 value=\u002229\u0022 \/\u003E\r\n \u003Cinput type=\u0022hidden\u0022 name=\u0022f\u0022 value=\u002229\u0022 \/\u003E\r\n \u003Cinput type=\u0022hidden\u0022 name=\u0022s\u0022 \/\u003E\r\n \u003Cinput type=\u0022hidden\u0022 name=\u0022c\u0022 value=\u00220\u0022 \/\u003E\r\n \u003Cinput type=\u0022hidden\u0022 name=\u0022m\u0022 value=\u00220\u0022 \/\u003E\r\n \u003Cinput type=\u0022hidden\u0022 name=\u0022act\u0022 value=\u0022sub\u0022 \/\u003E\r\n \u003Cinput type=\u0022hidden\u0022 name=\u0022v\u0022 value=\u00222\u0022 \/\u003E\r\n \u003Cinput type=\u0022hidden\u0022 name=\u0022or\u0022 value=\u002233855b182c102633b3976d0af0733130\u0022 \/\u003E\r\n \u003Cdiv class=\u0022_form-content\u0022\u003E\r\n \u003Cdiv class=\u0022_form_element _x92462079 _full_width _clear\u0022 \u003E\r\n \u003Cdiv class=\u0022_form-title\u0022\u003E\r\n Get in touch with A1homes Tasman and Marlborough\r\n \u003C\/div\u003E\r\n \u003C\/div\u003E\r\n \u003Cdiv class=\u0022_form_element _x74359149 _full_width \u0022 \u003E\r\n \u003Clabel for=\u0022firstname\u0022 class=\u0022_form-label\u0022\u003E\r\n First name*\r\n \u003C\/label\u003E\r\n \u003Cdiv class=\u0022_field-wrapper\u0022\u003E\r\n \u003Cinput type=\u0022text\u0022 id=\u0022firstname\u0022 name=\u0022firstname\u0022 placeholder=\u0022Type your first name\u0022 required\/\u003E\r\n \u003C\/div\u003E\r\n \u003C\/div\u003E\r\n \u003Cdiv class=\u0022_form_element _x67443736 _full_width \u0022 \u003E\r\n \u003Clabel for=\u0022lastname\u0022 class=\u0022_form-label\u0022\u003E\r\n Last name*\r\n \u003C\/label\u003E\r\n \u003Cdiv class=\u0022_field-wrapper\u0022\u003E\r\n \u003Cinput type=\u0022text\u0022 id=\u0022lastname\u0022 name=\u0022lastname\u0022 placeholder=\u0022Type your last name\u0022 required\/\u003E\r\n \u003C\/div\u003E\r\n \u003C\/div\u003E\r\n \u003Cdiv class=\u0022_form_element _x64179962 _full_width \u0022 \u003E\r\n \u003Clabel for=\u0022email\u0022 class=\u0022_form-label\u0022\u003E\r\n Email address*\r\n \u003C\/label\u003E\r\n \u003Cdiv class=\u0022_field-wrapper\u0022\u003E\r\n \u003Cinput type=\u0022text\u0022 id=\u0022email\u0022 name=\u0022email\u0022 placeholder=\u0022Type your email\u0022 required\/\u003E\r\n \u003C\/div\u003E\r\n \u003C\/div\u003E\r\n \u003Cdiv class=\u0022_form_element _x19183095 _full_width \u0022 \u003E\r\n \u003Clabel for=\u0022phone\u0022 class=\u0022_form-label\u0022\u003E\r\n Phone*\r\n \u003C\/label\u003E\r\n \u003Cdiv class=\u0022_field-wrapper\u0022\u003E\r\n \u003Cinput type=\u0022text\u0022 id=\u0022phone\u0022 name=\u0022phone\u0022 placeholder=\u0022Type your phone number\u0022 required\/\u003E\r\n \u003C\/div\u003E\r\n \u003C\/div\u003E\r\n \u003Cdiv class=\u0022_form_element _x94449617 _full_width \u0022 \u003E\r\n \u003Clabel for=\u0022field[2]\u0022 class=\u0022_form-label\u0022\u003E\r\n Message\r\n \u003C\/label\u003E\r\n \u003Cdiv class=\u0022_field-wrapper\u0022\u003E\r\n \u003Ctextarea id=\u0022field[2]\u0022 name=\u0022field[2]\u0022 placeholder=\u0022\u0022 \u003E\u003C\/textarea\u003E\r\n \u003C\/div\u003E\r\n \u003C\/div\u003E\r\n \u003Cdiv class=\u0022_button-wrapper _full_width\u0022\u003E\r\n \u003Cbutton id=\u0022_form_29_submit\u0022 class=\u0022_submit\u0022 type=\u0022submit\u0022\u003E\r\n Submit\r\n \u003C\/button\u003E\r\n \u003C\/div\u003E\r\n \u003Cdiv class=\u0022_clear-element\u0022\u003E\r\n \u003C\/div\u003E\r\n \u003C\/div\u003E\r\n \u003Cdiv class=\u0022_form-thank-you\u0022 style=\u0022display:none;\u0022\u003E\r\n \u003C\/div\u003E\r\n \u003C\/form\u003E\u003Cscript type=\u0022text\/javascript\u0022\u003E\r\nwindow.cfields = {\u00222\u0022:\u0022message\u0022};\r\nwindow._show_thank_you = function(id, message, trackcmp_url, email) {\r\n var form = document.getElementById(\u0027_form_\u0027 + id + \u0027_\u0027), thank_you = form.querySelector(\u0027._form-thank-you\u0027);\r\n form.querySelector(\u0027._form-content\u0027).style.display = \u0027none\u0027;\r\n thank_you.innerHTML = message;\r\n thank_you.style.display = \u0027block\u0027;\r\n const vgoAlias = typeof visitorGlobalObjectAlias === \u0027undefined\u0027 ? \u0027vgo\u0027 : visitorGlobalObjectAlias;\r\n var visitorObject = window[vgoAlias];\r\n if (email \u0026\u0026 typeof visitorObject !== \u0027undefined\u0027) {\r\n visitorObject(\u0027setEmail\u0027, email);\r\n visitorObject(\u0027update\u0027);\r\n } else if (typeof(trackcmp_url) != \u0027undefined\u0027 \u0026\u0026 trackcmp_url) {\r\n \/\/ Site tracking URL to use after inline form submission.\r\n _load_script(trackcmp_url);\r\n }\r\n if (typeof window._form_callback !== \u0027undefined\u0027) window._form_callback(id);\r\n};\r\nwindow._show_error = function(id, message, html) {\r\n var form = document.getElementById(\u0027_form_\u0027 + id + \u0027_\u0027), err = document.createElement(\u0027div\u0027), button = form.querySelector(\u0027button\u0027), old_error = form.querySelector(\u0027._form_error\u0027);\r\n if (old_error) old_error.parentNode.removeChild(old_error);\r\n err.innerHTML = message;\r\n err.className = \u0027_error-inner _form_error _no_arrow\u0027;\r\n var wrapper = document.createElement(\u0027div\u0027);\r\n wrapper.className = \u0027_form-inner\u0027;\r\n wrapper.appendChild(err);\r\n button.parentNode.insertBefore(wrapper, button);\r\n document.querySelector(\u0027[id^=\u0022_form\u0022][id$=\u0022_submit\u0022]\u0027).disabled = false;\r\n if (html) {\r\n var div = document.createElement(\u0027div\u0027);\r\n div.className = \u0027_error-html\u0027;\r\n div.innerHTML = html;\r\n err.appendChild(div);\r\n }\r\n};\r\nwindow._load_script = function(url, callback) {\r\n var head = document.querySelector(\u0027head\u0027), script = document.createElement(\u0027script\u0027), r = false;\r\n script.type = \u0027text\/javascript\u0027;\r\n script.charset = \u0027utf-8\u0027;\r\n script.src = url;\r\n if (callback) {\r\n script.onload = script.onreadystatechange = function() {\r\n if (!r \u0026\u0026 (!this.readyState || this.readyState == \u0027complete\u0027)) {\r\n r = true;\r\n callback();\r\n }\r\n };\r\n }\r\n head.appendChild(script);\r\n};\r\n(function() {\r\n if (window.location.search.search(\u0022excludeform\u0022) !== -1) return false;\r\n var getCookie = function(name) {\r\n var match = document.cookie.match(new RegExp(\u0027(^|; )\u0027 + name + \u0027=([^;]+)\u0027));\r\n return match ? match[2] : null;\r\n }\r\n var setCookie = function(name, value) {\r\n var now = new Date();\r\n var time = now.getTime();\r\n var expireTime = time + 1000 * 60 * 60 * 24 * 365;\r\n now.setTime(expireTime);\r\n document.cookie = name + \u0027=\u0027 + value + \u0027; expires=\u0027 + now + \u0027;path=\/; Secure; SameSite=Lax;\u0027;\/\/ cannot be HttpOnly\r\n }\r\n var addEvent = function(element, event, func) {\r\n if (element.addEventListener) {\r\n element.addEventListener(event, func);\r\n } else {\r\n var oldFunc = element[\u0027on\u0027 + event];\r\n element[\u0027on\u0027 + event] = function() {\r\n oldFunc.apply(this, arguments);\r\n func.apply(this, arguments);\r\n };\r\n }\r\n }\r\n var _removed = false;\r\n var form_to_submit = document.getElementById(\u0027_form_29_\u0027);\r\n var allInputs = form_to_submit.querySelectorAll(\u0027input, select, textarea\u0027), tooltips = [], submitted = false;\r\n\r\n var getUrlParam = function(name) {\r\n var params = new URLSearchParams(window.location.search);\r\n return params.get(name) || false;\r\n };\r\n\r\n for (var i = 0; i \u003C allInputs.length; i++) {\r\n var regexStr = \u0022field\\\\[(\\\\d+)\\\\]\u0022;\r\n var results = new RegExp(regexStr).exec(allInputs[i].name);\r\n if (results != undefined) {\r\n allInputs[i].dataset.name = window.cfields[results[1]];\r\n } else {\r\n allInputs[i].dataset.name = allInputs[i].name;\r\n }\r\n var fieldVal = getUrlParam(allInputs[i].dataset.name);\r\n\r\n if (fieldVal) {\r\n if (allInputs[i].dataset.autofill === \u0022false\u0022) {\r\n continue;\r\n }\r\n if (allInputs[i].type == \u0022radio\u0022 || allInputs[i].type == \u0022checkbox\u0022) {\r\n if (allInputs[i].value == fieldVal) {\r\n allInputs[i].checked = true;\r\n }\r\n } else {\r\n allInputs[i].value = fieldVal;\r\n }\r\n }\r\n }\r\n\r\n var remove_tooltips = function() {\r\n for (var i = 0; i \u003C tooltips.length; i++) {\r\n tooltips[i].tip.parentNode.removeChild(tooltips[i].tip);\r\n }\r\n tooltips = [];\r\n };\r\n var remove_tooltip = function(elem) {\r\n for (var i = 0; i \u003C tooltips.length; i++) {\r\n if (tooltips[i].elem === elem) {\r\n tooltips[i].tip.parentNode.removeChild(tooltips[i].tip);\r\n tooltips.splice(i, 1);\r\n return;\r\n }\r\n }\r\n };\r\n var create_tooltip = function(elem, text) {\r\n var tooltip = document.createElement(\u0027div\u0027), arrow = document.createElement(\u0027div\u0027), inner = document.createElement(\u0027div\u0027), new_tooltip = {};\r\n if (elem.type != \u0027radio\u0027 \u0026\u0026 elem.type != \u0027checkbox\u0027) {\r\n tooltip.className = \u0027_error\u0027;\r\n arrow.className = \u0027_error-arrow\u0027;\r\n inner.className = \u0027_error-inner\u0027;\r\n inner.innerHTML = text;\r\n tooltip.appendChild(arrow);\r\n tooltip.appendChild(inner);\r\n elem.parentNode.appendChild(tooltip);\r\n } else {\r\n tooltip.className = \u0027_error-inner _no_arrow\u0027;\r\n tooltip.innerHTML = text;\r\n elem.parentNode.insertBefore(tooltip, elem);\r\n new_tooltip.no_arrow = true;\r\n }\r\n new_tooltip.tip = tooltip;\r\n new_tooltip.elem = elem;\r\n tooltips.push(new_tooltip);\r\n return new_tooltip;\r\n };\r\n var resize_tooltip = function(tooltip) {\r\n var rect = tooltip.elem.getBoundingClientRect();\r\n var doc = document.documentElement, scrollPosition = rect.top - ((window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0));\r\n if (scrollPosition \u003C 40) {\r\n tooltip.tip.className = tooltip.tip.className.replace(\/ ?(_above|_below) ?\/g, \u0027\u0027) + \u0027 _below\u0027;\r\n } else {\r\n tooltip.tip.className = tooltip.tip.className.replace(\/ ?(_above|_below) ?\/g, \u0027\u0027) + \u0027 _above\u0027;\r\n }\r\n };\r\n var resize_tooltips = function() {\r\n if (_removed) return;\r\n for (var i = 0; i \u003C tooltips.length; i++) {\r\n if (!tooltips[i].no_arrow) resize_tooltip(tooltips[i]);\r\n }\r\n };\r\n var validate_field = function(elem, remove) {\r\n var tooltip = null, value = elem.value, no_error = true;\r\n remove ? remove_tooltip(elem) : false;\r\n if (elem.type != \u0027checkbox\u0027) elem.className = elem.className.replace(\/ ?_has_error ?\/g, \u0027\u0027);\r\n if (elem.getAttribute(\u0027required\u0027) !== null) {\r\n if (elem.type == \u0027radio\u0027 || (elem.type == \u0027checkbox\u0027 \u0026\u0026 \/any\/.test(elem.className))) {\r\n var elems = form_to_submit.elements[elem.name];\r\n if (!(elems instanceof NodeList || elems instanceof HTMLCollection) || elems.length \u003C= 1) {\r\n no_error = elem.checked;\r\n }\r\n else {\r\n no_error = false;\r\n for (var i = 0; i \u003C elems.length; i++) {\r\n if (elems[i].checked) no_error = true;\r\n }\r\n }\r\n if (!no_error) {\r\n tooltip = create_tooltip(elem, \u0022Please select an option.\u0022);\r\n }\r\n } else if (elem.type ==\u0027checkbox\u0027) {\r\n var elems = form_to_submit.elements[elem.name], found = false, err = [];\r\n no_error = true;\r\n for (var i = 0; i \u003C elems.length; i++) {\r\n if (elems[i].getAttribute(\u0027required\u0027) === null) continue;\r\n if (!found \u0026\u0026 elems[i] !== elem) return true;\r\n found = true;\r\n elems[i].className = elems[i].className.replace(\/ ?_has_error ?\/g, \u0027\u0027);\r\n if (!elems[i].checked) {\r\n no_error = false;\r\n elems[i].className = elems[i].className + \u0027 _has_error\u0027;\r\n err.push(\u0022Checking %s is required\u0022.replace(\u0022%s\u0022, elems[i].value));\r\n }\r\n }\r\n if (!no_error) {\r\n tooltip = create_tooltip(elem, err.join(\u0027\u003Cbr\/\u003E\u0027));\r\n }\r\n } else if (elem.tagName == \u0027SELECT\u0027) {\r\n var selected = true;\r\n if (elem.multiple) {\r\n selected = false;\r\n for (var i = 0; i \u003C elem.options.length; i++) {\r\n if (elem.options[i].selected) {\r\n selected = true;\r\n break;\r\n }\r\n }\r\n } else {\r\n for (var i = 0; i \u003C elem.options.length; i++) {\r\n if (elem.options[i].selected \u0026\u0026 (!elem.options[i].value || (elem.options[i].value.match(\/\\n\/g)))) {\r\n selected = false;\r\n }\r\n }\r\n }\r\n if (!selected) {\r\n elem.className = elem.className + \u0027 _has_error\u0027;\r\n no_error = false;\r\n tooltip = create_tooltip(elem, \u0022Please select an option.\u0022);\r\n }\r\n } else if (value === undefined || value === null || value === \u0027\u0027) {\r\n elem.className = elem.className + \u0027 _has_error\u0027;\r\n no_error = false;\r\n tooltip = create_tooltip(elem, \u0022This field is required.\u0022);\r\n }\r\n }\r\n if (no_error \u0026\u0026 (elem.id == \u0027field[]\u0027 || elem.id == \u0027ca[11][v]\u0027)) {\r\n if (elem.className.includes(\u0027phone-input-error\u0027)) {\r\n elem.className = elem.className + \u0027 _has_error\u0027;\r\n no_error = false;\r\n }\r\n }\r\n if (no_error \u0026\u0026 elem.name == \u0027email\u0027) {\r\n if (!value.match(\/^[\\+_a-z0-9-\u0027\u0026=]+(\\.[\\+_a-z0-9-\u0027]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,})$\/i)) {\r\n elem.className = elem.className + \u0027 _has_error\u0027;\r\n no_error = false;\r\n tooltip = create_tooltip(elem, \u0022Enter a valid email address.\u0022);\r\n }\r\n }\r\n if (no_error \u0026\u0026 \/date_field\/.test(elem.className)) {\r\n if (!value.match(\/^\\d\\d\\d\\d-\\d\\d-\\d\\d$\/)) {\r\n elem.className = elem.className + \u0027 _has_error\u0027;\r\n no_error = false;\r\n tooltip = create_tooltip(elem, \u0022Enter a valid date.\u0022);\r\n }\r\n }\r\n tooltip ? resize_tooltip(tooltip) : false;\r\n return no_error;\r\n };\r\n var needs_validate = function(el) {\r\n if(el.getAttribute(\u0027required\u0027) !== null){\r\n return true\r\n }\r\n if(el.name === \u0027email\u0027 \u0026\u0026 el.value !== \u0022\u0022){\r\n return true\r\n }\r\n\r\n if((el.id == \u0027field[]\u0027 || el.id == \u0027ca[11][v]\u0027) \u0026\u0026 el.className.includes(\u0027phone-input-error\u0027)){\r\n return true\r\n }\r\n\r\n return false\r\n };\r\n var validate_form = function(e) {\r\n var err = form_to_submit.querySelector(\u0027._form_error\u0027), no_error = true;\r\n if (!submitted) {\r\n submitted = true;\r\n for (var i = 0, len = allInputs.length; i \u003C len; i++) {\r\n var input = allInputs[i];\r\n if (needs_validate(input)) {\r\n if (input.type == \u0027tel\u0027) {\r\n addEvent(input, \u0027blur\u0027, function() {\r\n this.value = this.value.trim();\r\n validate_field(this, true);\r\n });\r\n }\r\n if (input.type == \u0027text\u0027 || input.type == \u0027number\u0027 || input.type == \u0027time\u0027) {\r\n addEvent(input, \u0027blur\u0027, function() {\r\n this.value = this.value.trim();\r\n validate_field(this, true);\r\n });\r\n addEvent(input, \u0027input\u0027, function() {\r\n validate_field(this, true);\r\n });\r\n } else if (input.type == \u0027radio\u0027 || input.type == \u0027checkbox\u0027) {\r\n (function(el) {\r\n var radios = form_to_submit.elements[el.name];\r\n for (var i = 0; i \u003C radios.length; i++) {\r\n addEvent(radios[i], \u0027click\u0027, function() {\r\n validate_field(el, true);\r\n });\r\n }\r\n })(input);\r\n } else if (input.tagName == \u0027SELECT\u0027) {\r\n addEvent(input, \u0027change\u0027, function() {\r\n validate_field(this, true);\r\n });\r\n } else if (input.type == \u0027textarea\u0027){\r\n addEvent(input, \u0027input\u0027, function() {\r\n validate_field(this, true);\r\n });\r\n }\r\n }\r\n }\r\n }\r\n remove_tooltips();\r\n for (var i = 0, len = allInputs.length; i \u003C len; i++) {\r\n var elem = allInputs[i];\r\n if (needs_validate(elem)) {\r\n if (elem.tagName.toLowerCase() !== \u0022select\u0022) {\r\n elem.value = elem.value.trim();\r\n }\r\n validate_field(elem) ? true : no_error = false;\r\n }\r\n }\r\n if (!no_error \u0026\u0026 e) {\r\n e.preventDefault();\r\n }\r\n resize_tooltips();\r\n return no_error;\r\n };\r\n addEvent(window, \u0027resize\u0027, resize_tooltips);\r\n addEvent(window, \u0027scroll\u0027, resize_tooltips);\r\n\r\n var hidePhoneInputError = function(inputId) {\r\n var errorMessage = document.getElementById(\u0022error-msg-\u0022 + inputId);\r\n var input = document.getElementById(inputId);\r\n errorMessage.classList.remove(\u0022phone-error\u0022);\r\n errorMessage.classList.add(\u0022phone-error-hidden\u0022);\r\n input.classList.remove(\u0022phone-input-error\u0022);\r\n };\r\n\r\n var initializePhoneInput = function(input, defaultCountry) {\r\n return window.intlTelInput(input, {\r\n utilsScript: \u0022https:\/\/unpkg.com\/intl-tel-input@17.0.18\/build\/js\/utils.js\u0022,\r\n autoHideDialCode: false,\r\n separateDialCode: true,\r\n initialCountry: defaultCountry,\r\n preferredCountries: []\r\n });\r\n }\r\n\r\n var setPhoneInputEventListeners = function(inputId, input, iti) {\r\n input.addEventListener(\u0027blur\u0027, function() {\r\n var errorMessage = document.getElementById(\u0022error-msg-\u0022 + inputId);\r\n if (input.value.trim()) {\r\n if (iti.isValidNumber()) {\r\n iti.setNumber(iti.getNumber());\r\n if (errorMessage.classList.contains(\u0022phone-error\u0022)){\r\n hidePhoneInputError(inputId);\r\n }\r\n } else {\r\n showPhoneInputError(inputId)\r\n }\r\n } else {\r\n if (errorMessage.classList.contains(\u0022phone-error\u0022)){\r\n hidePhoneInputError(inputId);\r\n }\r\n }\r\n });\r\n\r\n input.addEventListener(\u0022countrychange\u0022, function() {\r\n iti.setNumber(\u0027\u0027);\r\n });\r\n\r\n input.addEventListener(\u0022keydown\u0022, function(e) {\r\n var charCode = (e.which) ? e.which : e.keyCode;\r\n if (charCode \u003E 31 \u0026\u0026 (charCode \u003C 48 || charCode \u003E 57) \u0026\u0026 charCode !== 8) {\r\n e.preventDefault();\r\n }\r\n });\r\n };\r\n\r\n var showPhoneInputError = function(inputId) {\r\n var errorMessage = document.getElementById(\u0022error-msg-\u0022 + inputId);\r\n var input = document.getElementById(inputId);\r\n errorMessage.classList.add(\u0022phone-error\u0022);\r\n errorMessage.classList.remove(\u0022phone-error-hidden\u0022);\r\n input.classList.add(\u0022phone-input-error\u0022);\r\n };\r\n\r\n\r\n var _form_serialize = function(form){if(!form||form.nodeName!==\u0022FORM\u0022){return }var i,j,q=[];for(i=0;i\u003Cform.elements.length;i++){if(form.elements[i].name===\u0022\u0022){continue}switch(form.elements[i].nodeName){case\u0022INPUT\u0022:switch(form.elements[i].type){case\u0022tel\u0022:q.push(form.elements[i].name+\u0022=\u0022+encodeURIComponent(form.elements[i].previousSibling.querySelector(\u0027div.iti__selected-dial-code\u0027).innerText)+encodeURIComponent(\u0022 \u0022)+encodeURIComponent(form.elements[i].value));break;case\u0022text\u0022:case\u0022number\u0022:case\u0022date\u0022:case\u0022time\u0022:case\u0022hidden\u0022:case\u0022password\u0022:case\u0022button\u0022:case\u0022reset\u0022:case\u0022submit\u0022:q.push(form.elements[i].name+\u0022=\u0022+encodeURIComponent(form.elements[i].value));break;case\u0022checkbox\u0022:case\u0022radio\u0022:if(form.elements[i].checked){q.push(form.elements[i].name+\u0022=\u0022+encodeURIComponent(form.elements[i].value))}break;case\u0022file\u0022:break}break;case\u0022TEXTAREA\u0022:q.push(form.elements[i].name+\u0022=\u0022+encodeURIComponent(form.elements[i].value));break;case\u0022SELECT\u0022:switch(form.elements[i].type){case\u0022select-one\u0022:q.push(form.elements[i].name+\u0022=\u0022+encodeURIComponent(form.elements[i].value));break;case\u0022select-multiple\u0022:for(j=0;j\u003Cform.elements[i].options.length;j++){if(form.elements[i].options[j].selected){q.push(form.elements[i].name+\u0022=\u0022+encodeURIComponent(form.elements[i].options[j].value))}}break}break;case\u0022BUTTON\u0022:switch(form.elements[i].type){case\u0022reset\u0022:case\u0022submit\u0022:case\u0022button\u0022:q.push(form.elements[i].name+\u0022=\u0022+encodeURIComponent(form.elements[i].value));break}break}}return q.join(\u0022\u0026\u0022)};\r\n var form_submit = function(e) {\r\n e.preventDefault();\r\n if (validate_form()) {\r\n \/\/ use this trick to get the submit button \u0026 disable it using plain javascript\r\n document.querySelector(\u0027#_form_29_submit\u0027).disabled = true;\r\n var serialized = _form_serialize(document.getElementById(\u0027_form_29_\u0027)).replace(\/%0A\/g, \u0027\\\\n\u0027);\r\n var err = form_to_submit.querySelector(\u0027._form_error\u0027);\r\n err ? err.parentNode.removeChild(err) : false;\r\n _load_script(\u0027https:\/\/a1homesnz.activehosted.com\/proc.php?\u0027 + serialized + \u0027\u0026jsonp=true\u0027);\r\n }\r\n return false;\r\n };\r\n addEvent(form_to_submit, \u0027submit\u0027, form_submit);\r\n})();\r\n\r\n\u003C\/script\u003E"}]