var headContent = "<!-- FORM: HEAD SECTION --><head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta name=\"referrer\" content=\"no-referrer-when-downgrade\">\n    <title><\/title>\n                                        <link href=\"https:\/\/orlandohealth.tfaforms.net\/dist\/form-builder\/5.0.0\/wforms-layout.css?v=1759037553\" rel=\"stylesheet\" type=\"text\/css\">\n                                                <link href=\"https:\/\/orlandohealth.tfaforms.net\/dist\/form-builder\/5.0.0\/wforms-jsonly.css?v=1759037553\" rel=\"stylesheet\" type=\"text\/css\">\n                                                <link href=\"https:\/\/orlandohealth.tfaforms.net\/uploads\/themes\/theme-26.css?v=1759037553\" rel=\"stylesheet\" type=\"text\/css\">\n                                                        <script src=\"https:\/\/orlandohealth.tfaforms.net\/js\/FA__DOMContentLoadedEventDispatcher.js?v=1759037553\" type=\"text\/javascript\"><\/script>\n                                                <script src=\"https:\/\/orlandohealth.tfaforms.net\/wForms\/3.11\/js\/wforms.js?v=1759037553\" type=\"text\/javascript\"><\/script>\n                                                <script src=\"https:\/\/orlandohealth.tfaforms.net\/wForms\/3.11\/js\/localization-en_US.js?v=1759037553\" type=\"text\/javascript\"><\/script>\n                                                <script src=\"https:\/\/orlandohealth.tfaforms.net\/wForms\/3.11\/js\/wforms_prefill.js?v=1759037553\" type=\"text\/javascript\"><\/script>\n                                                <script src=\"https:\/\/orlandohealth.tfaforms.net\/dist\/jquery\/jquery.0416573c648d279fd758.js?v=1759037553\" type=\"text\/javascript\"><\/script>\n                                                <script src=\"https:\/\/orlandohealth.tfaforms.net\/js\/typeahead\/v1.2.0\/typeahead.bundle.js?v=1759037553\" type=\"text\/javascript\"><\/script>\n                                                <script src=\"https:\/\/orlandohealth.tfaforms.net\/dist\/analytics\/data-collector.e86d94bd97a6d88cf5db.js?v=1759037553\" type=\"text\/javascript\"><\/script>\n                                                <script src=\"https:\/\/orlandohealth.tfaforms.net\/api_v2\/sst\/quick-publish?v=1759037553\" type=\"text\/javascript\"><\/script>\n                            \n    <\/head>";
var bodyContent = "<!-- FORM: BODY SECTION --><body class=\"default wFormWebPage\">\n\n    \n\n<div id=\"tfaContent\">\n\n            <div class=\"wFormContainer\">\n    <div class=\"wFormHeader\"><\/div>\n\n    \n    <style type=\"text\/css\">\n                #tfa_9-L,\n                label[id^=\"tfa_9[\"] {\n                    width: 300px !important;\n                    min-width: 0px;\n                }\n            \n                #tfa_11-L,\n                label[id^=\"tfa_11[\"] {\n                    width: 313px !important;\n                    min-width: 0px;\n                }\n            \n                #tfa_14,\n                *[id^=\"tfa_14[\"] {\n                    width: 400px !important;\n                }\n                #tfa_14-D,\n                *[id^=\"tfa_14[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_13,\n                *[id^=\"tfa_13[\"] {\n                    width: 400px !important;\n                }\n                #tfa_13-D,\n                *[id^=\"tfa_13[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_18,\n                *[id^=\"tfa_18[\"] {\n                    width: 400px !important;\n                }\n                #tfa_18-D,\n                *[id^=\"tfa_18[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_25,\n                *[id^=\"tfa_25[\"] {\n                    width: 400px !important;\n                }\n                #tfa_25-D,\n                *[id^=\"tfa_25[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_35,\n                *[id^=\"tfa_35[\"] {\n                    width: 400px !important;\n                }\n                #tfa_35-D,\n                *[id^=\"tfa_35[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_37,\n                *[id^=\"tfa_37[\"] {\n                    width: 400px !important;\n                }\n                #tfa_37-D,\n                *[id^=\"tfa_37[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_39,\n                *[id^=\"tfa_39[\"] {\n                    width: 400px !important;\n                }\n                #tfa_39-D,\n                *[id^=\"tfa_39[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_38,\n                *[id^=\"tfa_38[\"] {\n                    width: 400px !important;\n                }\n                #tfa_38-D,\n                *[id^=\"tfa_38[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_44,\n                *[id^=\"tfa_44[\"] {\n                    width: 400px !important;\n                }\n                #tfa_44-D,\n                *[id^=\"tfa_44[\"][class~=\"field-container-D\"] {\n                    width: auto !important;\n                }\n            \n                #tfa_44,\n                *[id^=\"tfa_44[\"] {\n                    height:  !important\n                }\n                #tfa_44-D,\n                *[id^=\"tfa_44[\"][class~=\"field-container-D\"] {\n                    height: auto !important;\n                }\n                #tfa_44-L,\n                label[id^=\"tfa_44[\"],\n                *[id^=\"tfa_44[\"][id$=\"-L\"] {\n                    height: auto !important;\n                }\n            <\/style><div class=\"\"><div class=\"wForm\" id=\"82-WRPR\" data-language=\"en_US\" dir=\"ltr\">\n<div class=\"codesection\" id=\"code-82\"><script src=\"https:\/\/www.orlandohealth.com\/-\/media\/formassembly\/formassembly_reCAPTCHA.js\" type=\"text\/javascript\"><\/script>\n<script src=\"https:\/\/www.orlandohealth.com\/-\/media\/formassembly\/formassembly_url_fields.js\" type=\"text\/javascript\"><\/script>\n<script src=\"https:\/\/www.orlandohealth.com\/-\/media\/formassembly\/formassembly_utm_fields.js\" type=\"text\/javascript\"><\/script><\/div>\n<form method=\"post\" action=\"https:\/\/orlandohealth.tfaforms.net\/api_v2\/workflow\/processor\" class=\" labelsLeftAligned\" id=\"82\">\n<div class=\"htmlSection\" id=\"tfa_52\"><div class=\"htmlContent\" id=\"tfa_52-HTML\"><span class=\"reqMark\"><\/span> Indicates a required field<\/div><\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_7-D\">\n<label id=\"tfa_7-L\" class=\"label preField reqMark\" for=\"tfa_7\">First Name<\/label><div class=\"inputWrapper\"><input aria-required=\"true\" type=\"text\" id=\"tfa_7\" name=\"tfa_7\" value=\"\" autocomplete=\"given-name\" title=\"First Name\" class='validate-custom \/^[^*|\\\":&lt;&gt;[\\]{}\\\\().;@&amp;$0-9]+$\/ required'><\/div>\n<script type=\"text\/javascript\">\n                        if(typeof wFORMS != 'undefined') {\n                            if(wFORMS.behaviors.validation) {\n                                wFORMS.behaviors.validation.rules['customtfa_7'] =  { selector: '*[id=\"tfa_7\"]', check: 'validateCustom'};\n                                wFORMS.behaviors.validation.messages['customtfa_7'] = \"Please enter a valid first name only.\";\n                            }\n                        }<\/script>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_8-D\">\n<label id=\"tfa_8-L\" class=\"label preField reqMark\" for=\"tfa_8\">Last Name<\/label><div class=\"inputWrapper\"><input aria-required=\"true\" type=\"text\" id=\"tfa_8\" name=\"tfa_8\" value=\"\" autocomplete=\"family-name\" title=\"Last Name\" class='validate-custom \/^[^*|\\\":&lt;&gt;[\\]{}\\\\().;@&amp;$0-9]+$\/ required'><\/div>\n<script type=\"text\/javascript\">\n                        if(typeof wFORMS != 'undefined') {\n                            if(wFORMS.behaviors.validation) {\n                                wFORMS.behaviors.validation.rules['customtfa_8'] =  { selector: '*[id=\"tfa_8\"]', check: 'validateCustom'};\n                                wFORMS.behaviors.validation.messages['customtfa_8'] = \"Please enter a valid last name only.\";\n                            }\n                        }<\/script>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_6-D\">\n<label id=\"tfa_6-L\" class=\"label preField reqMark\" for=\"tfa_6\">Email<\/label><div class=\"inputWrapper\"><input aria-required=\"true\" type=\"text\" id=\"tfa_6\" name=\"tfa_6\" value=\"\" autocomplete=\"email\" title=\"Email\" class=\"validate-email required\"><\/div>\n<\/div>\n<div class=\"oneField field-container-D  labelsAbove  \" id=\"tfa_9-D\" role=\"group\" aria-labelledby=\"tfa_9-L\" data-tfa-labelledby=\"-L tfa_9-L\">\n<label id=\"tfa_9-L\" class=\"label preField \" data-tfa-check-label-for=\"tfa_9\">Let's Keep in Touch<\/label><br><div class=\"inputWrapper\"><span id=\"tfa_9\" class=\"choices horizontal \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_48\" class=\"\" id=\"tfa_48\" name=\"tfa_48\" aria-labelledby=\"tfa_48-L\" data-tfa-labelledby=\"tfa_9-L tfa_48-L\" data-tfa-parent-id=\"tfa_9\"><label class=\"label postField\" id=\"tfa_48-L\" for=\"tfa_48\"><span class=\"input-checkbox-faux\"><\/span>Yes, I want Orlando Health to send me information about its various services via phone, email or direct mail.<\/label><\/span><\/span><\/div>\n<\/div>\n<fieldset id=\"tfa_47\" class=\"section wf-acl-hidden\">\n<legend id=\"tfa_47-L\">Hidden Fields<\/legend>\n<div class=\"oneField field-container-D  labelsAbove  \" id=\"tfa_11-D\" role=\"group\" aria-labelledby=\"tfa_11-L\" data-tfa-labelledby=\"-L tfa_11-L\">\n<label id=\"tfa_11-L\" class=\"label preField \" data-tfa-check-label-for=\"tfa_11\">FormAssembly Submission<\/label><br><div class=\"inputWrapper\"><span id=\"tfa_11\" class=\"choices vertical \"><span class=\"oneChoice\"><input type=\"checkbox\" value=\"tfa_12\" class=\"\" checked data-default-value=\"true\" id=\"tfa_12\" name=\"tfa_12\" aria-labelledby=\"tfa_12-L\" data-tfa-labelledby=\"tfa_11-L tfa_12-L\" data-tfa-parent-id=\"tfa_11\" disabled data-wforms-nooverwrite=\"disabled\"><input type=\"hidden\" id=\"tfa_11-R\" name=\"tfa_12\" value=\"tfa_12\"><label class=\"label postField\" id=\"tfa_12-L\" for=\"tfa_12\"><span class=\"input-checkbox-faux\"><\/span>FormAssembly Submission<\/label><\/span><\/span><\/div>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_14-D\">\n<label id=\"tfa_14-L\" class=\"label preField \" for=\"tfa_14\">Match Object<\/label><div class=\"inputWrapper\">\n<select id=\"tfa_14\" name=\"tfa_14\" disabled data-wforms-nooverwrite=\"disabled\" title=\"Match Object\" class=\"\"><option value=\"\">Please select...<\/option>\n<option value=\"tfa_15\" id=\"tfa_15\" class=\"\" selected data-default-value=\"true\">Patient<\/option>\n<option value=\"tfa_16\" id=\"tfa_16\" class=\"\">Provider<\/option><\/select><input type=\"hidden\" id=\"tfa_14-R\" name=\"tfa_14\" value=\"tfa_15\">\n<\/div>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_13-D\">\n<label id=\"tfa_13-L\" class=\"label preField \" for=\"tfa_13\">FormAssembly Form ID<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_13\" name=\"tfa_13\" value=\"82\" default=\"82\" readonly data-wforms-nooverwrite=\"disabled\" title=\"FormAssembly Form ID\" class=\"\"><\/div>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_18-D\">\n<label id=\"tfa_18-L\" class=\"label preField \" for=\"tfa_18\">Form Type<\/label><div class=\"inputWrapper\">\n<select id=\"tfa_18\" name=\"tfa_18\" disabled data-wforms-nooverwrite=\"disabled\" title=\"Form Type\" class=\"\"><option value=\"\">Please select...<\/option>\n<option value=\"tfa_19\" id=\"tfa_19\" class=\"\">Appointment Request<\/option>\n<option value=\"tfa_20\" id=\"tfa_20\" class=\"\" selected data-default-value=\"true\">Download Guide<\/option>\n<option value=\"tfa_21\" id=\"tfa_21\" class=\"\">General Inquiry<\/option>\n<option value=\"tfa_22\" id=\"tfa_22\" class=\"\">Newsletter Opt In<\/option>\n<option value=\"tfa_23\" id=\"tfa_23\" class=\"\">Import<\/option>\n<option value=\"tfa_24\" id=\"tfa_24\" class=\"\">Event Signup<\/option><\/select><input type=\"hidden\" id=\"tfa_18-R\" name=\"tfa_18\" value=\"tfa_20\">\n<\/div>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_25-D\">\n<label id=\"tfa_25-L\" class=\"label preField \" for=\"tfa_25\">Status<\/label><div class=\"inputWrapper\"><select id=\"tfa_25\" name=\"tfa_25\" title=\"Status\" class=\"\"><option value=\"\">Please select...<\/option>\n<option value=\"tfa_26\" id=\"tfa_26\" class=\"\">New<\/option>\n<option value=\"tfa_27\" id=\"tfa_27\" class=\"\">Open<\/option>\n<option value=\"tfa_28\" id=\"tfa_28\" class=\"\">In Progress<\/option>\n<option value=\"tfa_29\" id=\"tfa_29\" class=\"\">On Hold<\/option>\n<option value=\"tfa_30\" id=\"tfa_30\" class=\"\">Escalated<\/option>\n<option value=\"tfa_31\" id=\"tfa_31\" class=\"\" selected data-default-value=\"true\">Closed<\/option><\/select><\/div>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_35-D\">\n<label id=\"tfa_35-L\" class=\"label preField \" for=\"tfa_35\">Campaign Id<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_35\" name=\"tfa_35\" value=\"7015e000000DwVJAA0\" default=\"7015e000000DwVJAA0\" readonly data-wforms-nooverwrite=\"disabled\" title=\"Campaign Id\" class=\"\"><\/div>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_37-D\">\n<label id=\"tfa_37-L\" class=\"label preField \" for=\"tfa_37\">Subscriptions<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_37\" name=\"tfa_37\" value=\"Neuroscience\" default=\"Neuroscience\" title=\"Subscriptions\" class=\"\"><\/div>\n<\/div>\n<div class=\"oneField field-container-D    \" id=\"tfa_39-D\">\n<label id=\"tfa_39-L\" class=\"label preField \" for=\"tfa_39\">Case Origin<\/label><div class=\"inputWrapper\">\n<select id=\"tfa_39\" name=\"tfa_39\" disabled data-wforms-nooverwrite=\"disabled\" title=\"Case Origin\" class=\"\"><option value=\"\">Please select...<\/option>\n<option value=\"tfa_40\" id=\"tfa_40\" class=\"\">Email<\/option>\n<option value=\"tfa_41\" id=\"tfa_41\" class=\"\">Phone<\/option>\n<option value=\"tfa_42\" id=\"tfa_42\" class=\"\" selected data-default-value=\"true\">Web<\/option>\n<option value=\"tfa_43\" id=\"tfa_43\" class=\"\">Internal<\/option><\/select><input type=\"hidden\" id=\"tfa_39-R\" name=\"tfa_39\" value=\"tfa_42\">\n<\/div>\n<\/div>\n<input type=\"hidden\" id=\"tfa_38\" name=\"tfa_38\" value=\"0125e000000DZr0AAG\" class=\"\"><div class=\"oneField field-container-D    \" id=\"tfa_44-D\">\n<label id=\"tfa_44-L\" class=\"label preField \" for=\"tfa_44\">Submitted From URL<\/label><div class=\"inputWrapper\"><textarea id=\"tfa_44\" name=\"tfa_44\" title=\"Submitted From URL\" class=\"\"><\/textarea><\/div>\n<\/div>\n<\/fieldset>\n<fieldset id=\"tfa_46\" class=\"section column wf-acl-hidden\">\n<legend id=\"tfa_46-L\">UTM<\/legend>\n<table class=\"columnLayout\">\n<tr>\n<td><div class=\"oneField field-container-D    \" id=\"tfa_5-D\">\n<label id=\"tfa_5-L\" class=\"label preField \" for=\"tfa_5\">UTM Campaign<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_5\" name=\"tfa_5\" value=\"\" title=\"UTM Campaign\" class=\"\"><\/div>\n<\/div><\/td>\n<td><div class=\"oneField field-container-D    \" id=\"tfa_4-D\">\n<label id=\"tfa_4-L\" class=\"label preField \" for=\"tfa_4\">UTM Content<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_4\" name=\"tfa_4\" value=\"\" title=\"UTM Content\" class=\"\"><\/div>\n<\/div><\/td>\n<\/tr>\n<tr>\n<td><div class=\"oneField field-container-D    \" id=\"tfa_3-D\">\n<label id=\"tfa_3-L\" class=\"label preField \" for=\"tfa_3\">UTM Medium<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_3\" name=\"tfa_3\" value=\"\" title=\"UTM Medium\" class=\"\"><\/div>\n<\/div><\/td>\n<td><div class=\"oneField field-container-D    \" id=\"tfa_2-D\">\n<label id=\"tfa_2-L\" class=\"label preField \" for=\"tfa_2\">UTM Source<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_2\" name=\"tfa_2\" value=\"\" title=\"UTM Source\" class=\"\"><\/div>\n<\/div><\/td>\n<\/tr>\n<tr>\n<td><div class=\"oneField field-container-D    \" id=\"tfa_1-D\">\n<label id=\"tfa_1-L\" class=\"label preField \" for=\"tfa_1\">UTM Term<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_1\" name=\"tfa_1\" value=\"\" title=\"UTM Term\" class=\"\"><\/div>\n<\/div><\/td>\n<td><div class=\"oneField field-container-D    \" id=\"tfa_49-D\">\n<label id=\"tfa_49-L\" class=\"label preField \" for=\"tfa_49\">GA Client Id<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_49\" name=\"tfa_49\" value=\"\" title=\"GA Client Id\" class=\"\"><\/div>\n<\/div><\/td>\n<\/tr>\n<tr>\n<td><div class=\"oneField field-container-D    \" id=\"tfa_50-D\">\n<label id=\"tfa_50-L\" class=\"label preField \" for=\"tfa_50\">GA Session Id<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_50\" name=\"tfa_50\" value=\"\" title=\"GA Session Id\" class=\"\"><\/div>\n<\/div><\/td>\n<td><div class=\"oneField field-container-D    \" id=\"tfa_51-D\">\n<label id=\"tfa_51-L\" class=\"label preField \" for=\"tfa_51\">GA GCLID<\/label><div class=\"inputWrapper\"><input type=\"text\" id=\"tfa_51\" name=\"tfa_51\" value=\"\" title=\"GA GCLID\" class=\"\"><\/div>\n<\/div><\/td>\n<\/tr>\n<\/table>\n<\/fieldset>\n<div class=\"actions\" id=\"82-A\" data-contentid=\"submit_button\">\n<div id=\"google-captcha\" style=\"display: none\">\n<br><div class=\"captcha\">\n<div class=\"oneField\">\n<div class=\"g-recaptcha\" id=\"g-recaptcha-render-div\"><\/div>\n<div class=\"g-captcha-error\"><\/div>\n<br>\n<\/div>\n<div class=\"captchaHelp\">reCAPTCHA helps prevent automated form spam.<br>\n<\/div>\n<div id=\"disabled-explanation\" class=\"captchaHelp\" style=\"display: none\">The submit button will be disabled until you complete the CAPTCHA.<\/div>\n<\/div>\n<\/div>\n<input type=\"submit\" data-label=\"Submit\" class=\"primaryAction\" id=\"submit_button\" value=\"Submit\">\n<\/div>\n<div style=\"clear:both\"><\/div>\n<input type=\"hidden\" value=\"725-08d1f9ec29826e79a76db3e21d7063b4\" name=\"tfa_dbCounters\" id=\"tfa_dbCounters\" autocomplete=\"off\"><input type=\"hidden\" value=\"82\" name=\"tfa_dbFormId\" id=\"tfa_dbFormId\"><input type=\"hidden\" value=\"\" name=\"tfa_dbResponseId\" id=\"tfa_dbResponseId\"><input type=\"hidden\" value=\"18d61914f39900a4d07363fe9c935610\" name=\"tfa_dbControl\" id=\"tfa_dbControl\"><input type=\"hidden\" value=\"\" name=\"tfa_dbWorkflowSessionUuid\" id=\"tfa_dbWorkflowSessionUuid\"><input type=\"hidden\" value=\"0\" name=\"tfa_dbDataflowId\" id=\"tfa_dbDataflowId\"><input type=\"hidden\" value=\"1759037553\" name=\"tfa_dbTimeStarted\" id=\"tfa_dbTimeStarted\" autocomplete=\"off\"><input type=\"hidden\" value=\"2\" name=\"tfa_dbVersionId\" id=\"tfa_dbVersionId\"><input type=\"hidden\" value=\"false\" name=\"startWorkflow\" id=\"startWorkflow\"><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\n<\/div>\n\n\n            <script id=\"analytics-collector-script\" type=\"text\/javascript\" src=\"https:\/\/orlandohealth.tfaforms.net\/dist\/analytics\/data-collector.e86d94bd97a6d88cf5db.js\" data-customer-id=\"24380\" data-endpoint=\"https:\/\/analytics.formassembly.com\/v1\/traces\"><\/script>\n\n    \n<script type=\"text\/javascript\" data-for=\"FA__DOMContentLoadedEventDispatch\" src=\"https:\/\/orlandohealth.tfaforms.net\/js\/FA__DOMContentLoadedEventDispatcher.js\" defer><\/script>\n\n    <style>\n    .captcha {\n        padding-bottom: 1em !important;\n    }\n    .wForm .captcha .oneField {\n        margin: 0;\n        padding: 0;\n    }\n<\/style>\n<script type=\"text\/javascript\">\n    \/\/ initialize our variables\n    var captchaReady = 0;\n    var wFORMSReady = 0;\n    var isConditionalSubmitEnabled = false;\n    \/\/ when wForms is loaded call this\n    var wformsReadyCallback = function () {\n        \/\/ using this var to denote if wForms is loaded\n        wFORMSReady = 1;\n        isConditionalSubmitEnabled = document.getElementById('submit_button').hasAttribute('data-condition');\n        \/\/ call our recaptcha function which is dependent on both\n        \/\/ wForms and an async call to google\n        \/\/ note the meat of this function wont fire until both\n        \/\/ wFORMSReady = 1 and captchaReady = 1\n        onloadCallback();\n    }\n    var gCaptchaReadyCallback = function() {\n        \/\/ using this var to denote if captcha is loaded\n        captchaReady = 1;\n        isConditionalSubmitEnabled = document.getElementById('submit_button').hasAttribute('data-condition');\n        \/\/ call our recaptcha function which is dependent on both\n        \/\/ wForms and an async call to google\n        \/\/ note the meat of this function wont fire until both\n        \/\/ wFORMSReady = 1 and captchaReady = 1\n        onloadCallback();\n    };\n    \/\/ add event listener to fire when wForms is fully loaded\n    document.addEventListener(\"wFORMSLoaded\", wformsReadyCallback);\n    var enableSubmitButton = function() {\n        var submitButton = document.getElementById('submit_button');\n        var explanation = document.getElementById('disabled-explanation');\n        var isConditionalSubmitConditionMet = wFORMS.behaviors.condition.isConditionalSubmitConditionMet;\n        if (\n            submitButton != null &&\n            (isConditionalSubmitEnabled && isConditionalSubmitConditionMet) ||\n            !isConditionalSubmitEnabled\n        )\n        {\n            submitButton.removeAttribute('disabled');\n            if (explanation != null) {\n                explanation.style.display = 'none';\n            }\n        }\n    };\n    var disableSubmitButton = function() {\n        var submitButton = document.getElementById('submit_button');\n        var explanation = document.getElementById('disabled-explanation');\n        if (submitButton != null) {\n            submitButton.disabled = true;\n            if (explanation != null) {\n                explanation.style.display = 'block';\n            }\n        }\n    };\n    \/\/ call this on both captcha async complete and wforms fully\n    \/\/ initialized since we can't be sure which will complete first\n    \/\/ and we need both done for this to function just check that they are\n    \/\/ done to fire the functionality\n    var onloadCallback = function () {\n        \/\/ if our captcha is ready (async call completed)\n        \/\/ and wFORMS is completely loaded then we are ready to add\n        \/\/ the captcha to the page\n        if (captchaReady && wFORMSReady) {\n            grecaptcha.enterprise.render('g-recaptcha-render-div', {\n                'sitekey': '6LfMg_EaAAAAAMhDNLMlgqDChzmtYHlx1yU2y7GI',\n                'theme': 'light',\n                'size': 'normal',\n                'callback': 'enableSubmitButton',\n                'expired-callback': 'disableSubmitButton'\n            })\n            if (!wFORMS.instances['paging']) {\n                document.getElementById(\"g-recaptcha-render-div\").parentNode.parentNode.parentNode.style.display = \"block\";\n            }\n            document.getElementById(\"g-recaptcha-render-div\").getAttributeNode('id').value = 'tfa_captcha_text';\n            var captchaError = '';\n            if (captchaError == '1') {\n                var errMsgText = 'The CAPTCHA was not completed successfully.';\n                var errMsgDiv = document.createElement('div');\n                errMsgDiv.id = \"tfa_captcha_text-E\";\n                errMsgDiv.className = \"err errMsg\";\n                errMsgDiv.innerText = errMsgText;\n                var loc = document.querySelector('.g-captcha-error');\n                loc.insertBefore(errMsgDiv, loc.childNodes[0]);\n                \/* See wFORMS.behaviors.paging.applyTo for origin of this code *\/\n                if (wFORMS.instances['paging']) {\n                    var b = wFORMS.instances['paging'][0];\n                    var pp = base2.DOM.Element.querySelector(document, wFORMS.behaviors.paging.CAPTCHA_ERROR);\n                    if (pp) {\n                        var lastPage = 1;\n                        for (var i = 1; i < 100; i++) {\n                            if (b.behavior.isLastPageIndex(i)) {\n                                lastPage = i;\n                                break;\n                            }\n                        }\n                        b.jumpTo(lastPage);\n                    }\n                }\n            }\n        }\n    }\n<\/script>\n<script src=\"https:\/\/www.google.com\/recaptcha\/enterprise.js?onload=gCaptchaReadyCallback&amp;render=explicit&amp;hl=en_US\" async defer><\/script>\n<script type=\"text\/javascript\">\n    document.addEventListener(\"DOMContentLoaded\", function() {\n        var warning = document.getElementById(\"javascript-warning\");\n        if (warning != null) {\n            warning.parentNode.removeChild(warning);\n        }\n        var explanation = document.getElementById('disabled-explanation');\n        var submitButton = document.getElementById('submit_button');\n        if (submitButton != null) {\n            submitButton.disabled = true;\n            if (explanation != null) {\n                explanation.style.display = 'block';\n            }\n        }\n    });\n<\/script>\n\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<script type=\"text\/javascript\">\n    if(wFORMS.behaviors.prefill) wFORMS.behaviors.prefill.skip = true;\n<\/script>\n\n\n\n    <\/div>\n\n\n    \n\n\n<\/body>";
var resumeUrl = null;
var baseUrl = "https:\/\/orlandohealth.tfaforms.net";

