var expDays = 1; // number of days the cookie should last

var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function FixCookieDate(date){var base=new Date(0);var skew=base.getTime();if(skew>0) date.setTime(date.getTime()-skew);}
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 getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if (endstr==-1)endstr=document.cookie.length;return unescape(document.cookie.substring(offset, endstr));}
function SetCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+((expires)?";expires="+expires.toGMTString():"")+((path)?"; path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"");}
function DeleteCookie(name,path,domain){if (GetCookie(name)){document.cookie=name+"="+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+";expires=Thu, 01-Jan-70 00:00:01 GMT";}}

function weekly500(){
	var count = GetCookie('count');
	if (count == null){
		SetCookie('count', 1, exp);
		self.focus();

		var SplitPopup = "pop500/win_vegas.htm";
		xPopSplitPopup=0;
		yPopSplitPopup=0;
		SplitPopupHeight=310;
		SplitPopupWidth=402;
		nn=(document.layers)?true:false;
		inheight=(nn)?window.innerHeight:document.body.clientHeight;
		inwidth=(nn)?window.innerWidth:document.body.clientWidth;
		xPopSplitPopup=(inwidth/2)-(SplitPopupWidth/2);
		yPopSplitPopup=(inheight/2)-(SplitPopupHeight/2)+40;
		var SplitPopupWindowProps = "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,width="+SplitPopupWidth+",height="+SplitPopupHeight+",left="+xPopSplitPopup+",top="+yPopSplitPopup+",screenX="+xPopSplitPopup+",screenY="+yPopSplitPopup;
		window.open(SplitPopup, "SplitPopup_Contest", SplitPopupWindowProps);

	}else{
		count++;
		SetCookie('count', count, exp);
	}
}
