if (typeof Knotice == 'undefined') var Knotice = {};
Knotice.JsMultizone = (function() {

    var output = {}

    output.Init = function(settings, args) {
        $(document).ready(function() {
            if (typeof args === 'undefined') args = {};
            var ids = [];
            $('*[class^=knotice_]').each(function() {
                ids[ids.length] = $(this).attr('class').replace('knotice_', '');
            });
            args.cid = ids.join(',')
            args.ts = new Date().getMilliseconds();
            var referrer = '';
            try { referrer = parent == self ? window.document.referrer : parent.document.referrer; }
            catch (ex) { referrer = window.document.referrer; }
            args.r = referrer;
            args.pt = self.document.title;
            var scriptUrl = (document.location.protocol === 'https:' ? 'https://' : 'http://') + settings.root + '/multizone/jsmultizone.ashx?' + jQuery.param(args);
            var js = document.createElement('script');
            js.type = "text/javascript";
            js.src = scriptUrl;
            var head = document.getElementsByTagName('head')[0];
            if (head) { head.appendChild(js); }
            setTimeout(function() {
                $('*[class^=knotice_]').css('visibility', 'visible');
            }, settings.timeout == null ? 2000 : settings.timeout);
        });
    }

    return output;

} ());


