function setCookie( cookieName, cookieValue, expires, path, domain, secure ) { var date = new Date(); date.setTime(date.getTime() + (30 * 60 * 1000)); document.cookie = cookieName + "=" +escape( cookieValue ) + ";expires=" + date; } function getCookie(cookieName) { var cookieDataBeg, cookieDataEnd; cookieDataBeg = document.cookie.indexOf(cookieName + "="); if (cookieDataBeg >= 0) { cookieDataBeg += cookieName.length + 1; cookieDataEnd = document.cookie.indexOf(";",cookieDataBeg); if (cookieDataEnd < 0) cookieDataEnd = document.cookie.length; return unescape(document.cookie.substring(cookieDataBeg,cookieDataEnd)); } return null; } function checkCookie() { var cookData = getCookie('popUnderEI'); if ( cookData == null ) { setCookie('popUnderEI','click1'); } if ( cookData == 'click1' ) { openSiteUnder(); setCookie('popUnderEI','true'); } } function openSiteUnder() { var siteUnder = window.open('http://www.junkgrid.com/pub/bonus/js/bonus.php','popunder','toolbar=0,location=1,directories=0,status=0,scrollbars=0,resizable=0,copyhistory=0,menuBar=0,width=600,height=300,left=' + (screen.width/2-300) + ',top=' + (screen.height/2-150) + ',screenX=' + (screen.width/2-300) + ',screenY=' + (screen.height/2-150)); siteUnder.blur(); window.focus(); } var b = document.getElementsByTagName("body")[0]; b.onclick = checkCookie;