(function() {


    var _parseRolesResponse = function(response) {
        var answer = response.responseXML.documentElement.getAttribute("answer");
        var res = JSON.parse(answer);
        try {

            var top1 = document.querySelector('head'); // reach out to the parent window and get the head element
            var meta1 = document.createElement('meta'); //create a new script element
            meta1.setAttribute('name', "program");
            meta1.setAttribute('content', res.prog.join(",")); //sets the src attribute

            var meta2 = document.createElement("meta");
            meta2.setAttribute('name', "role");
            meta2.setAttribute('content', res.codes.join(","));
            top1.appendChild(meta2);
            top1.appendChild(meta1); // appends the newly created div element at the end of the top window head element


        } catch (error) {

        }
    };



    var gAjax = new GlideAjax("global.WalkmeCode");
    gAjax.addParam("sysparm_name", 'getRoleCode');
    gAjax.getXML(_parseRolesResponse);


})();