function loadFormAssemblyFormHeadAndBodyContents() {
    var headContent = "<!-- FORM: HEAD SECTION -->\n    <meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/>\n    <meta name=\"referrer\" content=\"no-referrer-when-downgrade\">\n    <!-- THIS SCRIPT NEEDS TO BE LOADED FIRST BEFORE wforms.js -->\n    <script type=\"text\/javascript\" data-for=\"FA__DOMContentLoadedEventDispatch\" src=\"https:\/\/mpr.tfaforms.net\/js\/FA__DOMContentLoadedEventDispatcher.js\" defer><\/script>\n            <script type=\"text\/javascript\">\n        document.addEventListener(\"FA__DOMContentLoaded\", function(){\n            const FORM_TIME_START = Math.floor((new Date).getTime()\/1000);\n            let formElement = document.getElementById(\"tfa_0\");\n            if (null === formElement) {\n                formElement = document.getElementById(\"0\");\n            }\n            let appendJsTimerElement = function(){\n                let formTimeDiff = Math.floor((new Date).getTime()\/1000) - FORM_TIME_START;\n                let cumulatedTimeElement = document.getElementById(\"tfa_dbCumulatedTime\");\n                if (null !== cumulatedTimeElement) {\n                    let cumulatedTime = parseInt(cumulatedTimeElement.value);\n                    if (null !== cumulatedTime && cumulatedTime > 0) {\n                        formTimeDiff += cumulatedTime;\n                    }\n                }\n                let jsTimeInput = document.createElement(\"input\");\n                jsTimeInput.setAttribute(\"type\", \"hidden\");\n                jsTimeInput.setAttribute(\"value\", formTimeDiff.toString());\n                jsTimeInput.setAttribute(\"name\", \"tfa_dbElapsedJsTime\");\n                jsTimeInput.setAttribute(\"id\", \"tfa_dbElapsedJsTime\");\n                jsTimeInput.setAttribute(\"autocomplete\", \"off\");\n                if (null !== formElement) {\n                    formElement.appendChild(jsTimeInput);\n                }\n            };\n            if (null !== formElement) {\n                if(formElement.addEventListener){\n                    formElement.addEventListener('submit', appendJsTimerElement, false);\n                } else if(formElement.attachEvent){\n                    formElement.attachEvent('onsubmit', appendJsTimerElement);\n                }\n            }\n        });\n    <\/script>\n\n    <link href=\"https:\/\/mpr.tfaforms.net\/dist\/form-builder\/5.0.0\/wforms-layout.css?v=cbc5f41a06e2f47d79993f93034edc98f3828dc4\" rel=\"stylesheet\" type=\"text\/css\" \/>\n\n    <link href=\"https:\/\/mpr.tfaforms.net\/uploads\/themes\/theme-32.css\" rel=\"stylesheet\" type=\"text\/css\" \/>\n    <link href=\"https:\/\/mpr.tfaforms.net\/dist\/form-builder\/5.0.0\/wforms-jsonly.css?v=cbc5f41a06e2f47d79993f93034edc98f3828dc4\" rel=\"alternate stylesheet\" title=\"This stylesheet activated by javascript\" type=\"text\/css\" \/>\n    <script type=\"text\/javascript\" src=\"https:\/\/mpr.tfaforms.net\/wForms\/3.11\/js\/wforms.js?v=cbc5f41a06e2f47d79993f93034edc98f3828dc4\"><\/script>\n    <script type=\"text\/javascript\">\n        wFORMS.behaviors.prefill.skip = false;\n    <\/script>\n        <script type=\"text\/javascript\" src=\"https:\/\/mpr.tfaforms.net\/wForms\/3.11\/js\/localization-en_US.js?v=cbc5f41a06e2f47d79993f93034edc98f3828dc4\"><\/script>\n\n";
    var bodyContent = "<!-- FORM: BODY SECTION -->\n<div class=\"wFormContainer\" >\n    <div class=\"wFormHeader\"><\/div>\n    <style type=\"text\/css\">\n                #tfa_1,\n                *[id^=\"tfa_1[\"] {\n                    width: 560px !important;\n                }\n                #tfa_1-D,\n                *[id^=\"tfa_1[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            <\/style><div class=\"\"><div class=\"wForm\" id=\"119-WRPR\" data-language=\"en_US\" dir=\"ltr\">\n<div class=\"codesection\" id=\"code-119\"><style type=\"text\/css\">\n  div.htmlSection {\n    margin: 0 !important;\n  }\n  \n  label.postField {\n    padding-left: 20px !important;\n  }\n\n  div.captchaHelp {\n    display: none !important;\n  }\n\n  input#submit_button {\n    margin-top: 0px;\n  }\n\n  .wForm .oneField {\n    margin-top: 0px !important;\n  }\n\n  .wForm form .oneChoice {\n    border: 1px #E8E8E8 solid;\n    padding: 15px;\n    width: 560px;\n  }\n\n  .wformfooter{\n    display:none;\n  }\n\n  .supportInfo{\n    display:none;\n  }\n<\/style><\/div>\n<form method=\"post\" action=\"https:\/\/mpr.tfaforms.net\/api_v2\/workflow\/processor\" class=\"hintsBelow labelsAbove\" id=\"119\" role=\"form\">\n<div class=\"oneField field-container-D    \" id=\"tfa_1-D\">\n<label id=\"tfa_1-L\" class=\"label preField reqMark\" for=\"tfa_1\"><b>Email Address<\/b><\/label><br><div class=\"inputWrapper\"><input aria-required=\"true\" type=\"text\" id=\"tfa_1\" name=\"tfa_1\" value=\"\" placeholder=\"Email Address\" title=\"Email Address\" class=\"validate-email required\"><\/div>\n<\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_60-D\" role=\"group\" aria-labelledby=\"tfa_60-L\" data-tfa-labelledby=\"-L tfa_60-L\"><div class=\"inputWrapper\"><span id=\"tfa_60\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_61\" class=\"\" id=\"tfa_61\" name=\"tfa_61\" aria-labelledby=\"tfa_61-L\" data-tfa-labelledby=\"tfa_60-L tfa_61-L\" data-tfa-parent-id=\"tfa_60\"><label class=\"label postField\" id=\"tfa_61-L\" for=\"tfa_61\"><span class=\"input-checkbox-faux\"><\/span><span style=\"font-size: 16px;\">WEEKDAYS<br><\/span><p class=\"x_MsoNormal\" style=\"margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif; color: rgb(36, 36, 36);\"><b><span style=\"border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: Calibri, sans-serif; font-optical-sizing: inherit; font-size-adjust: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; margin: 0px; padding: 0px; vertical-align: baseline; color: inherit;\">The LA Report - A.M. Edition<\/span><\/b><\/p><div><b><span style=\"border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: Calibri, sans-serif; font-optical-sizing: inherit; font-size-adjust: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; margin: 0px; padding: 0px; vertical-align: baseline; color: inherit;\"><br><\/span><\/b><\/div><span style=\"text-wrap: pretty;\">Delivered Monday through Friday each morning, we catch you up with L.A.'s top 5 stories in just 3 minutes.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_40-D\" role=\"group\" aria-labelledby=\"tfa_40-L\" data-tfa-labelledby=\"-L tfa_40-L\"><div class=\"inputWrapper\"><span id=\"tfa_40\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_41\" class=\"\" id=\"tfa_41\" name=\"tfa_41\" aria-labelledby=\"tfa_41-L\" data-tfa-labelledby=\"tfa_40-L tfa_41-L\" data-tfa-parent-id=\"tfa_40\"><label class=\"label postField\" id=\"tfa_41-L\" for=\"tfa_41\"><span class=\"input-checkbox-faux\"><\/span>WEEKDAYS<br><b>The LA Report - P.M. Edition<br><br><\/b><br><span style=\"text-wrap: pretty;\">End your day with a breakdown of the newest stories affecting people living in Southern California.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_36-D\" role=\"group\" aria-labelledby=\"tfa_36-L\" data-tfa-labelledby=\"-L tfa_36-L\"><div class=\"inputWrapper\"><span id=\"tfa_36\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_37\" class=\"\" id=\"tfa_37\" name=\"tfa_37\" aria-labelledby=\"tfa_37-L\" data-tfa-labelledby=\"tfa_36-L tfa_37-L\" data-tfa-parent-id=\"tfa_36\"><label class=\"label postField\" id=\"tfa_37-L\" for=\"tfa_37\"><span class=\"input-checkbox-faux\"><\/span>FRIDAYS<br><span style=\"color: rgb(42, 42, 42); font-family: &quot;Noto Sans&quot;, system-ui, sans-serif; font-size: 15.6558px; white-space-collapse: initial;\"><b>AirTalk Weekly<br><\/b><\/span><span style=\"text-wrap: pretty;\"><br>The best interviews and segments from <i>AirTalk <\/i>each week, handpicked by Larry Mantle and the <i>AirTalk <\/i>team.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_44-D\" role=\"group\" aria-labelledby=\"tfa_44-L\" data-tfa-labelledby=\"-L tfa_44-L\"><div class=\"inputWrapper\"><span id=\"tfa_44\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_45\" class=\"\" id=\"tfa_45\" name=\"tfa_45\" aria-labelledby=\"tfa_45-L\" data-tfa-labelledby=\"tfa_44-L tfa_45-L\" data-tfa-parent-id=\"tfa_44\"><label class=\"label postField\" id=\"tfa_45-L\" for=\"tfa_45\"><span class=\"input-checkbox-faux\"><\/span>LIMITED-RUN<br><span style=\"font-size: 16px;\"><b>Make It Make Sense<\/b><br><\/span><span style=\"text-wrap: pretty;\"><br>Our election newsletter helps you make sense of the choices on your ballot and what the results mean for your life in L.A. Starts again in Fall 2024.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_48-D\" role=\"group\" aria-labelledby=\"tfa_48-L\" data-tfa-labelledby=\"-L tfa_48-L\"><div class=\"inputWrapper\"><span id=\"tfa_48\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_49\" class=\"\" id=\"tfa_49\" name=\"tfa_49\" aria-labelledby=\"tfa_49-L\" data-tfa-labelledby=\"tfa_48-L tfa_49-L\" data-tfa-parent-id=\"tfa_48\"><label class=\"label postField\" id=\"tfa_49-L\" for=\"tfa_49\"><span class=\"input-checkbox-faux\"><\/span><span style=\"font-size: 16px;\">BI-WEEKLY<br><b>LAist Insider<\/b><br><\/span><span style=\"text-wrap: pretty;\"><br>Inside information about your favorite programs, community event highlights, and exclusive benefits for members like you.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_52-D\" role=\"group\" aria-labelledby=\"tfa_52-L\" data-tfa-labelledby=\"-L tfa_52-L\"><div class=\"inputWrapper\"><span id=\"tfa_52\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_53\" class=\"\" id=\"tfa_53\" name=\"tfa_53\" aria-labelledby=\"tfa_53-L\" data-tfa-labelledby=\"tfa_52-L tfa_53-L\" data-tfa-parent-id=\"tfa_52\"><label class=\"label postField\" id=\"tfa_53-L\" for=\"tfa_53\"><span class=\"input-checkbox-faux\"><\/span><span style=\"font-size: 16px;\">BI-WEEKLY<br><b>LAist Orange County Insider<\/b><br><\/span><span style=\"text-wrap: pretty;\"><br>Keep up with LAist\u2019s O.C. news stories and upcoming events.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_56-D\" role=\"group\" aria-labelledby=\"tfa_56-L\" data-tfa-labelledby=\"-L tfa_56-L\"><div class=\"inputWrapper\"><span id=\"tfa_56\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_57\" class=\"\" id=\"tfa_57\" name=\"tfa_57\" aria-labelledby=\"tfa_57-L\" data-tfa-labelledby=\"tfa_56-L tfa_57-L\" data-tfa-parent-id=\"tfa_56\"><label class=\"label postField\" id=\"tfa_57-L\" for=\"tfa_57\"><span class=\"input-checkbox-faux\"><\/span><span style=\"font-size: 16px;\">BI-WEEKLY<br><b>LAist Live Events &amp; Programming<\/b><br><\/span><span style=\"text-wrap: pretty;\"><br>Stay up to date with the latest information about our events.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_64-D\" role=\"group\" aria-labelledby=\"tfa_64-L\" data-tfa-labelledby=\"-L tfa_64-L\"><div class=\"inputWrapper\"><span id=\"tfa_64\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_65\" class=\"\" id=\"tfa_65\" name=\"tfa_65\" aria-labelledby=\"tfa_65-L\" data-tfa-labelledby=\"tfa_64-L tfa_65-L\" data-tfa-parent-id=\"tfa_64\"><label class=\"label postField\" id=\"tfa_65-L\" for=\"tfa_65\"><span class=\"input-checkbox-faux\"><\/span><span style=\"font-size: 16px;\">BI-WEEKLY<br><\/span><b>Early Childhood<br><\/b><span style=\"text-wrap: pretty;\"><br>Get key reads and resources on issues affecting families with kids ages 0\u20135.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_68-D\" role=\"group\" aria-labelledby=\"tfa_68-L\" data-tfa-labelledby=\"-L tfa_68-L\"><div class=\"inputWrapper\"><span id=\"tfa_68\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_69\" class=\"\" id=\"tfa_69\" name=\"tfa_69\" aria-labelledby=\"tfa_69-L\" data-tfa-labelledby=\"tfa_68-L tfa_69-L\" data-tfa-parent-id=\"tfa_68\"><label class=\"label postField\" id=\"tfa_69-L\" for=\"tfa_69\"><span class=\"input-checkbox-faux\"><\/span>MONDAYS &amp; THURSDAYS<br><b>Best Things To Do<br><\/b><span style=\"text-wrap: pretty;\"><br>Discover L.A. events, dining, outdoor hikes, nightlife, and occasional ticket giveaways.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_72-D\" role=\"group\" aria-labelledby=\"tfa_72-L\" data-tfa-labelledby=\"-L tfa_72-L\"><div class=\"inputWrapper\"><span id=\"tfa_72\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_73\" class=\"\" id=\"tfa_73\" name=\"tfa_73\" aria-labelledby=\"tfa_73-L\" data-tfa-labelledby=\"tfa_72-L tfa_73-L\" data-tfa-parent-id=\"tfa_72\"><label class=\"label postField\" id=\"tfa_73-L\" for=\"tfa_73\"><span class=\"input-checkbox-faux\"><\/span>SATURDAYS<br><b style=\"text-wrap: pretty;\">How to LA<br><\/b><br><br><span style=\"text-wrap: pretty;\">For the curious Angeleno who wants to better connect with our county. Discover stories about L.A., for L.A. \u2014 by LAist.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_76-D\" role=\"group\" aria-labelledby=\"tfa_76-L\" data-tfa-labelledby=\"-L tfa_76-L\"><div class=\"inputWrapper\"><span id=\"tfa_76\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_77\" class=\"\" id=\"tfa_77\" name=\"tfa_77\" aria-labelledby=\"tfa_77-L\" data-tfa-labelledby=\"tfa_76-L tfa_77-L\" data-tfa-parent-id=\"tfa_76\"><label class=\"label postField\" id=\"tfa_77-L\" for=\"tfa_77\"><span class=\"input-checkbox-faux\"><\/span>AS NEEDED<br><span style=\"text-wrap: pretty;\"><b>Breaking News<\/b><\/span><br><br><span style=\"text-wrap: pretty;\">Get the biggest, breaking stories that affect L.A. and SoCal as they happen.<\/span><\/label><\/span><\/span><\/div><\/div>\n<div class=\"oneField field-container-D  labelsRemoved  \" id=\"tfa_80-D\" role=\"group\" aria-labelledby=\"tfa_80-L\" data-tfa-labelledby=\"-L tfa_80-L\"><div class=\"inputWrapper\"><span id=\"tfa_80\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_81\" class=\"\" id=\"tfa_81\" name=\"tfa_81\" aria-labelledby=\"tfa_81-L\" data-tfa-labelledby=\"tfa_80-L tfa_81-L\" data-tfa-parent-id=\"tfa_80\"><label class=\"label postField\" id=\"tfa_81-L\" for=\"tfa_81\"><span class=\"input-checkbox-faux\"><\/span>DAILY FOR SEVEN DAYS<br><b><span style=\"text-wrap: pretty;\">Building Your Block<br><\/span><\/b><span style=\"text-wrap: pretty;\"><br>A seven-issue newsletter course that helps you better understand L.A.'s housing challenges&nbsp; and what you can do to make things better.<\/span><\/label><\/span><\/span><\/div><\/div>\n<input type=\"hidden\" id=\"tfa_3\" name=\"tfa_3\" value=\"\" class=\"\"><input type=\"hidden\" id=\"tfa_5\" name=\"tfa_5\" value=\"\" class=\"\"><input type=\"hidden\" id=\"tfa_7\" name=\"tfa_7\" value=\"\" class=\"\"><input type=\"hidden\" id=\"tfa_9\" name=\"tfa_9\" value=\"\" class=\"\"><input type=\"hidden\" id=\"tfa_11\" name=\"tfa_11\" value=\"\" class=\"\"><input type=\"hidden\" id=\"tfa_33\" name=\"tfa_33\" value=\"\" class=\"\"><div class=\"htmlSection\" id=\"tfa_31\"><div class=\"htmlContent\" id=\"tfa_31-HTML\"><script type=\"text\/javascript\">\n\/\/ Parse the URL\nfunction getParameterByName(name) {\n    name = name.replace(\/[\\[]\/, \"\\\\[\").replace(\/[\\]]\/, \"\\\\]\");\n    var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n    results = regex.exec(location.search);\n    return results === null ? \"\" : decodeURIComponent(results[1].replace(\/\\+\/g, \" \"));\n}\n\/\/ Give the URL parameters variable names\nvar source;\nif( window.location.search.indexOf(\"utm_source\") > 0){\n  source = getParameterByName('utm_source');\n  }  else { source = getParameterByName('og_source');}\nvar medium; \nif( window.location.search.indexOf(\"utm_medium\") > 0){\n  medium = getParameterByName('utm_medium');\n  }  else { medium = getParameterByName('og_medium');}\nvar campaign; \nif( window.location.search.indexOf(\"utm_campaign\") > 0){\n  campaign = getParameterByName('utm_campaign');\n  }  else { campaign = getParameterByName('og_campaign');}\nvar term;\nif( window.location.search.indexOf(\"utm_term\") > 0){\n  term = getParameterByName('utm_term');\n  }  else { term = getParameterByName('og_term');}\nvar content;\nif( window.location.search.indexOf(\"utm_content\") > 0){\n  content = getParameterByName('utm_content');\n  }  else { content = getParameterByName('og_content');}\nvar url = window.location.href;\n\n\/\/ Put the variable names into the hidden fields in the form\"\nif(source){document.getElementById(\"tfa_3\").value = source;};\nif(medium){document.getElementById(\"tfa_5\").value = medium;};\nif(campaign){document.getElementById(\"tfa_7\").value = campaign;};\nif(term){document.getElementById(\"tfa_11\").value = term;};\nif(content){document.getElementById(\"tfa_9\").value = content;};\nif(url){document.getElementById(\"tfa_33\").value = url;};\n\n  \/\/change email field type\n  document.getElementById('tfa_1').type = 'email';\n<\/script> \n\n<p style=\"font-size: 10px; width: 560px;\"><br>By submitting, you consent to receive information about LAist's programs and offerings. The personally identifying information you provide will not be sold, shared, or used for purposes other than to communicate with you about LAist and its sponsors. You may opt-out at any time clicking the unsubscribe link at the bottom of any email communication. <a target=\"_blank\" href=\"https:\/\/www.americanpublicmedia.org\/privacy\/\">View our Privacy Policy.<\/a>\n<\/p><\/div><\/div>\n<div class=\"actions\" id=\"119-A\" data-contentid=\"submit_button\"><input type=\"submit\" data-label=\"Sign Up\" class=\"primaryAction\" id=\"submit_button\" value=\"Sign Up\"><\/div>\n<div style=\"clear:both\"><\/div>\n<input type=\"hidden\" value=\"119\" name=\"tfa_dbFormId\" id=\"tfa_dbFormId\"><input type=\"hidden\" value=\"\" name=\"tfa_dbResponseId\" id=\"tfa_dbResponseId\"><input type=\"hidden\" value=\"25da5041515508ec7a8f2678dc5a98c9\" name=\"tfa_dbControl\" id=\"tfa_dbControl\"><input type=\"hidden\" value=\"\" name=\"tfa_dbWorkflowSessionUuid\" id=\"tfa_dbWorkflowSessionUuid\"><input type=\"hidden\" value=\"60\" name=\"tfa_dbVersionId\" id=\"tfa_dbVersionId\"><input type=\"hidden\" value=\"\" name=\"tfa_switchedoff\" id=\"tfa_switchedoff\">\n<\/form>\n<\/div><\/div><div class=\"wFormFooter\"><p class=\"supportInfo\"><br><\/p><\/div>\n  <p class=\"supportInfo\" >\n      <\/p>\n <\/div>\n\n<script\n    id=\"open-telemetry-script\"\n    type=\"text\/javascript\"\n    src=\"https:\/\/mpr.tfaforms.net\/dist\/open-telemetry\/open-telemetry.e3e59835d0ec08f714f1.js\"\n    data-customer-id=\"727\"\n    data-exporter-url=\"https:\/\/us-east-1-otel.formassembly.com\/v1\/traces\"\n    data-exporter-console=\"0\"\n><\/script>\n<script src=\"https:\/\/mpr.tfaforms.net\/api_v2\/sst\/quick-publish\"><\/script>";
    var elementID = null;
    var quickPublishScript = document.querySelector('script[data-qp-target-id]');
    if (quickPublishScript) {
        elementID = quickPublishScript.getAttribute('data-qp-target-id');
    }

    // append head content
    var head = document.createElement('head');
    head.innerHTML = headContent;
    var headElements = head.children;

    // filter out the script tags with src from headElements, then recursively apply each script
    var headElementsArray = Array.from(headElements);
    var otherHeadElements = headElementsArray.filter(function (el) {
        return el.nodeName !== 'SCRIPT'
    });
    var headScriptElements = headElementsArray.filter(function (el) {
        return el.nodeName === 'SCRIPT'
    });
    loadOtherHeadElements(otherHeadElements);
    loadHeadScriptElements(headScriptElements);

    // append body content
    var body = document.createElement('body');
    body.innerHTML = bodyContent;
    var bodyElements = body.children;
    var bodyWrapperDiv = document.createElement('div');
    bodyWrapperDiv.id = "FA__QP__BODYWRAPPERDIV";
    Array.from(bodyElements).forEach(function(el) {
        if (!elementID) {
            bodyWrapperDiv.appendChild(el);
            document.body.appendChild(bodyWrapperDiv);
        } else {
            var element = document.getElementById(elementID);
            if (!element) { // insert form at the end of the page
                bodyWrapperDiv.appendChild(el);
                document.body.appendChild(bodyWrapperDiv);
            } else { // insert within element
                bodyWrapperDiv.appendChild(el);
                element.appendChild(bodyWrapperDiv);
            }
        }
    });

    document.addEventListener('FA__DOMContentLoaded', function () {
        var bodyWrapperDivFromDocument = document.getElementById("FA__QP__BODYWRAPPERDIV");
        var scriptTags = bodyWrapperDivFromDocument.querySelectorAll('script');
        Array.from(scriptTags).forEach(function (scriptTag) {
            var script = document.createElement('script');
            if (scriptTag.hasAttribute('src')) {
                script.src = scriptTag.src;
            } else {
                script.innerHTML = scriptTag.innerHTML;
            }
            // copy over other attributes of the script
            Array.from(scriptTag.attributes).forEach(function (attr) {
                if (attr.name !== 'src') {
                    script.setAttribute(attr.name, attr.value);
                }
            });
            scriptTag.replaceWith(script);
        });
    })
}

