
	var smartPopupImg = new Array(
		'/layout/standard_new/images2/Neukunde.jpg',
		'/layout/standard_new/images2/Neukunde.jpg'
		);

	var smartPopupWidth = 437;
	var smartPopupHeight = 130;
	var smartPopupWidth2 = 437;
	var smartPopupHeight2 = 130;

	// final Position
	var smartPopupEndPositionX = 442;
	var smartPopupEndPositionY = 10;

	//
	var smartPopupAnimationEventTimer = 50;
	var smartPopupAnimationCountTimer = 10;
	var smartPopupAnimationCountTimer2 = 20;

	// aktuelle Position
	var smartPopupPosition_Y = - 157;

	// temp für Animation
	var smartPopupAnimationChangeValue = 0;
	var smartPopupAnimationChangeValueDirection = 1;

	// für Close-Animation
	var tmpClosePositionX = 0.0;
	var tmpClosePositionY = 0.0;
	var tmpCloseSizeX = 0.0;
	var tmpCloseSizeY = 0.0;

	// Timer-Event
	function initSmartPopup()
	{
		// selbststartend bur bei Startseite
		var e = document.getElementById('smartPopupAuto');
		if (e)
		{
			var t = setTimeout("startSmartPopup()", 2000);
		}
	}

	function startSmartPopup()
	{
		var e = document.getElementById('smartPopup');
		if (e)
		{
			e.style.display = "block";
			smartPopupPosition_Y = - 157;
			smartPopupAnimationChangeValue = 0;
			smartPopupAnimationChangeValueDirection = 1;
			tmpClosePositionX = 0.0;
			tmpClosePositionY = 0.0;
			tmpCloseSizeX = 0.0;
			tmpCloseSizeY = 0.0;

			setElementPosition(e, smartPopupEndPositionX, smartPopupPosition_Y);
			setElementSize(e, smartPopupWidth, smartPopupHeight);

			var eImg = document.getElementById('smartPopupImg');
			if (eImg)
			{
				eImg.src = smartPopupImg[0];
				eImg.style.height = smartPopupHeight + "px";
				eImg.style.width = smartPopupWidth + "px";
				eImg.style.marginTop = "0px";
			}
			eImg = document.getElementById('smartPopupImg2');
			if (eImg)
			{
				eImg.src = smartPopupImg[1];
			}
			// Info-Button wieder einblenden
			var eInfo = document.getElementById('smartPopupInfo');
			if (eInfo)
			{
				eInfo.style.display = "block";
			}

			// Close-Button Repositionieren
			var eClose = document.getElementById('smartPopupClose');
			if (eClose)
			{
				eClose.style.marginLeft = "390px";
				eClose.style.marginTop = "-150px";
				eClose.style.width = "50px";
			}

			// erstmalig aufrufen
			smartPopupPositionAnimation();
		}
	}

	function smartPopupPositionAnimation()
	{
		var e = document.getElementById('smartPopup');
		if (e)
		{
			if (smartPopupPosition_Y >= smartPopupEndPositionY)
			{
				setElementPosition(e, smartPopupEndPositionX, smartPopupEndPositionY);
				return;
			}

			smartPopupPosition_Y += smartPopupAnimationCountTimer;
			setElementPosition(e, smartPopupEndPositionX, smartPopupPosition_Y);
			var t = setTimeout("smartPopupPositionAnimation()", smartPopupAnimationEventTimer);
		}
	}

	function setElementPosition(e, x, y)
	{
		if (e)
		{
			e.style.left = x + "px";
			e.style.top = y + "px";
		}
	}

	function setElementSize(e, x, y)
	{
		if (e)
		{
			e.style.width = x + "px";
			e.style.height = y + "px";
		}
	}

	function changeSmartPopup()
	{
		if (smartPopupAnimationChangeValue < 0)
		{
			return;
		}

		var e = document.getElementById('smartPopup');
		if (e)
		{
			if (smartPopupAnimationChangeValue > smartPopupWidth / 2)
			{
				smartPopupAnimationChangeValue = smartPopupWidth / 2;
				smartPopupAnimationChangeValueDirection = -smartPopupAnimationChangeValueDirection;

				// image auswechseln
				var eImg = document.getElementById('smartPopupImg');
				if (eImg)
				{
					eImg.src = smartPopupImg[1];
					eImg.style.height = smartPopupHeight2 + "px";
					eImg.style.marginTop = (smartPopupHeight - smartPopupHeight2) + "px";
				}

				// Info-Button ausblenden
				var eInfo = document.getElementById('smartPopupInfo');
				if (eInfo)
				{
					eInfo.style.display = "none";
				}

				// Close-Button Repositionieren
				var eClose = document.getElementById('smartPopupClose');
				if (eClose)
				{
					eClose.style.marginLeft = "270px";
					eClose.style.marginTop = "-55px";
					eClose.style.width = "170px";
				}
			}

			smartPopupAnimationChangeValue += smartPopupAnimationCountTimer2 * smartPopupAnimationChangeValueDirection;

			if (smartPopupAnimationChangeValue < 0) // letzter Durchlauf
			{
				setElementSize(e, smartPopupWidth, smartPopupHeight);
				setElementPosition(e, smartPopupEndPositionX, smartPopupEndPositionY);
			}
			else
			{
				setElementSize(e, smartPopupWidth - (smartPopupAnimationChangeValue * 2), smartPopupHeight);
				setElementPosition(e, smartPopupEndPositionX + smartPopupAnimationChangeValue, smartPopupEndPositionY);
				var t = setTimeout("changeSmartPopup()", smartPopupAnimationEventTimer);
			}
		}
	}

	function closeSmartPopup()
	{
		var e = document.getElementById('smartPopup');
		if (e)
		{
			//e.style.display = "none";
			tmpClosePositionX = smartPopupEndPositionX;
			tmpClosePositionY = smartPopupEndPositionY;
			tmpCloseSizeX = smartPopupWidth;
			tmpCloseSizeY = smartPopupHeight;

			closeSmartPopupAnimation();
		}
	}

	function closeSmartPopupAnimation()
	{
		if (tmpCloseSizeX > 0)
		{
			var e = document.getElementById('smartPopup');
			if (e)
			{
				animateToTarget(e);
				var t = setTimeout("closeSmartPopupAnimation()", smartPopupAnimationEventTimer);
			}
		}
	}

	function animateToTarget(e)
	{
		if (e)
		{
			var x = Math.round(tmpClosePositionX);
			var y = Math.round(tmpClosePositionY);
			var width = Math.round(tmpCloseSizeX);
			var height = Math.round(tmpCloseSizeY);

			setElementSize(e, width, height);
			setElementPosition(e, x, y);
			var eImg = document.getElementById('smartPopupImg');
			if (eImg)
			{
				setElementSize(eImg, width, height);
			}

			tmpClosePositionX += 7.0;
			tmpClosePositionY += 2.0;
			tmpCloseSizeX -= 38.0;
			tmpCloseSizeY -= 10.0;

			if (tmpCloseSizeX <= 0)
			{
				e.style.display = "none";
			}
		}
	}

