(function(){
    var eventId;
    var scripts = document.getElementsByTagName('script');
    var thisScript = scripts[scripts.length - 1];
    var footer;
    if(biSequence == undefined || isNaN(biSequence)){
        throw "biSequence is undefined or not a number";
    }
     if(biSequence % 2 == 0){
         // Wibiya
         eventId = 4;
         var footer = document.createElement('script');
         footer.src = "http://cdn.wibiya.com/Toolbars/dir_0900/Toolbar_900114/Loader_900114.js";
         footer.type = "text/javascript";
     }
    else{
         eventId = 6;
         footer = document.createElement('div');
         footer.id = "wixfooter";
         footer.innerHTML = '<span class="logo"></span> <a href="http://www.wix.com" title="Free Website Builder" class="link1">This website was created using <span>wix.com</span></a>' + 
                     '<a href="http://www.wix.com" title="Free Website" class="link3">Go</a>'+
                     '<a href="http://www.wix.com/create/website" title="Create a free website with Wix\' online drag & drop editor. No coding required." class="link2">Create your own website</a>';
     }
    thisScript.parentNode.insertBefore(footer, thisScript);

    var imgBI = document.createElement('img');
    imgBI.src = 'http://frog.wix.com/footer_bi?event_id='+ eventId +'&site_id='+ biSequence +'&target_sn=0';
    imgBI.style.height = '1px';     imgBI.style.width = '1px';
    thisScript.parentNode.insertBefore(imgBI, thisScript);
})();


