function empvOverlay(strUrlCPI, strIdentifier)
{
	this.display = function(nOffSetX, nOffSetY, nWidth, nHeight)
	{
		/* Check if cookie is set enabled */
		if( this.cookieExists() )
			return;
		
		/* Write overlay */
		document.write("	<style type=\"text/css\" rel=\"stylesheet\">																				");
		document.write("		.empvOverlayOuter																											");
		document.write("		{																														");
		document.write("			margin: 0 0 0 -"+(nWidth/2)+"px;																										");
		document.write("			padding: 10px;																										");
		document.write("			height: auto;																										");
		document.write("			width: auto;																										");
		
		document.write("			z-index: 3000;																										");
		document.write("																																");
		document.write("			position: absolute;																									");
		document.write("			top: " + nOffSetY + "px;																							");
		document.write("			left: 50%;																							");
		document.write("																																");
		document.write("			\/* Mozilla ignores crazy MS image filters, so it will skip the following *\/										");
		document.write("			filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='http://perfekt-schlafen.emp-mail.net/cst/414/static/50p_black.png');	");
		document.write("		}																														");
		
		document.write("		.empvOverlayOuter[class]																									");
		document.write("		{																														");
		document.write("			\/* IE ignores styles with [attributes], so it will skip the following. *\/											");
		document.write("			background-image: url('http://perfekt-schlafen.emp-mail.net/cst/414/static/50p_black.png');																	");
		document.write("		}																														");
		
		document.write("		.empvOverlayInner																											");
		document.write("		{																														");
		document.write("			margin: 0px;																										");
		document.write("			padding: 5px;																										");
		document.write("			height: auto;																										");
		document.write("			background-color: #fff;																								");
		document.write("		}																														");
		
		document.write("		p																														");
		document.write("		{																														");
		document.write("			margin: 5px;																										");
		document.write("			padding: 0px;																										");
		document.write("		}																														");
		
		document.write("		iframe																													");
		document.write("		{																														");
		document.write("			border: none;																										");
		document.write("			position: relative;																									");
		document.write("			top: 5px;																											");
		document.write("			left: 0px;																											");
		document.write("			width: " + nWidth + "px;																							");
		document.write("			height: " + nHeight + "px;																							");
		document.write("		}																														");
		document.write("	<\/style>																													");
		
		document.write("	<div id=\"empvOverlayOuter\" class=\"empvOverlayOuter\">																		");
		document.write("		<div id=\"empvOverlayInner\" class=\"empvOverlayInner\">																	");
		document.write("			<p align=\"right\"><a href=\"#\" onclick=\"closeOverlay()\"><img src=\"http://perfekt-schlafen.emp-mail.net/cst/414/static/btn_close.gif\" alt=\"Schliessen\" border=\"0\" \/></a><\/p>	");
		document.write("			<iframe src=\"" + strUrlCPI + "\" id=\"empvOverlayFrame\" scrolling=\"no\" frameborder=\"0\"><\/iframe>				");
		document.write("		<\/div>																													");
		document.write("	<\/div>																														");
	}

	this.setCookie = function(nTimeToLive)
	{
		/* Expire date */
		var pExpireDate = new Date();
		
		/* Update date - cookie will be deactivated automatically */
		pExpireDate.setTime( pExpireDate.getTime() + (nTimeToLive * 60 * 1000) );
		
		/* Set cookie if not done before */
		if( !this.cookieExists() )
			document.cookie = "Name=" + strIdentifier + "; expires=" + pExpireDate.toGMTString();
	}

	this.deleteCookie = function()
	{
		/* Expire date */
		var pExpireDate = new Date();
		
		/* Set cookie if actual one exists */
		if( this.cookieExists() )
			document.cookie = "Name=" + strIdentifier + "; expires=" + pExpireDate.toGMTString();
	}

	this.cookieExists = function()
	{
		/* Check cookie information */
		if( document.cookie )
		{
			var strCookie = document.cookie;
			var pCookieInfo = strCookie.split(";");
			for( i=0; i<pCookieInfo.length; i++ )
			{
				var setInformation = pCookieInfo[i].split("=");
	
				if( setInformation[0].replace (/^\s+/, '').replace (/\s+$/, '') == "Name" && setInformation[1] == strIdentifier )
					return true;
			}
		}
		return false;
	}
}

function closeOverlay()
{
	document.getElementById("empvOverlayOuter").style.visibility='hidden';
}

