
var expDays = 40; // number of days the cookie should last
var arrPage=new Array();
var Leaving;
arrPage[1]= "http://www.betmaker.com/index.asp?BannerId=10410";
arrPage[2]= "http://www.betmaker.com/index.asp?BannerId=10410";
arrPage[3]= "http://www.betmaker.com/index.asp?BannerId=10410";
arrPage[4]= "http://www.7palms.com/index.asp?BannerId=10431";
arrPage[5]= "http://www.7palms.com/index.asp?BannerId=10431";
arrPage[6]= "http://www.bookmaker.com/index.asp?BannerId=10441";
arrPage[7]= "http://www.7palms.com/index.asp?BannerId=10431";
arrPage[8]= "http://www.goldmedalsports.com/index.asp?BannerId=10420";


	
var visits=0;
var windowprops = "width=600,height=400,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";

function getCookieVal (offset) 
   {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
      endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
   }
function GetCookie (name) 
   {
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) 
      {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) 
         break; 
      }
   return null;
   }
function SetCookie (name, value) 
   {
   var argv = SetCookie.arguments;
   var argc = SetCookie.arguments.length;
   var expires = (2 < argc) ? argv[2] : null;
   var path = (3 < argc) ? argv[3] : null;
   var domain = (4 < argc) ? argv[4] : null;
   var secure = (5 < argc) ? argv[5] : false;
   document.cookie = name + "=" + escape (value) +
     ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
     ((path == null) ? "" : ("; path=" + path)) +
     ((domain == null) ? "" : ("; domain=" + domain)) +
 ((secure == true) ? "; secure" : "");
   }

function insertCounter() {
var expdate = new Date();
expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 30)); 
if(!(visits = GetCookie("visits"))) 
   visits = 0;
if (parseInt(visits) ==arrPage.length -1)
	visits=0;
visits++;


SetCookie("visits", visits, expdate, "/", null, false);
 displayCounter()
}
function displayCounter() {
if(Leaving==true){
	window.open (arrPage[visits],"Publicity",windowprops);
   
	this.focus();
	}
 }
// -->

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function CheckKey(k){
	if((k==8) || (k==116))
	{
		Leaving=false;
	}
}