/**
 * Main entry point, called when the DOM is loaded.
 */
function loadFormAssemblyFormHeadAndBodyContents() {
    var targetElement = getTargetElement();
    var formBodyWrapper = createFormBodyWrapper();

    injectHeadContent();
    injectBodyContent(formBodyWrapper, targetElement);
    addResumeLink();

    document.addEventListener('FA__DOMContentLoaded', function () {
        executeBodyScripts(formBodyWrapper);
        
        // Set up FA$ for autosuggest behavior (jQuery in noConflict mode)
        if (typeof $ !== 'undefined' && $.noConflict) {
            window.FA$ = $.noConflict(true);
        }
        
        // Apply prefill behavior to enable URL parameter prefilling
        var forms = document.querySelectorAll('form');
        forms.forEach(function(form) {
            if (wFORMS && wFORMS.behaviors && wFORMS.behaviors.prefill) {
                wFORMS.behaviors.prefill.skip = false;
                wFORMS.behaviors.prefill.applyTo(form);
            }
        });
    });
}
window.addEventListener('DOMContentLoaded', loadFormAssemblyFormHeadAndBodyContents);

/**
 * Finds the target DOM element where the form should be injected.
 * @returns {HTMLElement|null} The target element or null if not found.
 */
function getTargetElement() {
    var quickPublishScript = document.querySelector('script[data-qp-target-id]');
    if (quickPublishScript) {
        var elementID = quickPublishScript.getAttribute('data-qp-target-id');
        return document.getElementById(elementID);
    }
    return null;
}

