
// CONFIGURATION VARIABLES
var siteName = "GSRS";
var newLocation = "http://gameshowroadshow.com/home.shtm";

// GET THE EXPIRATION DATE
var expires = new Date();
expires.setTime(expires.getTime() + 24 * 60 * 60 * 30 * 500);
var expiryDate = expires.toGMTString();
var cookieFound = false;

// SET THE COOKIE FOR THE PAGE
function newCookie(name, value) {
	document.cookie = name + "=" + value + "; expires=" + expiryDate;
}
	
function getCookie(name) {
	var start = 0;
	var end = 0;
	var cookieString = document.cookie;
	
	var i = 0;
	
	// SCAN THE COOKIE FOR name
	while (i <= cookieString.length) {
		start = i;
		end = start + name.length;
		if (cookieString.substring(start, end) == name) {
		   	cookieFound = true;
			break;
		}
		i++;
	}
}

getCookie(siteName);
	
// IS name FOUND?
if (cookieFound) {
  	window.top.location = newLocation;
}
else {
	newCookie(siteName, "true");
}

