To refactor the initialisation scripts:

1. Open the webChat.js file in the SDK folder.
2. Copy the setupWebChat function into your copy of webChat.js. If there are functions preceeding it, 
    make sure they include a comma at the end.
3. Remove the jQuery ready function at the bottom of the file.

4. Open the webChatUI.js file. 
5. As in step 2, copy the setup function into your copy of webChatUI.js
6. As in step 3, remove the jQuery ready function.

7. Open the avayaGlobal.js file
8. Remove the jQuery ready function.
9. Change the detectBrowserSupport function to resemble the following (optional):

    detectBrowserSupport : function() {
        'use strict';
        if (!WebSocket || !XMLHttpRequest || !JSON || !window.jQuery) {
            window.alert(this.browserWarning);
        }
    },
    
10. Open your customerJourneyCommon.js file.
11. Add the following line into the setup function:
    avayaGlobal.log = avayaGlobal.makeLogger();
    
12. Open your home.html page
13. Add the following <script> block at the bottom of the <head> tag. Alernatively, replace with a jQuery ready function that calls webChat.setupWebChat();
    <!-- Initialise Web Chat once the page is ready. Using setTimeout with a value of zero effectively requeues this until rendering has finished -->
    <script>
        setTimeout(webChat.setupWebChat,0);
    </script>
    
14. Open your videoconferencing.html page.
15. Convert the <script> tag at the bottom of the page to resemble the following:
    <!-- This loads the customer ID. If it isn't defined already, then ask them to subscribe -->
    <script type="text/javascript">
        jQuery(function(){
            customerJourneyCommon.setup();
            if (customerJourneyCommon.customerId === 'DefaultCustomerId'){
                contextStoreUI.createSubscribeDialog();    
            }
        });
    </script>