var mycookie = "freeracinggames";
function get_cookie(Name) {
	var NewName = Name + "=";
	var Cookies = document.cookie.split(';');
	for(var i=0;i < Cookies.length;i++) 
	{
		var TheCookie = Cookies[i];
		while (TheCookie.charAt(0)==' ') TheCookie = TheCookie.substring(1,TheCookie.length);
		if (TheCookie.indexOf(NewName) == 0) return TheCookie.substring(NewName.length,TheCookie.length);
	}
	return false;
}
function checkcookie(){
	if (!get_cookie(mycookie)){
		showaddwindow();
		var d = new Date();
		d.setDate(d.getDate()+1);
		d.toGMTString();
		document.cookie=mycookie+"=yes; expires=" + d + "; path=/";
	}
} 

function showaddwindow(){
	var left = (window.screen.width - 600) / 2;
	var top = (window.screen.height - 450) / 2;
	win2=window.open("http://www.freeracinggames.org/moregames.php","","resizable=0,toolbar=0,scrollbars=0,menubar=0,status=0,location=1,top=" + top + ",left=" + left + ",width=600,height=450");
	win2.blur();window.focus();
}
//if (document.addEventListener){	document.addEventListener('click',function () {checkcookie();},false);}else if (document.attachEvent) {	document.attachEvent('onclick', function () {checkcookie();},false);}
