/*
CustomJS LIVE, 10, Transurban
July 24 2020 3pm TP
*/
if(!(IMI.CustomJS && IMI.CustomJS.customJSisLoaded)){

    (function(){
         IMI.CustomJS = {
            customJSisLoaded:true,
            afterInterceptsLoadedCalled:false,
            data:{},
            sessionData:{},
            manualIntercepts:[],
            activeIntercepts:{},
            viewCount:0,
            customEventName:'IMI_Events',
            afterInterceptsLoaded : function(){
                if(IMI.CustomJS.afterInterceptsLoadedCalled){
                    return;    
                }
                IMI.CustomJS.afterInterceptsLoadedCalled=true;

                var imm = IMI.CustomJS.mods;
                imm.interceptLocalStorage.checkAvailability();
                IMI.CustomJS.debug = IMI.CustomJS.mods.interceptLocalStorage.get('IMI_debug') ? true : false;
                imm.dataStore.load();
                imm.dataStore.load('sessionStorage');
                imm.getCustomInterceptSettings();

                if(imm.addInterceptIdToVisual){
                    imm.addInterceptIdToVisual();
                }

                if(imm.addInviteIntercept){
                    imm.addInviteIntercept();
                }
                
            },
            'mods':{
                addInviteIntercept:function(){

                    var imm = IMI.CustomJS.mods;
                    var modifiedIntercepts = [];
                    imm.iterate('array', IMI.CustomJS.manualIntercepts, function(intercept){
                        if(intercept.visual && intercept.visual.localizedText && intercept.visual.localizedText.indexOf("__invite__") > -1){
                            modifiedIntercepts.push(intercept);
                        }
                    });


                    
                    imm.iterate('array', modifiedIntercepts, function(modIntercept){

                        if(modIntercept && typeof(IM_InviteVisual) == 'function'){
                            var customId = modIntercept.id + "_" + modIntercept.visual.id;
                            
                            var template={
                                variables:{
                                    '__NAME__':'Linkt',
                                    '__LOGO__':'https://www.linkt.com.au/content/dam/linkt/common/logo/linkt_logo_129x50.svg'
                                },
                                html_im_footer:'<div id="_im_footer" role="contentinfo"><div id="_im_footer_links" role="region"><div class="_im_footer_leftLinks"> <span id="_im_footer_privacyPolicy"><a target="_blank" href="http://www.inmoment.com/privacy-policy/"><span>Privacy Policy</span></a></span><span class="linkSeparator">&nbsp;|</span> <div id="_im_footer_copyright"><a target="_blank" href="https://www.inmoment.com/websurvey/2/info">&copy; 2020 InMoment Inc.</div></div><div class="_im_footer_rightLinks"></div></div></div>',
                                css_invite:'._im_bannerOverlay_invite {justify-content: center;}#_im_invite_container {display: flex;justify-content: center;width: 100%;}#_im_invite {z-index: 1000;width: 700px;bottom: 0px;visibility: visible;}._im_invite,._im_invite *,._im_invite *::before,._im_invite *::after,._im_invite a:hover,._im_invite a:active {border: 0;margin: 0;padding: 0;border-radius: 0;box-sizing: border-box;float: none;line-height: 1.3;font-family: arial, sans-serif;font-size: 17px;font-weight: normal;font-style: normal;font-variant: normal;text-decoration: none;text-align: center;text-indent: none;text-justify: auto;text-transform: none;letter-spacing: normal;color: inherit;background-image: none;background-color: transparent;display: block;}._im_invite {position: fixed;visibility: hidden;text-align: center;border: solid 1px #444648;color: #444648;background-color: white;}._im_invite h1 {font-size: 26px;font-weight: bold;color: #14A248;}._im_invite_header {padding: 40px;background-color: inherit;}._im_invite_header-logo {background-image: url(__LOGO__);background-position: 50% 50%;background-repeat: no-repeat;background-size: contain;height: 70px;width: 75%;margin: 0 auto;}#_im_invite_close:active,#_im_invite_close:hover,#_im_invite_close {display: block;position: absolute;top: 10px;right: 10px;height: 24px;width: 24px;}#_im_invite_close svg {fill: #444648;}._im_invite_content {padding: 10px 40px 20px 40px;background-color: inherit;color: inherit;}._im_invite_content-text {padding: 15px 70px 25px 70px;}#_im_invite_no:hover,#_im_invite_yes:hover,#_im_invite_no,#_im_invite_yes {height: 48px;width: 160px;display: inline-block;line-height: 48px;}#_im_invite_no:hover,#_im_invite_no {border: solid 1px #56585a;color: inherit;background-color: inherit;}#_im_invite_yes:hover,#_im_invite_yes {border: solid 1px #14A248;color: white;background-color: #14A248;margin-left: 15px;}@keyframes etrack-bounceInUp {from, 60%, 75%, 90%, to {animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);}from {opacity: 0;transform: translate3d(0, 2000px, 0);}60% {opacity: 1;transform: translate3d(0, -20px, 0);}75% {transform: translate3d(0, 10px, 0);}90% {transform: translate3d(0, -5px, 0);}to {transform: translate3d(0, 0, 0);}}.etrack-invite-in {animation-duration: 1s;animation-fill-mode: both;animation-name: etrack-bounceInUp;}@keyframes etrack-bounceOutDown {20% {transform: translate3d(0, 10px, 0);}40%,45% {opacity: 1;transform: translate3d(0, -20px, 0);}to {opacity: 0;transform: translate3d(0, 2000px, 0);}}.etrack-invite-out {animation-duration: 1s;animation-fill-mode: both;animation-name: etrack-bounceOutDown;}@media all and (max-width: 600px) {#_im_invite {width: 96%;}._im_invite_content-text {padding-left: 0px;padding-right: 0px;}}@media all and (max-width: 440px) {#_im_invite_no,#_im_invite_yes,#_im_invite_no:hover,#_im_invite_yes:hover {width: 130px !important;}}@media all and (max-width: 320px) {#_im_invite_no,#_im_invite_yes {width: 102px;}}._im_bannerOverlay {opacity: 1 !important;}#_im_invite_messageMobile{display:none;}#_im_invite_messageDesktop{display:block;}@media all and (max-width: 600px) {#_im_invite_messageMobile {display: block;}#_im_invite_messageDesktop {display: none;}#_im_invite ._im_invite_header-logo {width: 35%;height: 40px;}#_im_invite ._im_invite_header {padding-bottom: 0px;}._im_invite * {font-size: 16px;}._im_invite h1 {font-size: 16px;}#_im_invite #_im_footer {display: none;}#_im_invite ._im_invite_content-text {padding-top: 10px;padding-bottom: 15px;}#_im_invite ._im_invite_content {padding-left: 20px;padding-right: 20px;}}',
                                html_invite_body:'<div class="_im_invite_header"><div class="_im_invite_header-logo" aria-label="__NAME__"></div><a href="javascript:void(0);" id="_im_invite_close" class="_im_invite_close"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><polygon fill="#000000" transform="translate(12.000000, 12.000000) rotate(-315.000000) translate(-12.000000, -12.000000) " points="14 10 22 10 22 14 14 14 14 22 10 22 10 14 2 14 2 10 10 10 10 2 14 2"></polygon></g></svg></a></div><div class="_im_invite_content"><div class="_im_invite_content-header"><h1>How\'s our site?</h1> </div><div class="_im_invite_content-text"><p id="_im_invite_messageMobile">After your visit we\'d like to send you a brief survey to improve our customer experience.</p><p id="_im_invite_messageDesktop">Tell us what you think by completing a quick survey.</p><br/><p id="_im_invite_messageDesktop">Press \'Yes\' to open the survey in a new window and fill it in at the end of your visit.</p></div><div class="_im_invite_content-answers"> <a id="_im_invite_no" href="javascript:void(0);" class="_im_invite_no">No</a><a id="_im_invite_yes" href="javascript:void(0);" class="_im_invite_yes">Yes</a> </div></div>'
                            }

                            modIntercept.custom_visual = new IM_InviteVisual(modIntercept, customId, template, null, {start_survey_timer:3000});
                              
                        }
                        
                    });
                
                },
                addInterceptIdToVisual:function(){
                    IMI.CustomJS.mods.iterate('intercepts', IMI.Intercepts, function(intercept){
                        if(intercept.visual){
                            intercept.visual.iid = intercept.id;
                        }
                    })
                },                    
                getAllCookies:function(){
                    var c=document.cookie, _cks = {};              
                    if(c.length>3){
                        for(var a=c.split(";"),i=0,b=a.length;i<b;i++){
                            var v=a[i].split("=");
                            while(v[0].substring(0,1)==" ")v[0]=v[0].substring(1,v[0].length);
                            if(v.length==2 &&!!v[0].match(/IMI\_/i))_cks[v[0]]=unescape(v[1]);
                        }
                    }   
                    return _cks;   
                },
                getBaseDomain : function() {
                    var sld = document.domain;
                    var dp = sld.split(".");
                    var l = dp.length;
                    if (l < 2) sld = null;
                    else if (!isNaN(dp[l - 1]) && !isNaN(dp[l - 2])) sld = null;
                    else sld = "." + dp[l - 2] + "." + dp[l - 1];
                    return sld;
                },			
                setCookie : function(n, v, d, e) {
                    var de = new Date;
                    de.setTime(de.getTime() + e * 1000);
                    document.cookie = n + "=" + escape(v) + ((e == null) ? "" : ("; expires=" + de.toGMTString())) + "; path=/" + ((d == null) ? "" : (";domain=" + d));
                },
                dataStore:{
                    'load':function(type){
                        var name = (type=='sessionStorage') ? 'IMI_info_session' : 'IMI_info';
                        var data = IMI.CustomJS.mods.interceptLocalStorage.get(name, type);
                        if(data){
                            if(type == 'sessionStorage'){
                                IMI.CustomJS.sessionData = JSON.parse(data);
                            }
                            else{
                                IMI.CustomJS.data = JSON.parse(data);
                            }
                        }
                    },
                    'save':function(type){
                        var name = (type=='sessionStorage') ? 'IMI_info_session' : 'IMI_info';
                        if(type == 'sessionStorage'){
                            data = JSON.stringify(IMI.CustomJS.sessionData);
                        }
                        else{
                            data = JSON.stringify(IMI.CustomJS.data);
                        }
                        if(data){
                            IMI.CustomJS.mods.interceptLocalStorage.save(name, data, type);
                        }
                    },
                    'get':function(type){
                        if(type == 'sessionStorage'){
                             return IMI.CustomJS.sessionData;
                        }
                        else{
                            return IMI.CustomJS.data;
                        }
                        
                    },
                    'delete':function(type){
                        var name = (type=='sessionStorage') ? 'IMI_info_session' : 'IMI_info';
                        if(type == 'sessionStorage'){
                            sessionStorage.removeItem(name);
                            IMI.CustomJS.sessionData={};
                       }
                       else{
                            localStorage.removeItem(name);
                            IMI.CustomJS.data={};
                       }
                    }
                },		          
                interceptLocalStorage:{
                    get:function(name, storageType){
                        var storeType = storageType || 'localStorage';
                        if(this.isLocalStorageEnabled){return window[storeType].getItem(name);}
                        else{IMI.JSUtil.getCookie(name);}
                    },
                    save:function(name, val, storageType){
                        var storeType = storageType || 'localStorage';
                        if(this.isLocalStorageEnabled){
                            window[storeType].setItem(name,val);
                        }
                        else {
                            IMI.CustomJS.mods.setCookie(name, val, IMI.CustomJS.mods.getBaseDomain(),30*24*60*60);
                        }
                    },
                    all:function(){
                        if(this.isLocalStorageEnabled){return localStorage;}
                        else{return IMI.CustomJS.mods.getAllCookies();}
                    },
                    checkAvailability: function() {
                        var testKey = 'test';
                        var isAvailable=false;
                        try {
                            localStorage.setItem(testKey, '1');
                            localStorage.getItem(testKey);
                            this.activeStorageType = 'localStorage';
                            this.isLocalStorageEnabled = true;
                            isAvailable=true;
                        } catch (error) {
                            this.activeStorageType = 'alternateLocalStorageFunc';
                            this.isLocalStorageEnabled = false;
                            isAvailable=false;
                        }
                        return isAvailable;
                    },
                },             
                /**
                 * loops through an array and executes the callback function on each item of the array
                 * example uses:
                 *  loops thru each intercept: iterate('intercepts', IMI.Intercepts, function(intercept){});
                 *  loops thru each trigger rule: iterate('triggerRules', IMI.Intercepts, function(triggerRule){});
                 * 
                 * var 1.50
                 */
                iterate:function(type, interceptArray, callback){
                    var iterateType='intercepts', status='';
                    if(type){
                        iterateType = type;
                    }
                    var iterateArray = interceptArray;
                    var ruleArray;
                    if(iterateType && iterateArray && callback){
                        for(var a=0; a<iterateArray.length; ++a){
                            if(iterateType === 'intercepts' || iterateType === 'array'){
                                status = callback.call(this, iterateArray[a], a);
                            }
                            else if(iterateType === 'trigger'){
                                status = callback.call(this, iterateArray[a].trigger, a);
                            }
                            else if(iterateType === 'triggerRuleGroups' || iterateType === 'triggerRules'){
                                ruleArray=[];
                                if(iterateType === 'triggerRuleGroups'){
                                    if(iterateArray[a].trigger && iterateArray[a].trigger.triggerRuleGroups){
                                        ruleArray =  iterateArray[a].trigger.triggerRuleGroups;
                                    }
                                    else{
                                        ruleArray = iterateArray[a];
                                    }
                                }
                                else if(iterateType === 'triggerRules'){
                                    if(iterateArray[a].trigger && iterateArray[a].trigger.triggerRuleGroups){
                                        for(var b=0; b<iterateArray[a].trigger.triggerRuleGroups.length; ++b){
                                            ruleArray = ruleArray.concat(iterateArray[a].trigger.triggerRuleGroups[b].triggerRules);
                                        }
                                    }
                                    else if(iterateArray[a].triggerRules){
                                        ruleArray = iterateArray[a].triggerRules;
                                    }
                                    else{
                                        ruleArray = iterateArray[a];
                                    }

                                }
                                for(var c=0; c<ruleArray.length; ++c){
                                    status = callback.call(this, ruleArray[c], c);
                                    if(status === "EXIT"){
                                        break;
                                    }
                                }
                            }
                            if(status === "EXIT"){
                                break;
                            }
                        }
                    }
                },
                /**
                 * getCustomInterceptSettings - pulls settings out of intercept triggers
                 * ver 2.85
                */
                getCustomInterceptSettings:function(override, arrayOfIntercepts){
                    
                    if(IMI.CustomJS.settings && !override){
                        return IMI.CustomJS.settings;
                    }
                    function parseValues(str){
                        var vals={}, sp, sp2, c=0, nm, val;
                        try{
                            sp = str.split(/,(?!(?:[^[]*\[[^]]*\])*[^[]*\])\s*/)
                            for(c;c<sp.length;++c){
                                sp2=sp[c].split("=");
                                nm = sp2[0];
                                val = sp2[1];
                                if(val.indexOf("[") == 0){
                                    val = JSON.parse(val);
                                }
                                vals[nm]=val;
                            }
                        }
                        catch(err){}
                        return vals;
                    }
                    var addedIntercepts={};
                    var ruleTypes=[
                        {name:'shutdown_intercepts_for_days'},{name:'shutdown_intercepts_by_settings'},{name:'intercept_session_settings'}
                    ];
                    var imm = IMI.CustomJS.mods;
                    var settings={'intercepts':[],'ruleTypes':{}};
                    var ruleType, ruleValue;
                    var ary = arrayOfIntercepts || IMI.Intercepts;
                    
                    imm.iterate('intercepts',ary, function(intercept){
                        
                        imm.iterate('triggerRules', [intercept],  function(rule){
                            ruleType, ruleValue=null;
                            imm.iterate('array', ruleTypes, function(rtype){
                                
                                if(rule.triggerTypeString === "JSEXPRESSION" && rule.expression.indexOf(rtype.name) > -1){
                                    ruleType = rtype.name; ruleValue=rule.compareValue; //rule.triggerResult=true;
                                    return "EXIT";
                                }
                            });
                            if(ruleType && ruleValue !== null){
                                if(typeof(ruleType) == 'string' && ruleValue.match(/=|,/)){
                                    ruleValue = parseValues(ruleValue);
                                }
                                else{
                                    ruleValue = {'complete':parseInt(ruleValue)};
                                }
                                
                                if(intercept.trigger && intercept.trigger.name && intercept.trigger.name.indexOf("__intercept settings") > -1){
                                    if(!settings['all']){
                                        settings['all'] = [];
                                    }
                                    settings['all'].push({
                                        'type':ruleType,
                                        'values':ruleValue
                                    });
                                }
                                else{
                                    settings.intercepts.push({
                                        'iid':intercept.id,
                                        'vid':intercept.visual.id,
                                        'type':ruleType,
                                        'values':ruleValue
                                    });
                                    if(IMI.CustomJS.manualIntercepts && !addedIntercepts[intercept.id]){
                                        addedIntercepts[intercept.id] = true;
                                        IMI.CustomJS.manualIntercepts.push(intercept);
                                        
                                    }
                                }
                                settings.ruleTypes['shutdown_intercepts_by_value']=1;
                            }
                        });
                        if(intercept.visual && intercept.visual.localizedText){
                            
                            if(intercept.visual.localizedText.indexOf("_multiStepOverlay_") > -1 || intercept.visual.localizedText.indexOf("__button__") > -1 || intercept.visual.localizedText.indexOf("__delayed_banner__") > -1 || intercept.visual.localizedText.indexOf("__invite__") > -1){
                                if(IMI.CustomJS.manualIntercepts && !addedIntercepts[intercept.id]){
                                    addedIntercepts[intercept.id] = true;
                                    IMI.CustomJS.manualIntercepts.push(intercept);
                                }
                            }
                        }
                    });
                    IMI.CustomJS.settings=settings;
                    return IMI.CustomJS.settings;
                },
                customEvents:{
                    trigger:function(name, payload){
                        var customEvent;
                        if(name && payload){
                            try{
                                customEvent = new CustomEvent(name, {'detail':payload});
                            }
                            catch(e){
                                customEvent= document.createEvent('Event');
                                if(customEvent){
                                    customEvent.initEvent(name, true, false, {'detail':payload});
                                }
                            }
                            if(customEvent){
                                window.dispatchEvent(customEvent);
                            }
                        }
                    },
                    addListener:function(name, callback){
                        if(name && callback){
                            window.addEventListener(name, callback, false);
                        }
                    }
                },
                /**
                 * stops intercept from triggering by adding a new rule that resolves to false. 
                 * ver 2.50
                 */
                modifyTriggers:function(listOfIds, type, message){
                    var newRule, expressionValue;
                    if(type=='enable'){
                        expressionValue="return true;";
                    }
                    else{
                        expressionValue="return false;";
                    }
                    var imm = IMI.CustomJS.mods;
                    var interceptsToModify=[];
                    if(!listOfIds || listOfIds[0] == 'all'){
                        interceptsToModify = IMI.Intercepts;
                        IMI.Intercepts=[];
                        return;
                    }
                    else{
                        imm.iterate('array', listOfIds, function(id){
                            imm.iterate('intercepts', IMI.Intercepts, function(intercept){
                                if(id === intercept.id){
                                    interceptsToModify.push(intercept);
                                }
                            })
                        })
                    }
                    imm.iterate('intercepts', interceptsToModify, function(intercept){
                        imm.iterate('triggerRuleGroups', [intercept], function(ruleGroup){
                            newRule=null;
                            imm.iterate('array', ruleGroup.triggerRules, function(rule){
                                if(rule.id==999999){
                                    newRule = rule;
                                    return "EXIT";
                                }
                            });
                            if(!newRule){
                                newRule={
                                    triggerType: IMI.TriggerRuleTypes.JSEXPRESSION,                                            
                                    id: 999999,
                                    operator: "EQUALS",        
                                    value: true,
                                    triggerResult: null,
                                    compareValue: "true",
                                    triggerTypeString: "JSEXPRESSION",
                                }
                                ruleGroup.triggerRules.unshift(newRule);
                            }
                            newRule.expression = expressionValue;
                        });
                        intercept.disabled= (type == 'enable') ? false : true;
                        if(message){
                            if(!intercept.customMessages){
                                intercept.customMessages = [];
                            }
                            intercept.customMessages.push(message);
                        }
                    });
                },                
                //calculates difference between 2 date strings, in either days or hours
                //ver 2.00
                getDateDifference:function(dateStringFirst, dateStringSecond, differenceType){
                    if(!(dateStringFirst && dateStringSecond)){
                        return null;
                    }
                
                    differenceType = differenceType || "days";
                    var dateFirst = new Date(dateStringFirst);
                    var dateSecond = new Date(dateStringSecond);
                    var diffTime, difference;
                    if(differenceType.match(/^(days|d)/)){
                        //hours*minutes*seconds*milliseconds
                        diffTime=  24 * 60 * 60 * 1000;
                    }
                    else if(differenceType.match(/^(hours|h)/)){
                        //minutes*seconds*milliseconds
                        diffTime=  60 * 60* 1000;
                    }
                    else if(differenceType.match(/^(minutes|min|m)/)){
                        //seconds*milliseconds
                        diffTime= 60* 1000;
                    }
                    else if(differenceType.match(/^(seconds|sec|s)/)){
                        //milliseconds
                        diffTime= 1000;
                    }                    
                    if(diffTime){
                        difference = Math.round(Math.abs((dateFirst.getTime() - dateSecond.getTime()) / (diffTime)));
                    }
                    return difference;
                }
            },
            log:function(str, xtra, showLog){
                if(IMI.CustomJS.debug || showLog){
                    if(xtra){console.log('%c'+str, xtra);}
                    else{
                        if(typeof(str)=="string"){console.log('%c'+str,'color: #E0E0B6; background: #0137A3;');}
                        else {console.log('Object value of:',str);}
                    }
                } 
            }            	
        }
       
        

        /* BEGIN IM_CustomBannerVisual */
        //ver 3.10 [former modifyBannerIntoOverlay]
        function IM_CustomBannerVisual(intercept, custom_id, template, container_id, config){

            this.isEnabled=true;
            if(!(intercept && intercept.id && intercept.visual && intercept.visual.id && intercept.visual.type && intercept.visual.type['name'] == 'BANNER')){
                this.isEnabled=false;
            }
            if(this.isDismissed(intercept.visual.id)){
                this.isEnabled=false;
            }
            
            this.template= template || {};
            this.triggered = 0;
            this.type="CustomBannerVisual";
            this.event_name = "CustomBannerVisual";
            this.intercept_id = intercept.id;
            this.visual_id = intercept.visual.id;
            this.org_id = intercept.orgId;
            this.custom_id = custom_id;
            this.events=[];

            if(custom_id){
                intercept.visual.customId = custom_id;
            }
            if(container_id){
                intercept.visual.containerId = container_id;
            }
            if(config){
                for(var n in config){
                    this[n] = config[n];
                }
            }
            intercept.customBuild =  (function(myVis){

                return function(){
                    if(myVis.isEnabled){
                        myVis.emit.call(myVis,{
                            'intercept_id':myVis.intercept_id,
                            'custom_id':myVis.custom_id,
                            'id':myVis.type + "_start"
                        }, 'start');
                        myVis.remake();
                    }
                }
            })(this);

            if(!intercept.visual.type.buildVisual_DEFAULT){
                intercept.visual.type.buildVisual_DEFAULT = intercept.visual.type.buildVisual;
                intercept.visual.type.buildVisual = function(intr, vis){
                    var r = intr.visual.type.buildVisual_DEFAULT.apply(intr.visual.type, arguments);
                    if(intr.customBuild){
                        intr.customBuild();
                    }
                    return r;
                }
            }
            return true;
        }
        IM_CustomBannerVisual.prototype = (function(){
            function on(arg1, arg2){
                var id, callback;
                if(arg1 && arg2){
                    id = arg1;
                    callback = arg2;
                }
                else if(arg1){
                    callback = arg1;
                    id = this.event_name;
                }
                if(id && callback){
                    this.events.push({
                        'id':id,
                        'callback':callback
                    });
                }
            }
            function emit(info, id){
                if(IMI.CustomJS && IMI.CustomJS.mods && IMI.CustomJS.mods.events && this.event_name){
                    IMI.CustomJS.mods.events.emit(this.event_name, info);
                }
                
                for(var c=0; c<this.events.length; ++c){
                    if(id && this.events[c].id == id && typeof(this.events[c].callback)=='function'){
                        this.events[c].callback(this,info);
                    }
                    if(this.events[c].id == this.event_name){
                        this.events[c].callback(this,info);
                    }
                }
                
            }
            function isDismissed(visId){
                var dis=false;
                if(window.localStorage && visId){
                    if(window.localStorage.getItem('interceptBannerDismissed_' + visId)){
                        dis=true;
                    }
                }
                return dis;
            }
            function dispatchEvent(elm, evtType) {if(elm){var evt = null;evtType = evtType || 'click';if(document.createEvent) { evt = document.createEvent('MouseEvents'); if(elm && elm.dispatchEvent && evt && evt.initMouseEvent) { evt.initMouseEvent(evtType,true,true,document.defaultView,1, 0, 0,0,0,false,false,false,false,0,null); elm.dispatchEvent(evt); }} else if (elm[evtType]){elm[evtType]();}}};

            function buttonClick(origButton){
                return function(){
                    dispatchEvent(origButton);
                }
            }
            function getOriginalButtons(dBanButtons, intercept){
                var origButtons = (dBanButtons) ? dBanButtons.querySelectorAll('.im_button') : [];
                var aYesOrig, aNoOrig, bId, actionType;
                if(intercept && intercept.visual && intercept.visual.bannerButtons){
                    for(var x=0; x<origButtons.length; ++x){
                        buttonId = origButtons[x].id;
                        for(var z=0; z<intercept.visual.bannerButtons.length; ++z){
                            bid=actionType='';
                            if(intercept.visual.bannerButtons[z].displayOrder){
                                bId = "im_button" + intercept.visual.bannerButtons[z].displayOrder;
                            }
                            if( intercept.visual.bannerButtons[z].actionType){
                                actionType =  intercept.visual.bannerButtons[z].actionType;
                            }
                            if(bId && actionType){
                                if(!aYesOrig && buttonId == bId && actionType.indexOf("LAUNCH_") == 0){
                                    aYesOrig = origButtons[x];
                                }
                                if(!aNoOrig && buttonId == bId && actionType.indexOf("CLOSE_") == 0){
                                    aNoOrig = origButtons[x];
                                }

                            }
                        }
                    }
                }
                return [aYesOrig, aNoOrig];
            }
            function buttonAction(status, buttonToClick, hideVisual){
                var myVis=this;
                return function(){
                    if(!myVis.isEnabled){
                        return;
                    }
                    myVis.emit.call(myVis,{
                        iid:myVis.intercept_id,
                        vid:myVis.visual_id,
                        id:myVis.type + '_' + status
                    }, status);
                    myVis.status = status;
                    if(buttonToClick){
                        if(!(status == 'optin' && myVis.delay_survey)){
                            myVis.buttonClick(buttonToClick)();
                        }
                    }
                    if(hideVisual){
                        myVis.action('hide');
                    }
                    if(status == "optin" || status == "optout"){
                        var logBody = {
                            orgId: myVis.org_id,
                            visualId: myVis.visual_id,
                            interceptId: myVis.intercept_id,
                            event: 'SUBVISUAL_VIEWED',
                            userId: IMI.JSUtil.getUserUUID()
                        
                        };
                        if(status == "optin"){
                            logBody["visualType"] = "WINDOW";
                            logBody["eventSub"] = "opt-in";
                            if(IMI.JSUtil && IMI.JSUtil.dismissBanner){
                                IMI.JSUtil.dismissBanner.registerRequest(myVis.visual_id);
                            }
                        }
                        else if (status == "optout"){
                            logBody["visualType"] = "BANNER";
                            logBody["eventSub"] = "opt-out";
                        }
                        if(IMI.RestUtil && IMI.RestUtil.callService){
                            IMI.RestUtil.callService(IMI.Config.host, null, "/intercept/v1/log", "POST", logBody);
                        }
                    }
                }
            }
            function constructHtml(temp){
                var name;
                var finalHtml=temp;
                if(this.template.variables){
                    for(name in this.template.variables){
                        finalHtml = finalHtml.replace(name, this.template.variables[name]);
                    }
                }
                return finalHtml;
            }
            function modify(type, dummyYesButton){
                var dummyYes;
                if(type == 'delay' && this.originalYesButton){

                    if(!dummyYesButton){
                        dummyYes = document.createElement("div");
                        dummyYes.innerHTML = this.originalYesButton.innerHTML;
                        dummyYes.className = this.originalYesButton.className;
                        dummyYes.id = this.originalYesButton.id;
                        this.originalYesButton.style.display="none";
                        this.originalYesButton.parentNode.insertBefore(dummyYes, this.originalYesButton);
                    }
                    else{
                        dummyYes = dummyYesButton;
                    }

                    dummyYes.addEventListener('click', this.buttonAction.call(this, 'optin'));
                    
                }

            }
            function action(type, id, container_id){
                var ban_id = this.banner_id || id;
                if(!ban_id){
                    ban_id = "_im_banner__" + this.visual_id;
                }
                
                var banner = document.getElementById(ban_id);
                var intercept;
                var iid = this.intercept_id;

                
                for(var c=0; c<IMI.Intercepts.length; ++c){
                    if(iid == IMI.Intercepts[c].id){
                        intercept = IMI.Intercepts[c];
                        break;
                    }
                }
                
                if(banner){
                    
                    if(type == 'show' && intercept && !this.isDismissed(intercept.visual.id)){
                        
                        if(!this.intercept_triggered){
                            IMI.InterceptUtil.appendAdditionalDataToURL(intercept);
                            IMI.InterceptUtil.triggerIntercept.call(IMI.InterceptUtil.triggerIntercept, intercept, new Map);
                            this.triggered++;
                            this.intercept_triggered=true;
                        }
                        else{
                            intercept.visual.type.triggerVisual.apply(intercept.visual.type, [intercept.visual, intercept]);
                        }
                        banner.style.display="flex";
                    }
                    else if(type == 'hide' && intercept){
                        intercept.visual.type.unTriggerVisual.apply(intercept.visual.type, [intercept.visual]);
                        banner.style.display="none";
                        
                    }
                    else if(type == 'pause'){
                        banner.style.display="none";
                    }
                    else if(type == 'unpause'){
                        banner.style.display="flex";
                    }
                    else if(type == 'move' && container_id){
                        var container = document.getElementById(container_id);
                        if(container){
                            container.appendChild(banner);
                        }
                    }
                    else if(type == 'trigger_survey'){
                        this.triggered++;
                        if(this.originalYesButton){
                            this.buttonClick(this.originalYesButton)();
                        }
                    }
                    
                }
            }
            return {
                on:on,
                emit:emit,
                buttonClick:buttonClick,
                action:action,
                getOriginalButtons:getOriginalButtons,
                buttonAction:buttonAction,
                modify:modify,
                constructHtml:constructHtml,
                isDismissed:isDismissed
            }
        })();
        /* END IM_CustomBannerVisual */ 
        
        /* BEGIN IM_InviteVisual */
        //ver 3.10 [inherits from IM_CustomBannerVisual]
        function IM_InviteVisual(intercept, custom_id, template, container_id, config){
            this.start_survey_timer = 15000;
            this.skip_instruction_screen = false;

            IM_CustomBannerVisual.call(this, intercept, custom_id, template, container_id, config);
            
            this.type="InviteVisual";
            this.event_name = "InviteVisual";
            

            var cssIMFooter= this.template.css_im_footer || '#_im_footer * {font-size: 12px!important}#_im_footer {font-size: 12px!important;background-color: #000;Xbottom: 0;Xposition: absolute}._im_footer_rightLinks {padding-top: 1.5%;float: right!important}._im_footer_leftLinks {padding-top: 1%;float: left!important}._im_footer_leftLinks #_im_footer_copyright {display: inline-block}._im_footer_leftLinks span {display: inline}#_im_footer #privacyPolicy {float: left}#_im_footer {background-color: #000;color: #fff;display: table;max-width: 100%;width: 100%}#_im_footer a {color: #fff;text-decoration: none;display: inline-block}#_im_footer a:hover {text-decoration: none}#_im_footer a:after {background: #e71836;bottom: -2px;content: \'\';height:1px;left:0;max-width:100%;position:absolute;-webkit-transition:all .4s ease-in-out;transition:all .4s ease-in-out;width:0;}.lcl_ar #_im_footer a:after {left: auto;right: 0}#_im_footer a:hover:after {width: 100%}#_im_footer #_im_footer_links {display: table;margin: 0 auto;max-width: 966px;padding: 25px 0;width: 90%}#_im_footer ._im_footer_leftLinks {padding-top: 6px}#_im_footer ._im_footer_rightLinks {padding-top: 0}#_im_footer #_im_footer_companyLogo {border-radius: 0;-moz-border-radius: 0;-webkit-border-radius: 0;bottom: auto!important;line-height: 0;padding: 0}#_im_footer #_im_footer_companyLogo img {box-sizing: border-box;height: 25px}#_im_footer #_im_footer_companyLogo a:hover:after {width: 0}@media all and (max-width: 480px) {#_im_footer ._im_footer_leftLinks {padding-top: 0}#_im_footer ._im_footer_leftLinks #_im_footer_copyright,#_im_footer ._im_footer_leftLinks #_im_footer_privacyPolicy {margin: 0 4px 4px 0;}}';
            var htmlIMFooter= this.template.html_im_footer || '<div id="_im_footer" role="contentinfo"><div id="_im_footer_links" role="region"><div class="_im_footer_leftLinks"> <span id="_im_footer_privacyPolicy"><a target="_blank" href="http://www.inmoment.com/privacy-policy/"><span>Privacy Policy</span></a></span><span class="linkSeparator">&nbsp;|</span> <div id="_im_footer_copyright"><a target="_blank" href="https://www.inmoment.com/websurvey/2/info">&copy; 2020 InMoment Inc.</div></div><div class="_im_footer_rightLinks"></div></div></div>';
            var cssInvite= this.template.css_invite || '._im_bannerOverlay_invite {justify-content: center;}#_im_invite_container {display: flex;justify-content: center;width: 100%;}#_im_invite {z-index: 1000;width: 700px;bottom: 0px;visibility: visible;}._im_invite,._im_invite *,._im_invite *::before,._im_invite *::after,._im_invite a:hover,._im_invite a:active {border: 0;margin: 0;padding: 0;border-radius: 0;box-sizing: border-box;float: none;line-height: 1.3;font-family: arial, sans-serif;font-size: 17px;font-weight: normal;font-style: normal;font-variant: normal;text-decoration: none;text-align: center;text-indent: none;text-justify: auto;text-transform: none;letter-spacing: normal;color: inherit;background-image: none;background-color: transparent;display: block;}._im_invite {position: fixed;visibility: hidden;text-align: center;border: solid 1px #444648;color: #444648;background-color: white;}._im_invite h1 {font-size: 26px;font-weight: bold;color: #14A248;}._im_invite_header {padding: 40px;background-color: inherit;}._im_invite_header-logo {background-image: url(__LOGO__);background-position: 50% 50%;background-repeat: no-repeat;background-size: contain;height: 70px;width: 75%;margin: 0 auto;}#_im_invite_close:active,#_im_invite_close:hover,#_im_invite_close {display: block;position: absolute;top: 10px;right: 10px;height: 24px;width: 24px;}#_im_invite_close svg {fill: #444648;}._im_invite_content {padding: 10px 40px 20px 40px;background-color: inherit;color: inherit;}._im_invite_content-text {padding: 15px 70px 25px 70px;}#_im_invite_no:hover,#_im_invite_yes:hover,#_im_invite_no,#_im_invite_yes {height: 48px;width: 160px;display: inline-block;line-height: 48px;}#_im_invite_no:hover,#_im_invite_no {border: solid 1px #56585a;color: inherit;background-color: inherit;}#_im_invite_yes:hover,#_im_invite_yes {border: solid 1px #14A248;color: white;background-color: #14A248;margin-left: 15px;}@keyframes etrack-bounceInUp {from, 60%, 75%, 90%, to {animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);}from {opacity: 0;transform: translate3d(0, 2000px, 0);}60% {opacity: 1;transform: translate3d(0, -20px, 0);}75% {transform: translate3d(0, 10px, 0);}90% {transform: translate3d(0, -5px, 0);}to {transform: translate3d(0, 0, 0);}}.etrack-invite-in {animation-duration: 1s;animation-fill-mode: both;animation-name: etrack-bounceInUp;}@keyframes etrack-bounceOutDown {20% {transform: translate3d(0, 10px, 0);}40%,45% {opacity: 1;transform: translate3d(0, -20px, 0);}to {opacity: 0;transform: translate3d(0, 2000px, 0);}}.etrack-invite-out {animation-duration: 1s;animation-fill-mode: both;animation-name: etrack-bounceOutDown;}@media all and (max-width: 600px) {#_im_invite {width: 96%;}._im_invite_content-text {padding-left: 0px;padding-right: 0px;}}@media all and (max-width: 440px) {#_im_invite_no,#_im_invite_yes,#_im_invite_no:hover,#_im_invite_yes:hover {width: 130px !important;}}@media all and (max-width: 320px) {#_im_invite_no,#_im_invite_yes {width: 102px;}}._im_bannerOverlay {opacity: 1 !important;}#_im_invite_messageMobile{display:none;}#_im_invite_messageDesktop{display:block;}@media all and (max-width: 600px) {#_im_invite_messageMobile {display: block;}#_im_invite_messageDesktop {display: none;}#_im_invite ._im_invite_header-logo {width: 35%;height: 40px;}#_im_invite ._im_invite_header {padding-bottom: 0px;}._im_invite * {font-size: 16px;}._im_invite h1 {font-size: 16px;}#_im_invite #_im_footer {display: none;}#_im_invite ._im_invite_content-text {padding-top: 10px;padding-bottom: 15px;}#_im_invite ._im_invite_content {padding-left: 20px;padding-right: 20px;}}';

            cssInvite+=cssIMFooter;

            var htmlInviteBody = this.template.html_invite_body || '<div class="_im_invite_header"><div class="_im_invite_header-logo" aria-label="__NAME__"></div><a href="javascript:void(0);" id="_im_invite_close" class="_im_invite_close"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><polygon fill="#000000" transform="translate(12.000000, 12.000000) rotate(-315.000000) translate(-12.000000, -12.000000) " points="14 10 22 10 22 14 14 14 14 22 10 22 10 14 2 14 2 10 10 10 10 2 14 2"></polygon></g></svg></a></div><div class="_im_invite_content"><div class="_im_invite_content-header"><h1>How\'s our site?</h1> </div><div class="_im_invite_content-text"><p id="_im_invite_messageMobile">After your visit we\'d like to send you a brief survey to improve our customer experience.</p><p id="_im_invite_messageDesktop">Tell us what you think by completing a quick survey.</p><br/><p id="_im_invite_messageDesktop">Press \'Yes\' to open the survey in a new window and fill it in at the end of your visit.</p></div><div class="_im_invite_content-answers"> <a id="_im_invite_no" href="javascript:void(0);" class="_im_invite_no">No</a><a id="_im_invite_yes" href="javascript:void(0);" class="_im_invite_yes">Yes</a> </div></div>';
            if(!this.template.invite){
                this.template.invite='<style>' + cssInvite + '</style><div id="_im_invite_container"><div id="_im_invite" class="_im_invite">'+ htmlInviteBody + htmlIMFooter +'</div></div>';
            }
            
            var scriptReady = this.template.script_ready || [
                'setTimeout(function(){',
                '		var dWait = document.getElementById("_im_start_wait");',
                '		var dReady = document.getElementById("_im_start_ready");',
                '		if(dWait && dReady){',
                '			dWait.style.display="none";',
                '			dReady.style.display="block";',
                '		}',
                '},' + this.start_survey_timer + ');',
                'window.imLog = function(){',
                '	function callService(e, t, r, n, i, s, a) {',
                '		this.url = null !== t ? "//" + e + ":" + t + r : "//" + e + r;',
                '		var o = new XMLHttpRequest;',
                '		return o.open(n, this.url, !0), o.onreadystatechange = function() {',
                '			if (o.readyState === XMLHttpRequest.DONE || 4 === o.readyState)',
                '				if (200 === o.status) s && s(o.response, a);',
                '				else if (null !== o.responseText && void 0 !== o.responseText && "" !== o.responseText) try {',
                '				var e = JSON.parse(o.responseText).message;',
                '				console.log(e);',
                '			} catch (e) {',

                '			}',
                '		}, null !== i ? (o.setRequestHeader("Content-type", "application/json"), o.send(JSON.stringify(i))) : o.send(), a',
                '	};',

                
                '	var logBody = {',
                '		orgId: im_data.orgId,',
                '		visualId: im_data.visualId,',
                '		interceptId: im_data.interceptId,',
                '		visualType: im_data.visualType,',
                '		event: "SURVEY_VIEWED",',
                '		userId: im_data.userId',
                '	};',
                '	callService("dispawsusva.inmoment.com", null, "/intercept/v1/log", "POST", logBody);',
                '};',
                ''].join("");
            var cssReady = this.template.css_ready || '._im_start{display: flex; flex-direction: column; justify-content: space-between;}._im_start, ._im_start *, ._im_start *::before, ._im_start *::after, ._im_start a:hover, ._im_start a:active{border: 0; margin: 0; padding: 0; border-radius: 0; box-sizing: border-box; float: none; line-height: 1.3; font-family: arial, sans-serif; font-size: 18px; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; text-align: left; text-indent: none; text-justify: auto; text-transform: none; letter-spacing: normal; color:inherit; background-image: none; background-color:transparent;}#_im_start_ready{display: none;}._im_start{height: 100%; color: #444648; background-color: white; overflow:hidden; min-height:500px; position: absolute; top: 0; left: 0; right: 0; bottom: 0;}._im_start h1{font-size: 28px; font-weight: bold;}._im_start h2{font-weight: bold;}._im_start_header{padding: 10px; background-color: inherit;}._im_start_header-logo{background-image: url(__LOGO__); background-position: 50% 50%; background-repeat: no-repeat; background-size: contain; height: 90px; width: 75%; margin: 0 auto;}._im_start_content{padding: 10px 40px 20px 40px; background-color: white; color: inherit;}._im_start_content-header{padding:20px 0;}._im_start_content-header>h1{text-align: center}._im_start_content-text{max-width: 650px; margin: 0 auto;}._im_start_content-body{max-width: 650px; margin: 25px auto 50px auto;}._im_start_content-body>p{font-size: 16px; text-align: center;}._im_start_content-text>h2{padding:10px 0;}#_im_start_ready ._im_start_content-text{text-align: center}#_im_start_begin-survey:hover, #_im_start_begin-survey{height: 48px; width: 160px; display: inline-block; line-height: 48px; color: white; border: solid 1px #14A248; background-color: #14A248; text-align: center;}._im_start_content-instructions{padding: 0px 20px;}' + cssIMFooter;
            if(!this.template.ready){
                this.template.ready='<html><head><style>' + cssReady + '</style><script>__DATA_SCRIPT__</script><script>' + scriptReady + '</script></head><body><div class="_im_start"><div class="_im_start_main"><div class="_im_start_header"><div class="_im_start_header-logo"></div></div><div class="_im_start_content" id="_im_start_wait" style="display: block;"><div class="_im_start_content-header"><h1>Thank you - we look forward to your feedback!</h1></div><div class="_im_start_content-body"><p>Please keep this window open whilst you continue your visit and click on the \'Start Survey\' button when you\'re ready to fill out the survey</p></div></div><div class="_im_start_content" id="_im_start_ready" style="display: none;"><div class="_im_start_content-header"><h1>Thank you - we look forward to your feedback!</h1></div><div class="_im_start_content-body"><p>Please keep this window open whilst you continue your visit and click on the \'Start Survey\' button below when you\'re ready to fill out the survey</p></div><div class="_im_start_content-text"> <a id="_im_start_begin-survey" href="__SURVEY_HREF__" onclick="if(window.imLog){window.imLog();}">Start Survey</a> </div></div></div>' + htmlIMFooter + '</div></body></html>';
            }
                        
        }
        IM_InviteVisual.prototype = (function(){
            var proto = Object.create(IM_CustomBannerVisual.prototype);
            Object.defineProperty(proto, 'constructor', { 
                value: IM_InviteVisual, 
                enumerable: false, 
                writable: true 
            });
            function openWindow(surveyUrl, htmlForPopup){
                var myVis = this;
                return function(){
                    if(!htmlForPopup){

                        if(myVis.originalYesButton){
                            myVis.buttonClick(myVis.originalYesButton)();
                        }

                        var logBody = {
                            orgId: myVis.org_id,
                            visualId: myVis.intercept_id,
                            interceptId: myVis.visual_id,
                            visualType: "BANNER",
                            event: 'SURVEY_VIEWED',
                            userId: IMI.JSUtil.getUserUUID()
                        };
                        IMI.CustomJS.log("Sending log:");
                        IMI.CustomJS.log(logBody);
                        IMI.RestUtil.callService(IMI.Config.host, null, "/intercept/v1/log", "POST", logBody);
                    }
                    else if(htmlForPopup){
                        var params=[];
                        width=800;
                        height=500;
                        left=(screen.width - width) / 2;
                        top=(screen.geight - height) / 4;
                        params=['width=' + width,'height=' + height,'left=' + left,'top=' + top,'scrollbars=1','resizable=1'];
                        var win = window.open("", "surveyReady2",params.join(", "));
                        var htmlPop=htmlForPopup;
                        var htmlScript = [
                            'window.im_data ={};',
                            'im_data.orgId = ' + myVis.org_id + ';',
                            'im_data.interceptId = ' + myVis.intercept_id + ';',
                            'im_data.visualId = ' + myVis.visual_id + ';',
                            'im_data.userId = "' + IMI.JSUtil.getUserUUID() + '";',
                            'im_data.visualType = "BANNER";'
                        ].join("");
                        htmlPop = htmlPop.replace("__DATA_SCRIPT__", htmlScript);
                        htmlPop = htmlPop.replace("__SURVEY_HREF__", surveyUrl)
                        win.document.open();
                        win.document.write(htmlPop);
                        win.document.close();
                        //myVis.action('hide');
                    }
                }
            }            


            proto.remake=function(containerId, modifyType){
                if(this.modified){
                    return;
                }
                this.banner_id = "_im_banner__" + this.visual_id;
                var banner = document.getElementById(this.banner_id);
                
                var dBanButtons = banner.querySelector(".im_button-container");
                var iid = this.intercept_id;
                var aYes, aNo, intercept;
                for(var c=0; c<IMI.Intercepts.length; ++c){
                    if(iid == IMI.Intercepts[c].id){
                        intercept = IMI.Intercepts[c];
                        break;
                    }
                }

                var origYesNoButtons = this.getOriginalButtons(dBanButtons, intercept);

                this.originalYesButton = origYesNoButtons[0] ? origYesNoButtons[0] : null;
                this.originalNoButton = origYesNoButtons[1] ? origYesNoButtons[1] : null;

                if(banner && dBanButtons && intercept){
                    if(this.modify && modifyType){
                        this.modify(modifyType);
                    
                    }

                    banner.className+= ' _im_bannerOverlay_invite ';
                    var url = intercept.visual.url;
                    var dNewBanner = document.createElement("div");
                    dNewBanner.innerHTML = this.constructHtml.call(this,this.template.invite);
                    banner.style.display="none";
                    banner.className+= "_im_bannerOverlay";
                    banner.innerHTML = '';
                    banner.appendChild(dNewBanner);
                    dBanButtons.style.display="none";
                    banner.appendChild(dBanButtons);
                    aYes = banner.querySelector("#_im_invite_yes");
                    aNo = banner.querySelector("#_im_invite_no");
                    aClose = banner.querySelector("#_im_invite_close");

                    
                    if(aYes){   
                        if(this.skip_instruction_screen){
                            //aYes.addEventListener('click',  openWindow.call(this,url));
                            aYes.addEventListener('click', this.buttonAction.call(this, 'optin', this.originalYesButton));
                        }
                        else if(this.delay_survey){
                            aYes.addEventListener('click', this.buttonAction.call(this, 'optin', null, true));
                        }
                        else{
                            aYes.addEventListener('click', this.buttonAction.call(this, 'optin', null, true));
                            aYes.addEventListener('click',  openWindow.call(this,url,this.constructHtml.call(this, this.template.ready)));
                        }
                        //aYes.addEventListener('click', this.buttonAction.call(this, 'optin'));
                    }
                    if(aNo){aNo.addEventListener('click', this.buttonAction.call(this, 'optout', this.originalNoButton));}
                    if(aClose){aClose.addEventListener('click', this.buttonAction.call(this, 'optout', this.originalNoButton));}
                    if(containerId){
                        var container = document.getElementById(containerId);
                        if(container){
                            container.appendChild(banner);
                        }
                    }
                    this.modified=true;
                }
            }
            return proto;
        })();
        /* END IM_InviteVisual */     
                
    })();
}