/**
 * Load other <head> elements like <meta> and <link> etc
 *
 * @param  otherHeadElements
 */
function loadOtherHeadElements(otherHeadElements) {
    var element = otherHeadElements.shift();
    document.head.appendChild(element);
    if (otherHeadElements.length) {
        loadOtherHeadElements(otherHeadElements);
    }
}

/**
* Dispatch QuickPublishDone event
*/
function dispatchQuickPublishDone() {
    document.dispatchEvent(new Event('FA__DOMContentLoaded'));
}

/**
 * Sequentially load all <head> script elements.
 *
 * @param  headScriptElements
 */
function loadHeadScriptElements(headScriptElements) {
    var faScript = headScriptElements.shift();
    var newScript = document.createElement('script');

    if (faScript.innerHTML) {
        newScript.innerHTML = faScript.innerHTML;
        document.head.appendChild(newScript);

        if (! headScriptElements.length) {
            dispatchQuickPublishDone();
            return;
        }

        return loadHeadScriptElements(headScriptElements);
    }

    document.head.appendChild(newScript);
    newScript.onload = function () {
        if (headScriptElements.length) {
            return loadHeadScriptElements(headScriptElements);
        } else {
            dispatchQuickPublishDone();
        }
    };

    Array.from(faScript.attributes).forEach(function (attr) {
        if (attr.name !== 'src') {
            newScript.setAttributeNode(attr.cloneNode(true));
        }
    });
    newScript.src = faScript.src;
}

window.addEventListener('DOMContentLoaded', loadFormAssemblyFormHeadAndBodyContents);