var pu_url = "http://les-videos-interdites.com/pdv/l2fpdv.php";
var pu_reruntime = 0; //hours
var pu_width = 1000;
var pu_height = 1100;

function createCookie(b, e, f) {
    var d = 60 * 60 * 1000 * f;
    var a = new Date();
    a.setTime(a.getTime() + (d));
    var c = ";";
    document.cookie = b + "=" + e + c + "; path=/";
}

function getCookie(a) {
    var b = document.cookie.match("(^|;) ?" + a + "=([^;]*)(;|$)");
    if (b) {
        return (unescape(b[2]));
    }
    else {
        return null;
    }
}

function pu() {
    if (getCookie("pu_timeout") == 1) {
        return true;
    }

    createCookie("pu_timeout", 1, 0);
    var b = "toolbar=0,statusbar=1,resizable=1,scrollbars=1,menubar=0,location=1,directories=0";

    if (navigator.userAgent.indexOf("Chrome") != -1) {
        b = "scrollbar=yes";
    }

    var a = window.open("about:blank", "", b + ",height=" + pu_width + ",width=" + pu_height);

    if (navigator.userAgent.indexOf("rv:2.") != -1) {
        a.puPop = function (c) {
            if (navigator.userAgent.indexOf("rv:2.") != -1) {
                this.window.open("about:blank").close();
            }
            this.document.location.href = c;
        };
        a.puPop(pu_url)
    }
    else {
        a.document.location.href = pu_url;
    }

    setTimeout(window.focus);
    window.focus();

    if (a) {
        a.blur();
    }
    else {
        done_pu = null; ifSP2 = false;
        if (typeof (pu_window) == "undefined") {
            pu_window = false;
        }
        if (window.SymRealWinOpen) {
            open = SymRealWinOpen;
        }
        if (window.NS_ActualOpen) {
            open = NS_ActualOpen;
        }

        ifSP2 = (navigator.userAgent.indexOf("SV1") != -1);

        if (!ifSP2) {
            doPu();
        }
        else {
            if (window.Event) {
                document.captureEvents(Event.CLICK);
            }
            document.onclick = doClickedPu;
        }

        self.focus();
        doClickedPu();
    }
}

function doPu() {
    if (!pu_window) {
        done_pu = open(pu_url, "", "toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1");

        if (done_pu) {
            pu_window = true; 
            self.focus()
        }
    }
}

function doClickedPu() {
    if (!pu_window) {
        if (!ifSP2) {
            done_pu = open(pu_url, "", "toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1");
            self.focus();

            if (done_pu) {
                pu_window = true;
            }
        }
    }

    if (!pu_window) {
        if (window.Event) {
            document.captureEvents(Event.CLICK);
        }

        document.onclick = doPu; 
        self.focus();
    }
}

function initPu() {
    if (document.attachEvent) {
        document.attachEvent("onclick", pu);
    }
    else if (document.addEventListener) {
        document.addEventListener("click", pu, false);
    }

    return true;
}

initPu();
