function getCookieValue(cookieName)
{
	var cookieValue = document.cookie;
	var cookieStartsAt = cookieValue.indexOf(" " + cookieName + "=");
	if (cookieStartsAt == -1)
	{
		cookieStartsAt = cookieValue.indexOf(cookieName + "=");
	}
		
	if (cookieStartsAt == -1)
	{
		cookieValue = null;
	}
	else
	{
		cookieStartsAt = cookieValue.indexOf("=", cookieStartsAt) + 1;
		var cookieEndsAt = cookieValue.indexOf(";", cookieStartsAt);
		if (cookieEndsAt == -1)
		{
			cookieEndsAt = cookieValue.length;
		}
		cookieValue = unescape(cookieValue.substring(cookieStartsAt, cookieEndsAt));
	}
	return cookieValue;
}
	
function leavePopUp()
{
	var registerCookie = getCookieValue("PopAd");
	if (registerCookie == null)
	{
		//Show the popup
		var width = 450;
		var height = 500;
		var left = (screen.width / 2) - (width / 2);
		var top = (screen.height / 2) - (height / 2);
		var lPopUp = window.open("/popup_newsletter.html", 'lPopUp','width=' + width + ', height=' + height + ', left=' + left + ', top=' + top + ', resizable');
		lPopUp.blur();
	}
}

function openPop(url,winName,width,height)
{
	var left = (screen.width/2) - (width/2);
	var top = (screen.height/2) - (height/2);
	var popWin = window.open(url, winName, 'left=' + left + ', top=' + top + ', width=' + width + ', height=' + height + ', scrollbars, resizable');
}
