function gup_exit(n, s) {
  n = n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
  var p = (new RegExp("[\\?&]"+n+"=([^&#]*)")).exec(s);
  return (p===null) ? "" : p[1];
}

var pop = 1;
var pop_exit, popupURL;
var _exit_vars = {
    msg: ">> Annuler la fermeture pour recevoir votre cadeau <<",
    alert: "Merci de votre visite!\n\nvisitez notre site pour des videos gratuites!",
    path: 'https://secure.securitetotale.com/images/'
};
var Browser = {
    _name: null,
    _os: null,
    _version: null,
    detect: function () {
        var a = navigator.userAgent;
        switch (navigator.appName) {
        case 'Netscape':
            if (a.lastIndexOf('Firefox') != -1) {
                this._name = 'FF';
                this._version = a.replace(/^.*Firefox\/([0-9.]+).*$/gi, '$1')
            } else if (a.lastIndexOf('Chrome') != -1) {
                this._name = 'CH'
            } else if (a.lastIndexOf('Safari') != -1) {
                this._name = 'SA'
            }
            break;
        case 'Microsoft Internet Explorer':
            this._version = a.replace(/^.*MSIE ([0-9]{1}).*$/gi, '$1');
            this._name = 'IE';
            break
        }
        if (a.lastIndexOf('Windows NT 6.1') != -1) {
            this._os = 'W7'
        } else if (a.lastIndexOf('Windows NT 6.0') != -1) {
            this._os = 'VI'
        } else if (a.lastIndexOf('Windows NT 5.1') != -1) {
            this._os = 'XP'
        }
    }
};

function test_exit() {
    try {
        popexit.blur()
    } catch (e) {
        addhtml()
    }
}
function a() {
    var a = window.open(_exit_vars.url, "_blank", "width=1024,height=950,toolbar=1,location=1,directories=1,status=1,scrollbars=1,resizable=1,copyhistory=1,menuBar=1");
    try {
        a.blur()
    } catch (e) {
        window.setTimeout('test_exit()', 200)
    }
}
function exit() {
    switch (Browser._name) {
    case 'FF':
        var f = document.createElement('div');
        f.id = '_exit_pop';
        document.body.insertBefore(f, document.body.firstChild);
        var a = "java" + "script:popexit();";
        document.getElementById('_exit_pop').innerHTML = '<object width="1" height="1"><param name="movie" value="' + a + '"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="' + a + '" width="1" height="1" allowscriptaccess="always"></embed></object>';
        break;
    case 'IE':
        if (Browser._version >= 9) {
            open(_exit_vars.url, "_blank")
        } else if (Browser._version >= 7) {
            var a = _exit_vars.path + 'exit.swf?link=' + escape(_exit_vars.url);
            document.getElementById('exit_pop').innerHTML = '<embed src="' + a + '" autostart="true" width="1" height="1"></embed>'
        } else {
            var f = document.createElement('div');
            f.id = 'exit_pop';
            document.body.insertBefore(f, document.body.firstChild);
            document.getElementById('exit_pop').innerHTML = '<object id="iie" width="1" height="1" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6"></object>';
            iie.launchURL(_exit_vars.url)
        }
        break
    }
    window.focus()
}
function addhtml() {
    if (typeof _exit_vars.subst != "undefined" && !document.getElementById('_exit_subst')) {
        var f = document.createElement('iframe');
        f.id = '_exit_subst';
        var t = document.createElement('iframe');
        f.allowTransparency = false;
        f.frameBorder = 0;
        f.scrolling = 'yes';
        f.style.width = "100%";
        f.style.height = "100%";
        f.style.position = "absolute";
        f.style.zIndex = 99998;
        document.body.insertBefore(f, document.body.firstChild);
        var a = document.getElementById('_exit_subst');
        a.style.top = 0;
        a.style.left = 0;
        a.style.right = 0;
        a.style.bottom = 0;
        a.src = _exit_vars.subst
    }
}
function ExitPop() {
    if (isExit_ready()) {
        addhtml();
        exit();
        window.onbeforeunload = null;
        return _exit_vars.msg
    } else {}
};

function ExitPopIE() {
    if (isExit_ready()) {
        exit();
        alert(_exit_vars.alert)
    } else {}
};

function isExit_ready() {
    if (!pop) {
        disableExit();
        return false
    } else {
        tracker = gup_exit("tracker", popupURL);		
	    popupURL = popupURL.replace(tracker, tracker + '_ym_upsexit');		
        _exit_vars.url = _exit_vars.subst = popupURL;
        return true
    }
}
function disableExit() {
    pop = 0;
    switch (Browser._name) {
    case 'FF':
        window.onbeforeunload = null;
        break;
    case 'IE':
        if (Browser._version >= 9) {
            window.onbeforeunload = null
        } else if (Browser._version >= 7) {
            window.onunload = null
        } else {
            window.onbeforeunload = null
        }
        break
    }
}
Browser.detect();
if (typeof _exit_vars != 'undefined' && Browser._name != null && pop) {
    switch (Browser._name) {
    case 'FF':
        window.onbeforeunload = ExitPop;
        break;
    case 'IE':
        if (Browser._version >= 9) {
            window.onbeforeunload = ExitPop
        } else if (Browser._version >= 7) {
            var f = document.createElement('div');
            f.id = 'exit_pop';
            document.body.insertBefore(f, document.body.firstChild);
            window.attachEvent("onunload", function () {
                ExitPopIE()
            })
        } else {
            document.writeln('<SCR' + 'IPT FOR=win' + 'dow EV' + 'ENT=onbeforeunload>');
            document.writeln('return ExitPop();');
            document.writeln('</SCR' + 'IPT>')
        }
        break
    }
}
