function SetACPopups( state){
	if (state == null) 
		state = "true";
	 else 
		state = state.toLowerCase();
	if ((state == "yes") || (state == "true") || (state == "on") || (state == "enable"))
		state = "true";
	SetCookie("ACPopUps", state, PopupEnableExpireTime());
	return (state == "true");
}	 

function PopupExpireTime(){
	var time = new Date();
	time.setTime(time.getTime() +(7 * 24 * 60 * 60 * 1000 ));		// 7 day
	//time.setTime(time.getTime() +(15 *1000));		//15 seconds
	return time;
}

function PopupEnableExpireTime(){
	var time = new Date();
	time.setTime(time.getTime() +(2 * 7 *24 * 60 * 60 * 1000 ));		// 14 day
	//time.setTime(time.getTime() +(30 *1000));		//30 seconds
	return time;
}

function GetACPopups(){
	var state = GetCookie("ACPopUps");
	if (state == null)
		return SetACPopups("true");
	state = state.toLowerCase();
	if ((state == "yes") || (state == "true") || (state == "on") || (state == "enable"))
		state = "true";
	return (state == "true");
}	
	
function ACCookiePopup(popupName){
	var seenPopup = GetCookie(popupName );
	var hasSeenPopup = (seenPopup != null);
	var popUpsEnabled = GetACPopups();
	if (!hasSeenPopup)  {
		if (popUpsEnabled){
			SetCookie(popupName , "true", PopupExpireTime());
			window.open ("Splash.html", "newSplash", "scrollbars=no,status=no,width=610,height=270");
		}
	} 
	return hasSeenPopup;
}

function EnableACPopups(){
	SetACPopups("on");
	alert("AC Popups enabled");
}

function DisableACPopups(){
	SetACPopups("off");
	alert("AC Popups disabled");
}