A working popunder script

This is a working popunder script I wrote some time ago. It’s a mash-up from popular scripts usually found on spammy websites.
It launches a new window under the active window. The user needs to click a link on your page or a click anywhere on the page. javascript “onload” doesn’t work anymore these day with all the advanced popupblocker and no-script addons available. You need to add onclick=”init();” to the body tag to make it work (or in any other html tag).

Like I said, I mashed up different pieces of codes, but I kept the original init(); function intact. I could have renamed and written it to something of my own. But wanted to keep credit to the original coder(s).

Please leave me a message for good luck!

 
//Go Down has been rewritten and renamed by Digitalux, Michiel Ebberink, 2011 
//Portions of this code were originally from 'The perect pop up' by Ian Lloyd, Nathan Jones and Chris Whitlock.
//Do not just copy paste without permission of the rightful owners.
 
 
// Go Down script
var WinLoaded = false;
 
function goDown(url) {
    if (WinLoaded === true) {
        return true;
    }
    winWidth = screen.availWidth;
    winHeight = screen.availHeight;
    strleft = 500 - screen.availWidth;
    var inputsize = "";
    inputsize = "resizable,toolbar=no,location=no,scrollbars=yes,width=" + winWidth + ",height=" + winHeight + ",left=-5000,top=0";
    var win = window.open(url, "newwindow", inputsize);
    if (win) {
        win.blur();
        WinLoaded = true;
    }
    setTimeout(function () {
        return win;
    }, 4000);
}
 
function init() {
    if (get_cookie('popout') == '') {
        var win = goDown('http://www.example.com'); // set your url here
        var today = new Date();
        today.setTime(today.getTime());
        expires = 60 * 60 * 24;
        var expires_date = new Date(today.getTime() + (expires));
        document.cookie = "popout=yes;expires=" + expires_date.toGMTString()
    }
}
 
function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search)
        if (offset != -1) {
            offset += search.length
            end = document.cookie.indexOf(";", offset);
            if (end == -1) end = document.cookie.length;
            returnvalue = unescape(document.cookie.substring(offset, end))
        }
    }
    return returnvalue;
}
window.onclick = function () {
 
    init();
}
 
// End Go Down script