var initScript;
        var initVariables = '';
        var autoOpen = -1;
        var badge = '';
        var botui;
        function startChat(id, variables, autoOpenR, badgeR) {
            autoOpen = (autoOpenR != null ? autoOpenR : -1);
            badge = (badgeR != null ? badgeR : '');
            initScript = "script"+id;
            initVariables = variables;
        }
        jQuery(function($){
            botui = new BotUI('my-botui-app');
            $("#chatbox-header-title").html("Anne");
            $("#chatbox-header-subtitle").html("Online recruiter");
            if(badge != '') {
                $(".chat-badge").css('display', 'block');
                $(".chat-badge").html(badge);
            }
            setTimeout(function(){
                current = getChatHistory();
                if(current.length == 0) {
                    startChatNow();
                }
            }, 10*1000);
            var opened = false;
            $(document).on('click', '#closeChat', function(e){
                $(".chatbox-holder").fadeOut(300);
            });
            $(document).on('click', '#openChat', function(e){
                startChatNow();
            });
            function startChatNow() {
                if($(".chatbox-holder").css('display') == 'none'){
                    $(".chatbox-holder").fadeIn(300);
                    if(!opened) {
                        opened = true;
                        current = getChatHistory();
                        current.forEach(function myFunction(value) {
                            botui.message.add({
                                content: value['text'],
                                human: (!value['robot']),
                                type: 'html',
                                cssClass: (value['page'] != null ? 'botui-space' : '')
                            });
                        });
                        if(current.length > 0) {
                            botui.message.add({
                              cssClass: 'botui-space',
                              content: ' '
                            });
                            addChatToHistory({'text': ' ', 'human': false, 'page': true});
                        }
                        if(initVariables != '') {
                            $.each(initVariables, function(key, value){
                                storeVariable(key, value);
                            });
                        }
                        var fn = window[initScript];
                        if (typeof fn === "function") fn();
                    }
                }
            }
        });
        function addChatToHistory(message) {
            current = getChatHistory();
            current.push(message);
            window.sessionStorage.setItem('chat-history', JSON.stringify(current), 1);
        }
        function getChatHistory() {
            current = window.sessionStorage.getItem('chat-history');
            if(current == null) {
                current = [];
            }
            else {
                current = JSON.parse(current);
            }
            return current;
        }
        function storeVariable(variable, value) {
            var variables = getVariables();
            variables[variable] = value;
            window.sessionStorage.setItem('chat-variables', JSON.stringify(variables), 1);
        }
        function getVariable(variable) {
            var variables = getVariables();
            return (variables[variable] == null ? '' : variables[variable]);
        }
        function getVariables() {
            var output = window.sessionStorage.getItem('chat-variables');
            return (output == null ? {} : JSON.parse(output));
        }
        function unwrapVariables(input) {
            var variables = getVariables();
            jQuery.each(variables, function(key, value){
                var re = new RegExp('{'+key+'}',"g");
                input = input.replace(re, value);
            });
            return input;
        }
        function httpGetAsync(theUrl, callback) {
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.onreadystatechange = function() {
                if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
                    callback(xmlHttp.responseText);
            }
            xmlHttp.open("GET", theUrl, true); // true for asynchronous
            xmlHttp.send(null);
        }
        function inputCategory(hr, callback) {
                        botui.action.button({
                delay: 700,
                addMessage: false,
                action: (hr ? [{"text":"Bouw & Techniek","value":6},{"text":"ICT","value":7},{"text":"Financieel","value":8},{"text":"HR","value":9},{"text":"Management","value":10},{"text":"Marketing","value":11}] :  [{"text":"Zwembad & Sport","value":1},{"text":"Horeca & Receptie","value":2},{"text":"Facilitair & Techniek","value":3},{"text":"Management en Ondersteuning","value":4},{"text":"Stage & Bijbaan","value":5}])
            }).then(function (res) {
                storeVariable('category.id', res.value);
                storeVariable('category.name', res.text);
                                    if(res.value == '1') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/zwembad-en-sport');
                    }
                                        if(res.value == '2') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/horeca-en-receptie');
                    }
                                        if(res.value == '3') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/technisch-en-faciliteit');
                    }
                                        if(res.value == '4') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/managementenondersteunend');
                    }
                                        if(res.value == '5') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/stage-en-bijbaan');
                    }
                                        if(res.value == '6') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/bouw-en-techniek');
                    }
                                        if(res.value == '7') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/ict');
                    }
                                        if(res.value == '8') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/financieel');
                    }
                                        if(res.value == '9') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/hr');
                    }
                                        if(res.value == '10') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/management');
                    }
                                        if(res.value == '11') {
                        storeVariable('category.url', 'https://werkenbijsportfondsen.nl/rubriek/marketing');
                    }
                    
                var message = "Ik heb interesse in "+res.text;
                addChatToHistory({"text": message, "robot": false});
                botui.message.add({
                    content: message,
                    human: true
                }).then(function(){
                    callback();
                });
            });
        }
        function inputCity(callback) {
            botui.action.text({
                addMessage: false,
                delay: 700,
                action: {
                    placeholder: 'Voor jouw postcode in'
                }
            }).then(function (res) {
                var message = "Mijn postcode is "+res.value;
                addChatToHistory({"text": message, "robot": false});
                botui.message.add({
                    content: unwrapVariables(message),
                    human: true
                }).then(function(){
                    httpGetAsync("https://maps.googleapis.com/maps/api/geocode/json?components=country:NL|postal_code:"+encodeURIComponent(res.value)+"&key=AIzaSyCo75_sJYAIzn_cWGQB0EiXle7UVcEHHsU", function(response){
                        response = JSON.parse(response);
                        if(response['status'] == 'ZERO_RESULTS') {
                            var message = 'Ik kan die postcode helaas niet vinden. Zou je jouw postcode nogmaals kunnen opgeven?';
                            addChatToHistory({"text": message, "robot": true});
                            botui.message.add({
                                delay: 700,
                                loading: true,
                                content: message
                            }).then(function() {
                                inputCity(callback);
                            });
                        }
                        else {
                            storeVariable('location.postalcode', res.value);
                            storeVariable('location.lat', response['results'][0]['geometry']['location']['lat']);
                            storeVariable('location.lng', response['results'][0]['geometry']['location']['lng']);
                            callback();
                        }
                    });
                });
            });
        }
        function inputRange(callback) {
            botui.action.button({
                addMessage: false,
                delay: 700,
                action: [{"text":"1 - 10 km", "value": "10"}, {"text": "10 - 25 km", "value": "25"}, {"text": "25 - 50 km", "value": "50"}, {"text": "50-100 km", "value": "100"}, {"text": "100-250 km", "value": "250"}]
            }).then(function (res) {
                storeVariable('location.range', res.value);
                var message = "Ik ben bereid "+res.text+" te reizen";
                addChatToHistory({"text": message, "robot": false});
                botui.message.add({
                    content: message,
                    human: true
                }).then(function(){
                    callback();
                });
            });
        }
        function inputName(callback) {
            botui.action.text({
                addMessage: false,
                delay: 700,
                action: {
                    placeholder: 'Vul jouw naam in'
                }
            }).then(function (res) {
                storeVariable('name', res.value);
                var message = "Mijn naam is "+res.value;
                addChatToHistory({"text": message, "robot": false});
                botui.message.add({
                    content: message,
                    human: true
                }).then(function(){
                    callback();
                });
            });
        }
        function inputEmail(callback) {
            botui.action.text({
                delay: 700,
                action: {
                    placeholder: 'Vul jouw e-mailadres in'
                }
            }).then(function (res) {
                addChatToHistory({"text": res.value, "robot": false});
                var re = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
                if(!re.test(res.value.toLowerCase())){
                    var message = 'Het e-mailadres wat je hebt opgegeven bestaat niet. Kan je jouw e-mailadres nogmaals opgeven?';
                    addChatToHistory({"text": message, "robot": true});
                    botui.message.add({
                        delay: 700,
                        loading: true,
                        content: message
                    }).then(function() {
                        inputEmail(callback);
                    });
                    return;
                }
                storeVariable('email', res.value);
                callback();
            });
        }
        function inputMotivation(callback) {
            botui.action.text({
                delay: 700,
                action: {
                    placeholder: 'Begin met typen...'
                }
            }).then(function (res) {
                addChatToHistory({"text": res.value, "robot": false});
                storeVariable('motivation', res.value);
                callback();
            });
        }
        function inputLinkedIn(callback) {
            botui.action.text({
                delay: 700,
                action: {
                    placeholder: 'Plak hier jouw LinkedIn url'
                }
            }).then(function (res) {
                addChatToHistory({"text": res.value, "robot": false});
                storeVariable('linkedin', res.value);
                callback();
            });
        }
        function inputCV(callback) {
            botui.action.text({
                delay: 700,
                action: {
                    sub_type: 'file'
                }
            }).then(function (res) {
                addChatToHistory({"text": res.value, "robot": false});
                storeVariable('linkedin', res.value);
                callback();
            });
        }
        function inputPhone(callback) {
            botui.action.text({
                delay: 700,
                action: {
                    placeholder: 'Vul jouw Telefoonnummer in'
                }
            }).then(function (res) {
                addChatToHistory({"text": res.value, "robot": false});
                storeVariable('phone', res.value);
                callback();
            });
        }
        
            function script53ZB8lt(callback = function() {}) {
                                addChatToHistory({"text": unwrapVariables('Ok! Leuk dat je zo enthousiast bent!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ok! Leuk dat je zo enthousiast bent!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Ik heb wat gegevens van je nodig om te weten of er in de toekomst mogelijkheden zijn.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik heb wat gegevens van je nodig om te weten of er in de toekomst mogelijkheden zijn.')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Wat is je voornaam?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Wat is je voornaam?')
                })                    .then(function () {                         inputName(function(){                 addChatToHistory({"text": unwrapVariables('Oké {name}, Wat is je e-mail adres? Dan houden we je via mail op de hoogte!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Oké {name}, Wat is je e-mail adres? Dan houden we je via mail op de hoogte!')
                })                    .then(function () {                         inputEmail(function(){                         httpGetAsync('https://beheer.werkenbijsportfondsen.nl/src/Vacancy/Controller/Guest?type=apply&vacancy='+getVariable('vacancy.id')+'&postalcode='+getVariable('location.postalcode')+'&name='+getVariable('name')+'&email='+getVariable('email')+'&phone='+getVariable('phone')+'&motivation='+getVariable('motivation')+'&linkedin='+getVariable('linkedin'), function(response) {
                                            addChatToHistory({"text": unwrapVariables('Dank je wel! We houden je per mail op de hoogte van de mogelijkheden bij Sportfondsen!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Dank je wel! We houden je per mail op de hoogte van de mogelijkheden bij Sportfondsen!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Fijne ochtend verder!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Fijne ochtend verder!')
                }); });
                                            });
                         });
                         });
                     });
                         });
                     });
                     });
                                }
            
            function scriptf9Uc6WX(callback = function() {}) {
                                        httpGetAsync('https://beheer.werkenbijsportfondsen.nl/src/Vacancy/Controller/Guest?type=hasVacancies&category='+getVariable('category.id')+'&lat='+getVariable('location.lat')+'&lng='+getVariable('location.lng')+'&range='+getVariable('location.range'), function(response) {
                            storeVariable('has.vacancies', response);
                                            var value = getVariable('has.vacancies');
                                    if(value == 'true') {
                                        addChatToHistory({"text": unwrapVariables('Oké, ik heb een match gevonden. Past de vacature bij je? Roep me dan opnieuw, dan help ik je met solliciteren.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Oké, ik heb een match gevonden. Past de vacature bij je? Roep me dan opnieuw, dan help ik je met solliciteren.')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Ps, ik stuur je over enkele ogenblikken automatisch door naar de resultaten.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ps, ik stuur je over enkele ogenblikken automatisch door naar de resultaten.')
                })                    .then(function () {                 setTimeout( function() {
                    document.location.href = unwrapVariables('{category.url}?fwp_location={location.lat}%2C{location.lng}%2C{location.range}%2C{location.postalcode}');
                }, 3000);
                 });
                     });
                                        }
                                        if(value == 'false') {
                                        addChatToHistory({"text": unwrapVariables('Ik heb het voor je uitgezocht, maar helaas zijn er op dit moment geen vacatures in de richting van {category.name}.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik heb het voor je uitgezocht, maar helaas zijn er op dit moment geen vacatures in de richting van {category.name}.')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Ik kan wel je gegevens noteren zodat je een melding krijgt als er een vacature beschikbaar komt. Wil je dat?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik kan wel je gegevens noteren zodat je een melding krijgt als er een vacature beschikbaar komt. Wil je dat?')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Ja graag!","value":0}, {"text":"Nee bedankt","value":1}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Ja graag!";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 script53ZB8lt(function(response) {
                                    });
                 });
                        }
                                                if(res.value == 1) {
                            var message = "Nee bedankt";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Ok, dan laten we het hier even bij. Leuk om contact te houden, wie weet is er een klik in de toekomst. Tip; volg ons via LinkedIn. Dan blijf je op de hoogte van carrièrekansen.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ok, dan laten we het hier even bij. Leuk om contact te houden, wie weet is er een klik in de toekomst. Tip; volg ons via LinkedIn. Dan blijf je op de hoogte van carrièrekansen.')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Fijne ochtend verder!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Fijne ochtend verder!')
                }); });
                     });
                        }
                                        });
                 });
                     });
                                        }
                                            });
                                    }
            
            function scriptwCBoi0o(callback = function() {}) {
                                addChatToHistory({"text": unwrapVariables('Zit er wat leuks tussen de vacatures?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Zit er wat leuks tussen de vacatures?')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Ja!","value":0}, {"text":"Nee, niet echt","value":1}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Ja!";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Mooi, zodra je een vacature selecteert kan ik je helpen met solliciteren!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Mooi, zodra je een vacature selecteert kan ik je helpen met solliciteren!')
                }); });
                        }
                                                if(res.value == 1) {
                            var message = "Nee, niet echt";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Jammer, als je wilt kan ik een job alert voor je aanmaken? Dan ontvang je namelijk wekelijks een overzicht van de vacatures die geplaatst zijn in {category.name}.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Jammer, als je wilt kan ik een job alert voor je aanmaken? Dan ontvang je namelijk wekelijks een overzicht van de vacatures die geplaatst zijn in {category.name}.')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Ja graag!","value":0}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Ja graag!";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 script53ZB8lt(function(response) {
                                    });
                 });
                        }
                                        });
                 });
                     });
                        }
                                        });
                 });
                                }
            
            function scriptcpbCCUV(callback = function() {}) {
                                addChatToHistory({"text": unwrapVariables('Ja, is het zover? Wil je reageren op de vacature {vacancy.name} bij {location.name}? '), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ja, is het zover? Wil je reageren op de vacature {vacancy.name} bij {location.name}? ')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Ja, let`s do it!","value":0}, {"text":"Nee, dank je!","value":1}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Ja, let`s do it!";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Leuk!  Wat is je voornaam?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Leuk!  Wat is je voornaam?')
                })                    .then(function () {                         inputName(function(){                 addChatToHistory({"text": unwrapVariables('Oké {name}, wie weet worden we collega's!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Oké {name}, wie weet worden we collega's!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Ik heb voor de sollicitatie een paar gegevens van je nodig. Het zijn slechts 5 vragen.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik heb voor de sollicitatie een paar gegevens van je nodig. Het zijn slechts 5 vragen.')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Wat is jouw e-mailadres {name}?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Wat is jouw e-mailadres {name}?')
                })                    .then(function () {                         inputEmail(function(){                 addChatToHistory({"text": unwrapVariables('Bedankt. Om je nog beter te kunnen bereiken heb ik ook je telefoonnummer nodig.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Bedankt. Om je nog beter te kunnen bereiken heb ik ook je telefoonnummer nodig.')
                })                    .then(function () {                         inputPhone(function(){                 addChatToHistory({"text": unwrapVariables('Wat is je postcode?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Wat is je postcode?')
                })                    .then(function () {                         inputCity(function(){                 addChatToHistory({"text": unwrapVariables('Waarom wil je zo graag aan de slag als {vacancy.name} bij {location.name}?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Waarom wil je zo graag aan de slag als {vacancy.name} bij {location.name}?')
                })                    .then(function () {                         inputMotivation(function(){                 addChatToHistory({"text": unwrapVariables('Ik vind het interessant wat je achtergrond is qua opleiding en werk. heb je een LinkedIn url voor mij?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik vind het interessant wat je achtergrond is qua opleiding en werk. heb je een LinkedIn url voor mij?')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Ja","value":0}, {"text":"Nee","value":1}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Ja";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Prima, hieronder kun je jouw LinkedIn url pakken. Ik ben benieuwd!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Prima, hieronder kun je jouw LinkedIn url pakken. Ik ben benieuwd!')
                })                    .then(function () {                         inputLinkedIn(function(){                 addChatToHistory({"text": unwrapVariables('Dat ziet er veelbelovend uit!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Dat ziet er veelbelovend uit!')
                })                    .then(function () {                         httpGetAsync('https://beheer.werkenbijsportfondsen.nl/src/Vacancy/Controller/Guest?type=apply&vacancy='+getVariable('vacancy.id')+'&postalcode='+getVariable('location.postalcode')+'&name='+getVariable('name')+'&email='+getVariable('email')+'&phone='+getVariable('phone')+'&motivation='+getVariable('motivation')+'&linkedin='+getVariable('linkedin'), function(response) {
                                            addChatToHistory({"text": unwrapVariables('Dank je wel voor alle informatie! Ik zorg dat je sollicitatie bij {location.name} terechtkomt. Je krijgt binnen 14 dagen reactie van ons over een mogelijk vervolg!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Dank je wel voor alle informatie! Ik zorg dat je sollicitatie bij {location.name} terechtkomt. Je krijgt binnen 14 dagen reactie van ons over een mogelijk vervolg!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Fijne ochtend verder'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Fijne ochtend verder')
                }); });
                                            });
                         });
                     });
                         });
                     });
                        }
                                                if(res.value == 1) {
                            var message = "Nee";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                         httpGetAsync('https://beheer.werkenbijsportfondsen.nl/src/Vacancy/Controller/Guest?type=apply&vacancy='+getVariable('vacancy.id')+'&postalcode='+getVariable('location.postalcode')+'&name='+getVariable('name')+'&email='+getVariable('email')+'&phone='+getVariable('phone')+'&motivation='+getVariable('motivation')+'&linkedin='+getVariable('linkedin'), function(response) {
                                            addChatToHistory({"text": unwrapVariables('Dank je wel voor alle informatie! Ik zorg dat je sollicitatie bij {location.name} terechtkomt. Je krijgt binnen 14 dagen reactie van ons over een mogelijk vervolg!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Dank je wel voor alle informatie! Ik zorg dat je sollicitatie bij {location.name} terechtkomt. Je krijgt binnen 14 dagen reactie van ons over een mogelijk vervolg!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Fijne ochtend verder'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Fijne ochtend verder')
                }); });
                                            });
                         });
                        }
                                        });
                 });
                     });
                         });
                     });
                         });
                     });
                         });
                     });
                         });
                     });
                     });
                     });
                         });
                     });
                        }
                                                if(res.value == 1) {
                            var message = "Nee, dank je!";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Ok, kijk gerust verder naar de andere mogelijkheden. '), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ok, kijk gerust verder naar de andere mogelijkheden. ')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Ik kan je helpen met het zoeken van een geschikte vacature, heb je hier interesse in?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik kan je helpen met het zoeken van een geschikte vacature, heb je hier interesse in?')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Ja graag!","value":0}, {"text":"Nee bedankt","value":1}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Ja graag!";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Leuk!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Leuk!')
                })                    .then(function () {                 scriptNXex3h9(function(response) {
                                    });
                 });
                     });
                        }
                                                if(res.value == 1) {
                            var message = "Nee bedankt";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Oké, succes! Mocht je mij toch nog nodig hebben kun je mij altijd oproepen.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Oké, succes! Mocht je mij toch nog nodig hebben kun je mij altijd oproepen.')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Fijne ochtend verder!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Fijne ochtend verder!')
                }); });
                     });
                        }
                                        });
                 });
                     });
                     });
                        }
                                        });
                 });
                                }
            
            function scriptXzT2dtJ(callback = function() {}) {
                                var value = getVariable('greeting');
                                    if(value == 'true') {
                                        var value = getVariable('action');
                                    if(value == 'apply') {
                                        scriptcpbCCUV(function(response) {
                                    });
                                    }
                                        if(value == 'discover.hr') {
                                        addChatToHistory({"text": unwrapVariables('Ik ga je helpen met het vinden van carrieremogelijkheden bij ons Shared Service Centrum in Amsterdam.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik ga je helpen met het vinden van carrieremogelijkheden bij ons Shared Service Centrum in Amsterdam.')
                })                    .then(function () {                 scriptE412MSm(function(response) {
                                    });
                 });
                                        }
                                        if(value == 'discover.location') {
                                        addChatToHistory({"text": unwrapVariables('Ik ga je helpen met het vinden van een baan met plezier bij één van de Sportfondsen accommodaties!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik ga je helpen met het vinden van een baan met plezier bij één van de Sportfondsen accommodaties!')
                })                    .then(function () {                 scriptzOAlBuN(function(response) {
                                    });
                 });
                                        }
                                        if(value == 'discover.general') {
                                        scriptNXex3h9(function(response) {
                                    });
                                    }
                                        if(value == 'discover.category') {
                                        scriptwCBoi0o(function(response) {
                                    });
                                    }
                                        }
                                        if(value == '') {
                                        storeVariable('greeting', 'true');
                                addChatToHistory({"text": unwrapVariables('Goedemorgen!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Goedemorgen!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Ik ben Anne. De online recruiter van Sportfondsen.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik ben Anne. De online recruiter van Sportfondsen.')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Wil je mogelijkheden verkennen om te werken bij Sportfondsen of heb je een ander soort vraag?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Wil je mogelijkheden verkennen om te werken bij Sportfondsen of heb je een ander soort vraag?')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Mogelijkheden verkennen","value":0}, {"text":"Ander soort vraag","value":1}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Ik wil graag de mogelijkheden verkennen";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 var value = getVariable('action');
                                    if(value == 'apply') {
                                        scriptcpbCCUV(function(response) {
                                    });
                                    }
                                        if(value == 'discover.hr') {
                                        addChatToHistory({"text": unwrapVariables('Ik ga je helpen met het vinden van carrieremogelijkheden bij ons Shared Service Centrum in Amsterdam.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik ga je helpen met het vinden van carrieremogelijkheden bij ons Shared Service Centrum in Amsterdam.')
                })                    .then(function () {                 scriptE412MSm(function(response) {
                                    });
                 });
                                        }
                                        if(value == 'discover.location') {
                                        addChatToHistory({"text": unwrapVariables('Ik ga je helpen met het vinden van een baan met plezier bij één van de Sportfondsen accommodaties!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik ga je helpen met het vinden van een baan met plezier bij één van de Sportfondsen accommodaties!')
                })                    .then(function () {                 scriptzOAlBuN(function(response) {
                                    });
                 });
                                        }
                                        if(value == 'discover.general') {
                                        scriptNXex3h9(function(response) {
                                    });
                                    }
                                        if(value == 'discover.category') {
                                        scriptwCBoi0o(function(response) {
                                    });
                                    }
                     });
                        }
                                                if(res.value == 1) {
                            var message = "Ik heb een ander soort vraag";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 addChatToHistory({"text": unwrapVariables('Ik kan je als recruiter minder goed helpen met andere vragen. Mijn collega's zijn daar veel beter in. Vul het contactformulier in, en zij nemen contact met je op!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik kan je als recruiter minder goed helpen met andere vragen. Mijn collega's zijn daar veel beter in. Vul het contactformulier in, en zij nemen contact met je op!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Fijne ochtend verder!
En als je toch nog iets wil weten over Werken bij Sportfondsen; laat het me weten.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Fijne ochtend verder!
En als je toch nog iets wil weten over Werken bij Sportfondsen; laat het me weten.')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Toch de mogelijkheden verkennen","value":0}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Bij nader inzien wil ik toch de mogelijkheden verkennen";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 var value = getVariable('action');
                                    if(value == 'apply') {
                                        scriptcpbCCUV(function(response) {
                                    });
                                    }
                                        if(value == 'discover.hr') {
                                        addChatToHistory({"text": unwrapVariables('Ik ga je helpen met het vinden van carrieremogelijkheden bij ons Shared Service Centrum in Amsterdam.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik ga je helpen met het vinden van carrieremogelijkheden bij ons Shared Service Centrum in Amsterdam.')
                })                    .then(function () {                 scriptE412MSm(function(response) {
                                    });
                 });
                                        }
                                        if(value == 'discover.location') {
                                        addChatToHistory({"text": unwrapVariables('Ik ga je helpen met het vinden van een baan met plezier bij één van de Sportfondsen accommodaties!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik ga je helpen met het vinden van een baan met plezier bij één van de Sportfondsen accommodaties!')
                })                    .then(function () {                 scriptzOAlBuN(function(response) {
                                    });
                 });
                                        }
                                        if(value == 'discover.general') {
                                        scriptNXex3h9(function(response) {
                                    });
                                    }
                                        if(value == 'discover.category') {
                                        scriptwCBoi0o(function(response) {
                                    });
                                    }
                     });
                        }
                                        });
                 });
                     });
                     });
                        }
                                        });
                 });
                     });
                     });
                                        }
                                }
            
            function scriptzOAlBuN(callback = function() {}) {
                                addChatToHistory({"text": unwrapVariables('We hebben ruim 75 accommodaties. Dus laten we eens kijken of er een mooie uitdaging voor jou bij zit!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('We hebben ruim 75 accommodaties. Dus laten we eens kijken of er een mooie uitdaging voor jou bij zit!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Er zijn verschillende aandachtsgebieden bij de accommodaties. Welke heeft jouw interesse?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Er zijn verschillende aandachtsgebieden bij de accommodaties. Welke heeft jouw interesse?')
                })                    .then(function () {                         inputCategory(false, function(){                 addChatToHistory({"text": unwrapVariables('Leuk! Om gerichter te zoeken heb ik jouw postcode nodig.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Leuk! Om gerichter te zoeken heb ik jouw postcode nodig.')
                })                    .then(function () {                         inputCity(function(){                 addChatToHistory({"text": unwrapVariables('Hoever ben je bereid te reizen voor jouw baan?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Hoever ben je bereid te reizen voor jouw baan?')
                })                    .then(function () {                         inputRange(function(){                 scriptf9Uc6WX(function(response) {
                                    });
                 });
                         });
                     });
                         });
                     });
                         });
                     });
                                }
            
            function scriptNXex3h9(callback = function() {}) {
                                addChatToHistory({"text": unwrapVariables('Ik ga je helpen met het vinden van een baan met plezier bij Sportfondsen!'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Ik ga je helpen met het vinden van een baan met plezier bij Sportfondsen!')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Zoek je een baan bij één van onze sport accommodaties of bij ons shared service centrum in Amsterdam?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Zoek je een baan bij één van onze sport accommodaties of bij ons shared service centrum in Amsterdam?')
                })                    .then(function () {                 botui.action.button({
                    delay: 700,
                    addMessage: false,
                  action: [{"text":"Shared service Amsterdam","value":0}, {"text":"Een accommodatie","value":1}, ]
                }).then(function (res) {
                                            if(res.value == 0) {
                            var message = "Ik zoek een baan bij Shared Service in Amsterdam";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 scriptE412MSm(function(response) {
                                    });
                 });
                        }
                                                if(res.value == 1) {
                            var message = "Ik zoek een baan bij een accommodatie";
                            addChatToHistory({"text": message, "robot": false});
                            botui.message.add({
                                content: unwrapVariables(message),
                                human: true
                            }).then(function(){                 scriptzOAlBuN(function(response) {
                                    });
                 });
                        }
                                        });
                 });
                     });
                                }
            
            function scriptE412MSm(callback = function() {}) {
                                addChatToHistory({"text": unwrapVariables('Hier staan we opgesteld voor ondersteuning van alle accommodaties. We hebben verschillende disciplines. Waarin je vanuit jouw expertise van betekenis bent voor beweging.'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Hier staan we opgesteld voor ondersteuning van alle accommodaties. We hebben verschillende disciplines. Waarin je vanuit jouw expertise van betekenis bent voor beweging.')
                })                    .then(function () {                 addChatToHistory({"text": unwrapVariables('Met welke richting heb jij het meest?'), "robot": true});
                botui.message.add({
                    delay: 900,
                    loading: true,
                    type: 'html',
                    content: unwrapVariables('Met welke richting heb jij het meest?')
                })                    .then(function () {                         inputCategory(true, function(){                 scriptf9Uc6WX(function(response) {
                                    });
                 });
                         });
                     });
                                }