/**
 * Creates the main wrapper div for the form's body content.
 * @returns {HTMLDivElement}
 */
function createFormBodyWrapper() {
    var bodyWrapperDiv = document.createElement('div');
    bodyWrapperDiv.id = "FA__QP__BODYWRAPPERDIV";
    return bodyWrapperDiv;
}

/**
 * Injects the form's header content (styles, scripts) into the main document.
 */
function injectHeadContent() {
    var head = document.createElement('head');
    head.innerHTML = headContent;

    var headElements = Array.from(head.children);
    var scriptElements = headElements.filter(function(el) { return el.nodeName === 'SCRIPT'; });
    var otherElements = headElements.filter(function(el) { return el.nodeName !== 'SCRIPT'; });

    otherElements.forEach(function(el) { document.head.appendChild(el); });
    loadHeadScriptsSequentially(scriptElements);
}

/**
 * Loads header script tags sequentially to maintain order.
 * @param {HTMLScriptElement[]} scriptElements - An array of script elements to load.
 */
function loadHeadScriptsSequentially(scriptElements) {
    var script = scriptElements.shift();
    if (!script) {
        document.dispatchEvent(new Event('FA__DOMContentLoaded'));
        return;
    }

    var newScript = document.createElement('script');
    Array.from(script.attributes).forEach(function(attr) { newScript.setAttribute(attr.name, attr.value); });
    newScript.innerHTML = script.innerHTML;

    if (script.src) {
        newScript.onload = function() { loadHeadScriptsSequentially(scriptElements); };
        document.head.appendChild(newScript);
    } else {
        document.head.appendChild(newScript);
        loadHeadScriptsSequentially(scriptElements);
    }
}

