var chatBotDiv = document.createElement('div');
chatBotDiv.id = 'filament-ai-chat-widget';

var botProperties = [["widget-template","ebm"],["bot-bot-id","1"],["bot-provider-id","6"],["bot-name","Bridget the Chatbot"],["bot-api-url","https://nlchi.ebm.ai/api"],["widget-header-name","Bridget Virtual Assistant"],["bot-start-intent","Hello"],["alert-text","Hello! I'm Bridget Your Virtual Assistant"],["theme-header-color","#007af0"],["modal-confirm-button-color","#007af0"],["intro-header-logo","https://nlchi.ebm.ai/widget/1/deployment/images/intro-header-logo/intro-header-logo-1.png"],["theme-header-text-size","medium"],["modal-confirm-button-border-color","#007af0"],["modal-cancel-button-text-color","#007af0"],["modal-cancel-button-border-color","#007af0"],["modal-text-color","#000000"],["theme-header-text-color","#ffffff"],["theme-scroll-bar-track-color","#ffffff"],["theme-scroll-bar-thumb-hover-color","#696969"],["theme-scroll-bar-thumb-color","#007af0"],["theme-user-message-color","#007af0"],["modal-background-color","#ffffff"],["theme-typing-dots-color","#007af0"],["theme-response-buttons-hover-background-color","#027ef7"],["theme-quick-reply-hover-background-color","#007af0"],["theme-quick-reply-text-color","#007af0"],["theme-response-buttons-text-color","#2a2a2a"],["theme-bot-text-color","#2a2a2a"],["theme-response-image-caption-background-color","#f1f1f1"],["theme-bot-message-color","#f1f1f1"],["theme-response-buttons-color","#f1f1f1"],["theme-quick-reply-background-color","#ffffff"],["theme-response-image-text-color","#2a2a2a"],["theme-response-card-caption-background-color","#f1f1f1"],["theme-response-card-title-color","#2a2a2a"],["theme-response-card-text-color","#2a2a2a"],["theme-response-card-button-hover-background-color","#007af0"],["theme-response-card-button-text-color","#215dab"],["theme-message-toolbar-border-color","#007af0"],["theme-input-text-color","#007af0"],["theme-input-placeholder-color","#007af0"],["theme-send-message-icon-active-color","#007af0"],["icon-background-color","#ffffff"],["alert-text-color","#007af0"],["alert-close-icon-color","#007af0"],["theme-message-toolbar-background-color","#ffffff"],["theme-send-message-icon-color","#007af0"],["intro-header-title","Bridget Virtual Assistant"],["intro-button-text"," Chat with Bridget"],["bot-response-delay","3"],["intro-show-for-new-conversations","true"],["widget-position","bottom right"],["icon-position","bottom right"],["alert-offset-right","20px"],["widget-offset-right","20px"],["icon-offset-right","20px"],["alert-offset-left","0"],["widget-offset-left","0"],["icon-offset-left","0"],["banner-text","<div id= 'banner-div'><span><a id='talkToSomeone' href=\"https://nl.bridgethegapp.ca/adult/service-directory/doorways-walk-in-clinic-counselling/\">Talk to someone</a><a id=urgentHelp href=\"https://nl.bridgethegapp.ca/adult/service-directory/service_directory_category/emergency/\">Urgent Help</a></span><span id = 'haveYourSay'><a href = 'https://nl.bridgethegapp.ca/adult/toolbox/have-your-say/' target='_blank'>Have your say - Bridge the Gapp Survey</a></span></div>"],["intro-text","I am here to assist you navigate the Bridge the Gapp website! "],["banner-background-color","#F4F3F4"],["theme-header-title-position","left"],["theme-font","Gotham,sans-serif"],["icon-offset-bottom","20px"],["widget-offset-bottom","20px"],["icon-height","100px"],["widget-bot-profile-width","40px"],["widget-bot-profile-height","40px"],["icon-width","100px"],["icon-border-radius","100px"],["intro-header-logo-height","100px"],["intro-header-logo-width","100px"],["banner-text-size","15px"],["banner-text-padding-top","13px"],["banner-text-padding-bottom","12px"],["banner-text-padding-left","10px"],["banner-text-padding-right","10px"],["banner-border-thickness","1px"],["banner-border-color","#C8C8C8"],["banner-border-location","bottom"],["intro-button-color","#8a489c"],["icon-image","https://nlchi.ebm.ai/widget/1/deployment/images/icon-image/icon-image-1.png"],["intro-text-color","#007af0"],["widget-bot-profile-image","https://nlchi.ebm.ai/widget/1/deployment/images/widget-bot-profile-image/widget-bot-profile-image-1.png"]];

for(var i = 0; i < botProperties.length; i++ ){
    var property = botProperties[i];
    chatBotDiv.setAttribute(property[0], property[1]);
}

document.getElementsByTagName('body')[0].append(chatBotDiv);

function loadScript(url, callback) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.async = true;
    if (typeof callback === "function") {
        if (script.readyState) {  // only required for IE <9
            script.onreadystatechange = function () {
                if (script.readyState === "loaded" || script.readyState === "complete") {
                    script.onreadystatechange = null;
                    callback();
                }
            };
        } else {  //Others
            script.onload = function () {
                callback();
            };
        }
    }
    script.src = url;
    document.getElementsByTagName("head")[0].appendChild(script);
};

var stylesheet = document.createElement('link');
        stylesheet.href = 'https://nlchi.ebm.ai/widget/1/deployment/css';
        stylesheet.rel = 'stylesheet';
        document.head.appendChild(stylesheet);

loadScript('https://nlchi.ebm.ai/widget/v1.17.0/index.js', loadCustomScript);
        function loadCustomScript() {
          loadScript('https://nlchi.ebm.ai/widget/1/deployment/javascript');
        }
    