var showpopup="yes"; document.cookie = "Cookies=ON"; function rnd() { rnd.seed = (rnd.seed*9301+49297) % 233280; return rnd.seed/(233280.0); } function rand() { return Math.ceil(rnd()*10); // PART B } function setCookie(name, value, expires, path, domain, secure) { var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } function getCookie(name) { // use: getCookie("name"); var index = document.cookie.indexOf(name + "="); if (index == -1) return null; index = document.cookie.indexOf("=", index) + 1; var endstr = document.cookie.indexOf(";", index); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(index, endstr)); } var today = new Date(); var thedate = new Date(); thedate.setTime(today.getTime() + (2*60*1000)); if (window.name=="tzapexchbottom") { // If we are here, we are inside the frame setCookie('seentzappopup', 'yes', thedate); } else { // If we are here, we are NOT in the frame if (document.cookie != '') { // Cookie found. This user has cookies turned on if ( getCookie('seentzappopup') == 'yes' ) { // Read the cookie and seentzappopup=yes showpopup="no"; // WE CAN TURN COOKIES OFF WITH yes } else { // Just setting the cookie. Now seentzappopup = yes setCookie('seentzappopup', 'yes', thedate); showpopup="yes"; } } else { // if user has cookies turned OFF, randomly show ad 1 out of 10 times (A out of B) rnd.today=new Date(); rnd.seed=rnd.today.getTime(); // Use 1 for 1 in 10. Switch it to 10 for all the time. if (rand() <= 1 ) { // Rand pick is telling us to show a popup showpopup="yes"; } else { // Rand pick is telling us NOT to show a popup showpopup="no"; } } if (showpopup == "yes") { // show a popup but go check if IP in the dbase // sending to exit2.php?id=$id document.write (''); } else { // No Popup To Be Shown } }