// JavaScript Document

function aPromoPopupOnClick() {
	document.getElementById("divPromoPopup").style.display = "none";
	var now = new Date();
	var expTime = new Date(
		now.getFullYear(), 
		now.getMonth(),
		now.getDate(),
		now.getHours(),
		now.getMinutes() + 3,
		now.getSeconds(),
		0
	);
	var expStr = expTime.toLocaleString();
	document.cookie = "promo=" + expStr; // + "; expires=" + expStr;	
}

function showPromo() {
	var now = new Date();
	expStr = getCookie("promo");
	if(expStr) {
		var expTime = new Date(expStr);
		if(now < expTime)
			return;
	} 
	document.getElementById("divPromoPopup").style.display = "block";
}

function getCookie(name) {
	var cookies = document.cookie.split(";");
	for(i = 0; i < cookies.length; i++) 
		if(cookies[i].substr(0, cookies[i].indexOf("=")).trim() == name)
			return cookies[i].substr(cookies[i].indexOf("=") + 1);
	return false;
}
