/* CRITEO Widgets Loader Version 1.1c */
var CRITEO = function () {
    var f = {
        F: [],
        C: function () {
            if (arguments.callee.ag) {
                return;
            }
            arguments.callee.ag = true;
            for (var i = 0; i < f.F.length; i++) {
                f.F[i]();
            }
        },
        Q: function (R) {
            this.F[this.F.length] = R;
            if (document.addEventListener) {
                document.addEventListener("DOMContentLoaded", f.C, null);
            }
            if (/KHTML|WebKit/i.test(navigator.userAgent)) {
                var P = setInterval(function () {
                    if (/loaded|complete/.test(document.readyState)) {
                        clearInterval(P);
                        delete P;
                        f.C();
                    }
                },
                10);
            }
            /*@cc_on@if(@_win32)var T="src='javascript:void(0)'";if(location.protocol=="https:")T="src=//0";document.write("<scr"+"ipt id=__cto_ie_onload defer "+T+"><\/scr"+"ipt>");var s=document.getElementById("__cto_ie_onload");s.onreadystatechange=function(){if(this.readyState=="complete"){f.C();}};@end@*/
            ;
            if (typeof window.onload != 'function') {
                window.onload = f.C;
            } else {
                var D = window.onload;
                window.onload = function () {
                    f.C();
                    if (D) {
                        D();
                    }
                };
            }
        }
    };

    function A(s) {
        if (document.getElementsByTagName) {
            var h = document.getElementsByTagName('head')[0];
            if (!h) {
                h = document.createElement('HEAD');
                document.documentElement.appendChild(h);
            }
            if (h && h.appendChild) {
                h.appendChild(s);
            }
        }
    };

    function B() {
        if (typeof(window.encodeURIComponent) === 'undefined') {
            var r = {
                ab: function (H) {
                    H = "" + H;
                    var t, s, G = "",
                        i = 0;
                    while (i < H.length) {
                        t = H.charCodeAt(i++);
                        if (t >= 0xDC00 && t < 0xE000) {
                            continue;
                        }
                        if (t >= 0xD800 && t < 0xDC00) {
                            if (i >= H.length) {
                                continue;
                            }
                            s = H.charCodeAt(i++);
                            if (s < 0xDC00 || t >= 0xDE00) {
                                continue;
                            }
                            t = ((t - 0xD800) << 10) + (s - 0xDC00) + 0x10000;
                        }
                        if (t < 0x80) {
                            G += String.fromCharCode(t);
                        } else if (t < 0x800) {
                            G += String.fromCharCode(0xC0 + (t >> 6), 0x80 + (t & 0x3F));
                        } else if (t < 0x10000) {
                            G += String.fromCharCode(0xE0 + (t >> 12), 0x80 + (t >> 6 & 0x3F), 0x80 + (t & 0x3F));
                        } else {
                            G += String.fromCharCode(0xF0 + (t >> 18), 0x80 + (t >> 12 & 0x3F), 0x80 + (t >> 6 & 0x3F), 0x80 + (t & 0x3F));
                        }
                    }
                    return G;
                },
                I: "0123456789ABCDEF",
                V: function (n) {
                    return r.I.charAt(n >> 4) + r.I.charAt(n & 0xF);
                },
                K: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"
            };
            window.encodeURIComponent = function (s) {
                s = r.ab(s);
                var G = "";
                for (var i = 0; i < s.length; i++) {
                    if (r.K.indexOf(s.charAt(i)) == -1) {
                        G += "%" + r.V(s.charCodeAt(i));
                    } else {
                        G += s.charAt(i);
                    }
                }
                return G;
            };
        }
    };

    function L() {
        if (document.getElementsByTagName) {
            var n = 1;
            var o = [];
            var l = [];
            var U, O, M, aa, ae, ac;
            var a = document.getElementsByTagName('div');
            for (var i = 0; i < a.length; i++) {
                if (a[i].id && a[i].id.substring(0, 3).toLowerCase() == "cto" && a[i].childNodes) {
                    U = O = M = aa = ac = null;
                    ae = 2;
                    for (var j = 0; j < a[i].childNodes.length; j++) {
                        var t = a[i].childNodes[j];
                        if (t && t.tagName && t.tagName.toLowerCase() == "div" && t.className && t.className.substring(0, 3).toLowerCase() == "cto") {
                            var v = (t.textContent ? t.textContent : (t.innerText ? t.innerText : null));
                            switch (t.className.toLowerCase()) {
                            case 'ctowidgetserver':
                                U = v;
                                break;
                            case 'ctodatatype':
                                O = v;
                                break;
                            case 'ctowidgettype':
                                M = v;
                                break;
                            case 'ctoparams':
                                aa = v;
                                break;
                            case 'ctoversion':
                                ae = v;
                                break;
                            case 'ctodata':
                                ac = t.innerHTML;
                                break;
                            }
                        }
                    }
                    if (U && ((!O && M) || (O && !M))) {
                        var u = "v=" + ae;
                        if (aa) {
                            u += "&" + aa;
                        }
                        u = "p" + n + "=" + encodeURIComponent(u);
                        if (ac) {
                            u += "&d" + n + "=" + encodeURIComponent(ac);
                        }
                        if (M) {
                            u += "&w" + n + "=" + M;
                        } else {
                            u += "&t" + n + "=" + O;
                        }
                        var s;
                        for (s = 0; s < o.length; s++) {
                            if (o[s] == U) {
                                break;
                            }
                        }
                        if (s != o.length && l[s] && (l[s].length + u.length) > 2000) {
                            CRITEO.AddScript(l[s]);
                            l[s] = null;
                        }
                        if (s == o.length || !l[s]) {
                            o[s] = U;
                            l[s] = U + "display.js?";
                        } else {
                            l[s] += "&";
                        }
                        l[s] += u;
                        n++;
                    }
                }
            }
            for (var k = 0; k < l.length; k++) {
                if (l[k]) {
                    CRITEO.AddScript(l[k]);
                }
            }
        }
    };

    function J() {
        B();
        L();
    };
    return {
        Q: function () {
            if (typeof(CRITEO_Loaded) != "undefined") {
                return;
            }
            CRITEO_Loaded = 1;
            f.Q(function () {
                J();
            });
        },
        AddStyle: function (ad) {
            if (document.createElement) {
                var s = document.createElement('style');
                if (s) {
                    s.setAttribute('type', 'text/css');
                    A(s);
                    if (s.styleSheet) {
                        try {
                            s.styleSheet.cssText = ad;
                        } catch(e) {}
                    } else {
                        var t = document.createTextNode(ad);
                        s.appendChild(t);
                    }
                }
            }
        },
        AddScript: function (u) {
            if (document.createElement) {
                var s = document.createElement('script');
                if (s) {
                    s.type = 'text/javascript';
                    s.src = u;
                    A(s);
                }
            }
        },
        AddImage: function (a, u) {
            if (document.createElement) {
                var af = document.createElement('IMG');
                if (af) {
                    if (a) {
                        var d = document.getElementById(a);
                        if (d === null) {
                            d = document.createElement('DIV');
                            d.id = a;
                            d.style.display = "none";
                            document.body.appendChild(d);
                        }
                        if (d !== null && d.appendChild) {
                            d.appendChild(af);
                        }
                    }
                    af.src = u;
                }
            }
        },
        NewGuid: function (m) {
            var g = "";
            for (var i = 0; i < m; i++) {
                g += Math.floor(Math.random() * 0xF).toString(0xF);
            }
            return g + "";
        }
    };
}();
var CRITEO_Loaded;
CRITEO.Q();