<!--

/**
 * Enthält JavaScript-Funktionen für Formulare
 * @author  $Author: SEBER-RIDER $
 * @version $Revision: 56 $
 * @date    $Date: 2009-09-24 17:50:20 +0200 (Do, 24. Sep 2009) $
 */

	/**
	 * Popup-Fenster wird nicht mehr als neues Browserfenster, sondern als überlagernder DIV-Tag realisiert
	 * @ param		string		sHref				die URI, die den Inhalt des Popups bildet;				Standard: ---;		Status: obligatorisch;
	 * @ param		string		sOverlayParameter		Parameter, mit denen der Overlay-Focus gesteuert wird;			Standard: ---;		Status: obligatorisch;
 	 */
	function NewPopup(sHref, iWidth, iHeight, sTitle, sSubtitle, sOverlayParameter) {
		sDimensions								 = (iWidth && iHeight)	? ' width="' + iWidth + '" height="' + iHeight + '"' : '';

		sInjection								 = '<div class="NewPopupVerticalCenterer"></div><div id="NewPopupContainer" class="NewPopupContainer"><div class="NewPopupImage">';
		sInjection								+= (sTitle)		? '<div class="NewPopupTitle"><h1>' + sTitle + '</h1></div>' : '';
		sInjection								+= '<img src="' + sHref + '"' + sDimensions + '>';
//		sInjection								+= (sOverlayParameter)	? '<div class="NewPopupOverlayContainer"><div class="NewPopupOverlayDestroyer" onClick="window.document.getElementById(\'NewPopupOverlayContainer\').style.display = \'none\';">Focusrahmen entfernen</div><div class="NewPopupOverlayBox" style="' + sOverlayParameter + ' background-image: url(\'' + sHref + '\');">&#x200B;</div></div>' : '';
		sInjection								+= (sOverlayParameter)	? '<div class="NewPopupOverlayContainer"><div class="NewPopupOverlayBox" style="' + sOverlayParameter + ' background-image: url(\'' + sHref + '\');">&#x200B;</div></div>' : '';
		sInjection								+= (sSubtitle)		? '<div class="NewPopupSubtitle">' + sSubtitle + '</div>' : '';
		sInjection								+= '</div></div>';

		window.document.getElementById('ScreenshotPopup').innerHTML		 = sInjection;
		window.document.getElementById('ScreenshotPopup').style.display		 = 'block';
		window.document.getElementById('NewPopupContainer').style.marginTop	 = '-' + (window.document.getElementById('NewPopupContainer').offsetHeight / 2) + 'px';

		return false;
	}



	/**
	 * Alert-Fenster wird nicht mehr als Dialogfenster, sondern als überlagernder DIV-Tag realisiert
	 * @ param		string		sText			der Meldungstext;		Standard: ---;		Status: obligatorisch;
	 * @ param		string		sTitle			der Meldungstitel;		Standard: ---;		Status: optional;
 	 */
	function NewAlert(sText, sTitle, oObjectToFocus) {
		sTitle									 = sTitle || sJsNewAlertStandardTitle;
		sInjection								 = '<div class="NewAlertVerticalCenterer"></div><div id="NewAlertContainer" class="NewAlertContainer"><div class="NewAlertBox"><h1 class="NewAlertTitle">' + sTitle + '</h1><div class="NewAlertText">' + sText + '<span class="NewAlertConfirmation"';
		sInjection								+= (oObjectToFocus) ? ' onClick="oObjectToFocus.focus();"' : '';
		sInjection								+= '>OK</span><div style="clear: both;"></div></div></div></div>';

		window.document.getElementById('ScreenshotPopup').innerHTML		 = sInjection;
		window.document.getElementById('ScreenshotPopup').style.display		 = 'block';
		window.document.getElementById('NewAlertContainer').style.marginTop	 = '-' + (window.document.getElementById('NewAlertContainer').offsetHeight / 2) + 'px';

		return false;
	}



	function Popup(sHref, iDeliveredWidth, iDeliveredHeight, sWindowName) {
		/* Funktion öffnet ein Fenster, in dem ein kleines Kontaktformular angezeigt wird.
		return false; darf nicht vergessen werden, damit nicht zusätzlich dem
		href gefolgt wird.

		Aufruf der Funktion durch:
		<a href="..." target="_blank" onClick="Popup(this.href, 640, 480); return false;" ...>
		*/

		sWindowName = sWindowName || 'Window';

		aPositions = PositionAtCenter(iDeliveredWidth, iDeliveredHeight);

		sParameter = 'width=' + iDeliveredWidth + ', height=' + iDeliveredHeight + ', top=' + aPositions[0] + ', left=' + aPositions[1] + ' scrollbars=yes, resizable=yes';
			// Ein Fenstername wurde vergeben, damit nicht mehrere Formmailer gleichzeitig geöffnet werden.
		oPopup     = window.open(sHref, sWindowName, sParameter);
		oPopup.focus();
	}



iScreenAvailWidth  = screen.availWidth;
iScreenAvailHeight = screen.availHeight;

	function FotoPopup(sHref, iDeliveredWidth, iDeliveredHeight, sTitle, sSubtitle) {
		/* Funktion öffnet ein Fenster, in dem ein Screenshot angezeigt wird.
		return false; darf nicht vergessen werden, damit nicht zusätzlich dem
		href gefolgt wird.

		Aufruf der Funktion durch:
		<a href="..." target="_blank" onClick="FotoPopup(this.href, 640, 480); return false;" ...>
		*/

		ResizeWindow(iDeliveredWidth, iDeliveredHeight, false);
		oFotoFenster = window.open('fotopopup.php?File=' + sHref + '&Title=' + sTitle + '&Subtitle=' + sSubtitle, '_blank', 'width=' + iPopupWidth + ', height=' + iPopupHeight + ', scrollbars=yes, resizable=yes');
		oFotoFenster.focus();

		//alert('iScreenWidth:\t' + iScreenWidth + '\n' + 'iScreenHeight:\t' + iScreenHeight + '\n\n' + 'iDeliveredWidth:\t' + iDeliveredWidth + '\n' + 'iDeliveredHeight:\t' + iDeliveredHeight + '\n\n' + 'iPopupWidth:\t' + iPopupWidth + '\n' + 'iPopupHeight:\t' + iPopupHeight);
	}



	function ResizeWindow(iDeliveredWidth, iDeliveredHeight, bDoResizeWindow) {
		iDistanceToLeftBorder   = 20;
		iDistanceToBottomBorder = 20;
		iDeliveredWidth         = iDeliveredWidth  || 640;
		iDeliveredHeight        = iDeliveredHeight || 680;

		iPopupWidth             = (iDeliveredWidth  < iScreenAvailWidth  - iDistanceToLeftBorder)   ? iDeliveredWidth  : iScreenAvailWidth  - iDistanceToLeftBorder;
		iPopupHeight            = (iDeliveredHeight < iScreenAvailHeight - iDistanceToBottomBorder) ? iDeliveredHeight : iScreenAvailHeight - iDistanceToBottomBorder;

		if(bDoResizeWindow != false) {
			window.moveTo(iDistanceToLeftBorder / 2, iDistanceToBottomBorder / 2);
			window.resizeTo(iPopupWidth, iPopupHeight);
		}
	}

-->
