var u = 'https://embed.growform.co/go/6352bbe77c26ea00a9bc3ad9/embedMethod/iFrame'; if(window.location.search) { u = u + window.location.search } document.write( "" ); window.addEventListener("message", receiveMessage, false); function receiveMessage(event) { if (event.data.action == "growform_resize_height") { resizeHeight(event.data.height); } if (event.data.action == "growform_submit_form") { fireSubmission(event.data.customScript); } if (event.data.action == "growform_add_parent_gtm_container") { addParentGTMContainer(event.data.containerId, event.data.analyticsSettings); } if (event.data.action == "growform_form_loaded") { var event = new Event('growform_loaded'); window.dispatchEvent(event); } if(event.data.action=="growform_scroll_to_top") { var formRect = document.getElementById("growform_form").getBoundingClientRect(); var relativeFormYPosition = formRect.top; var absoluteFormYPosition = relativeFormYPosition + window.scrollY; var windowHeight = window.innerHeight || document.documentElement.clientHeight; if(relativeFormYPosition < 0 || relativeFormYPosition > windowHeight) { var offset = event.data.offset ? event.data.offset : 0; var scrollToX = absoluteFormYPosition + offset; window.setTimeout(function() { window.scrollTo({ top: scrollToX, behavior: "smooth" }); }, 100); } } } function resizeHeight(height) { var height = parseInt(height); height = Math.round(height) + 16; height = height + "px"; document.getElementById("growform_form").style.height = height; } var growform = {}; growform.setHiddenField = function(fieldName, value) { var growformIframe = document.getElementById('growform_form'); growformIframe.contentWindow.postMessage({ action: "growform_set_hidden_field", fieldName: fieldName, value: value }, "*"); } function addParentGTMContainer(containerId, analyticsSettings) { eval( (function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != "dataLayer" ? "&l=" + l : ""; j.async = true; j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl; f.parentNode.insertBefore(j, f); })(window, document, "script", "dataLayer", containerId) ); window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "growformAnalyticsSettings", growformAnalyticsSettings: analyticsSettings, }); } function fireSubmission(customScript) { var existingScript = document.getElementById("customScriptPageDiv"); if (!existingScript) { var customScriptPageDiv = document.createElement("customScriptPageDiv"); document.body.appendChild(customScriptPageDiv); customScriptPageDiv.innerHTML = customScript; var scripts = customScriptPageDiv.getElementsByTagName("script"); for (var i = 0; i < scripts.length; i++) { eval(scripts[i].innerText); } }}