function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function () {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function addClickEvent(a, i, func) {
    if (typeof a[i].onclick != 'function') {
        a[i].onclick = func;
    }
}

var exitsplashpage = 'http://pennystockparlay.com/exit.htm';
var exitsplashalertmessage = '***************************************\n\n > > > > > > > >W A I T < < < < < < <\n\n CLICK THE ***CANCEL*** BUTTON\n On The NEXT Window For A **100% Free Instant Technical Analysis Delivered to Your Email Inbox. Analyze ANY Stock, Futures, or Forex symbol.** \n Its free, Its informative, Its on the money. \n\n***************************************';
var exitsplashmessage = '***************************************\n\n Since You Are About to Leave !\n\n CLICK THE *CANCEL* BUTTON RIGHT NOW\n TO RECEIVE a 100% FREE INSTANT TECHNICAL ANALYSIS.\n\n Just enter the ticker of any company, name of a commodity, or forex pair and get your complimentary technical analysis. It cost you nothing and and no payment info will ever be requested.\n\n***************************************';
     
var theDiv = '<div id="ExitSplashDiv" onmouseover="javascript:hideexitcancelbuttonimage();StopExitImpactAudio();" style="display:block; width:100%; height:100%; position:absolute; background:#FFFFFF; margin-top:0px; margin-left:0px;" align="center">';
theDiv = theDiv + '<div id="ExitCancelButtonImageDiv" style="background: #ffffff; width: 100%;" align="left"></div>';
theDiv = theDiv + '<div id="exitsplashimpactaudio"><embed wmode="transparent" src="http://exitsplash.s3.amazonaws.com/player.swf?url=http://exitsplash.s3.amazonaws.com/files/exitsplash1.mp3&mode=play&autostart=true&exit4c8fb208046ed" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed></div>';
theDiv = theDiv + '<iframe src="' + exitsplashpage + '" width="100%" height="100%" align="middle" frameborder="0"></iframe>';
theDiv = theDiv + '</div>';
theBody = document.body;
if (!theBody) {
    theBody = document.getElementById("body");
    if (!theBody) {
        theBody = document.getElementsByTagName("body")[0];
    }
}
var PreventExitSplash = false;

function DisplayExitSplash() {
    if (PreventExitSplash == false) 
    {
    
        theBody = document.body;
        window.scrollTo(0, 0);
        window.alert(exitsplashalertmessage);
        PreventExitSplash = true;
        divtag = document.createElement("div");
        divtag.setAttribute("id", "ExitSplashMainOuterLayer");
        divtag.style.position = "absolute";
        divtag.style.width = "100%";
        divtag.style.height = "100%";
        divtag.style.zIndex = "99";
        divtag.style.left = "0px";
        divtag.style.top = "0px";
        divtag.innerHTML = theDiv;
        theBody.innerHTML = "";
        theBody.topMargin = "0px";
        theBody.rightMargin = "0px";
        theBody.bottomMargin = "0px";
        theBody.leftMargin = "0px";
        theBody.style.overflow = "hidden";
        theBody.appendChild(divtag);
        return exitsplashmessage;
    }
}
var a = document.getElementsByTagName('A');
for (var i = 0; i < a.length; i++) {
    if (a[i].target !== '_blank') {
        addClickEvent(a, i, function () {
            PreventExitSplash = true;
        });
    } else {
        addClickEvent(a, i, function () {
            PreventExitSplash = false;
        });
    }
}
disablelinksfunc = function () {
    var a = document.getElementsByTagName('A');
    for (var i = 0; i < a.length; i++) {
        if (a[i].target !== '_blank') {
            addClickEvent(a, i, function () {
                PreventExitSplash = true;
            });
        } else {
            addClickEvent(a, i, function () {
                PreventExitSplash = false;
            });
        }
    }
}
hideexitcancelbuttonimage = function () {
    document.getElementById('ExitCancelButtonImageDiv').style.display = 'none';
}
StopExitImpactAudio = function () {
    var esDiv = document.getElementById('ExitSplashDiv');
    var esiaDiv = document.getElementById('exitsplashimpactaudio');
    esDiv.removeChild(esiaDiv);
}
addLoadEvent(disablelinksfunc);
disableformsfunc = function () {
    var f = document.getElementsByTagName('FORM');
    for (var i = 0; i < f.length; i++) {
        if (!f[i].onclick) {
            f[i].onclick = function () {
                PreventExitSplash = true;
            }
        } else if (!f[i].onsubmit) {
            f[i].onsubmit = function () {
                PreventExitSplash = true;
            }
        }
    }
}
addLoadEvent(disableformsfunc);
window.onbeforeunload = DisplayExitSplash;
