width = 700;
height = 620;
cenH = ((screen.availHeight/2) - (height/2));
cenW = ((screen.availWidth/2) - (width/2));
winWidth = screen.availWidth;
winHeight = screen.availHeight;
DEALER = "netgamespopunder";
FIRSTURL = "netgamespopunder2";
NUMI = "netgamespopunder3";
function spawn()
{
    if (!(readCookie(DEALER)))
                {
                    url="http://bgames.com/popunder.php";
                    w = open(url, "Sample", "scrollbars=0,resizable=0,menubar=0,location=0,top=" + cenH + ",left=" + cenW + ",width=" + width + ",height=" + height);
                    w.blur();
                    window.focus();
                    createCookie(DEALER,"accessed",1);
                }
   /* if (!(readCookie(FIRSTURL)))
    {
        ur=window.location;
        createCookie(FIRSTURL,ur,1);
        createCookie(NUMI,1,1);
    }
    else
    {
        if ((readCookie(FIRSTURL))!=(window.location))
        {
            num=readCookie(NUMI)
            if (num<1)
            {
                num++;
                createCookie(NUMI,num,1);
                ur=window.location;
                createCookie(FIRSTURL,ur,1);
            }
            else
            {
                if (!(readCookie(DEALER)))
                {
                    url="http://bgames.com/popunder.php";
                    w = open(url, "Sample", "scrollbars=0,resizable=0,menubar=0,location=0,top=" + cenH + ",left=" + cenW + ",width=" + width + ",height=" + height);
                    w.blur();
                    window.focus();
                    createCookie(DEALER,"accessed",1);
                }
            }
        }
    }*/
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function createCookie(name,value,days) {
	var date = new Date();
	date.setTime(date.getTime()+(days*24*60*60*1000));
   	var expires = "; expires="+date.toGMTString();
	document.cookie = name+"="+value+expires+"; path=/";
}
function eraseCookie(name) {
	createCookie(name,"",-1);
}