/**
 * Injects the form's body content into the target element.
 * @param {HTMLDivElement} formBodyWrapper - The div that will contain the form.
 * @param {HTMLElement|null} targetElement - The element to inject the form into.
 */
function injectBodyContent(formBodyWrapper, targetElement) {
    var body = document.createElement('body');
    body.innerHTML = bodyContent;

    Array.from(body.children).forEach(function(el) { formBodyWrapper.appendChild(el); });

    if (targetElement) {
        targetElement.appendChild(formBodyWrapper);
    } else {
        document.body.appendChild(formBodyWrapper);
    }
}

/**
 * If a resume URL is provided, it finds the "Save and Resume" containers
 * and injects the resume link.
 */
function addResumeLink() {
    if (!resumeUrl) return;

    var oneFieldContainers = document.querySelectorAll('.wForm .saveAndResume > .oneField');
    oneFieldContainers.forEach(function (container) {
        var separator = document.createTextNode(' | ');

        var resumeLink = document.createElement('a');
        resumeLink.href = baseUrl + resumeUrl;
        resumeLink.innerHTML = 'Resume a previously saved form';
        
        resumeLink.addEventListener('click', function(event) {
            if (!confirm('Are you sure you want to resume a previous response? Any information you just entered on this page will be discarded.')) {
                event.preventDefault();
            }
        });

        container.appendChild(separator);
        container.appendChild(resumeLink);
    });
}

/**
 * Finds and re-executes script tags from the form's body.
 * @param {HTMLDivElement} formBodyWrapper - The wrapper containing the form.
 */
function executeBodyScripts(formBodyWrapper) {
    var scriptTags = formBodyWrapper.querySelectorAll('script');
    scriptTags.forEach(function (scriptTag) {
        // Skip jQuery, Typeahead, Kalendae, and Calendar scripts that are already loaded in the head
        if (scriptTag.src && (
            scriptTag.src.includes('jquery.js') || 
            scriptTag.src.includes('typeahead.bundle.js') ||
            scriptTag.src.includes('/js/kalendae/') ||
            scriptTag.src.includes('wforms_calendar.js')
        )) {
            return;
        }
        
        // Skip noConflict scripts that are meant for jQuery/Typeahead
        if (scriptTag.innerHTML && scriptTag.innerHTML.includes('noConflict')) {
            return;
        }
        
        var script = document.createElement('script');
        Array.from(scriptTag.attributes).forEach(function(attr) { script.setAttribute(attr.name, attr.value); });
        script.innerHTML = scriptTag.innerHTML;
        scriptTag.parentNode.replaceChild(script, scriptTag);
    });
}
