function cookiesEnabled() {
	document.cookie = "TempTestCookie=yes;path=/";
	if(document.cookie.indexOf("TempTestCookie=") == -1) {
		return false;
	} else {
		return true;
	}
}

function shouldDisplayPopup() {
	if (!cookiesEnabled()) {
		return false;
	}
	var cookieName = "lastvisited";
	if (document.cookie.length > 0) {
		index = document.cookie.indexOf(cookieName + '=');
		if (index > 0) {
			return false;
		}
	}

	var now = new Date();
	var expires = new Date();
	expires.setDate(now.getDate() + 14); // expire cookie in 14 days time

	document.cookie=cookieName+'='+now.toUTCString()+";expires="+expires.toUTCString()+";path=/";
	return true;
}

function showPopup() {
	if (shouldDisplayPopup()) {
		var signupFormId = "hiddenSignupForm";
		var caption = "Sign up for our newsletter!";
		var width = "400";
		var height = "450";

		var fullURL =  "#TB_inline?height=" + height + "&width=" + width + "&inlineId=" + signupFormId + "&modal=true";
		setTimeout('TB_show("'+caption+'", "'+fullURL+'", null)',5000);
	}
	return false;
}
