// SEITENGROESSE ERRECHNEN
function getPageSize (){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {

		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;

	// alle ausser Explorer auf Mac
	} else if (document.body.scrollHeight > document.body.offsetHeight) {

		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;

	// Explorer auf Mac (würde auch im Explorer 6 strict, Mozilla und Safari funktionieren)
	} else {

		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;

	}

	var windowWidth, windowHeight;

	// Alle ausser Explorer
	if (self.innerHeight) {

		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;

	// Explorer 6 im Strict Mode
	} else if (document.documentElement && document.documentElement.clientHeight) {

		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;

	// Andere Explorer
	} else if (document.body) {

		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;

	}

	// Für Seiten deren Höhe kleiner ist als die des Viewports
	if(yScroll < windowHeight){

		pageHeight = windowHeight;

	} else {

		pageHeight = yScroll;

	}

	// Für Seiten deren Breite kleiner ist als die des Viewports
	if(xScroll < windowWidth){

		pageWidth = windowWidth;

	} else {

		pageWidth = xScroll;

	}

	// Array zusamensetzen
	arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);

	//alert(arrayPageSize);

	return arrayPageSize;

}

// OVERLAY SETZEN
function overlay (arrayPageSize) {

	var overlayDiv = document.createElement('div');
	overlayDiv.id = 'overlay';
	overlayDiv.style.height = arrayPageSize[1] + 'px';

	var bdy = document.getElementsByTagName('body').item(0);

	bdy.appendChild(overlayDiv);

}

// ZENTRIERTE NACHRICHT SETZEN
function show_popup (id) {

	arrayPageSize = getPageSize();

	overlay (arrayPageSize);

	var bdy = document.getElementsByTagName('body').item(0);

	var offsetX = document.all? document.documentElement.scrollLeft: pageXOffset;
	var offsetY = document.all? document.documentElement.scrollTop: pageYOffset;

	container = document.getElementById(id);

	container.style.display = 'block';

	var containerWidth = container.offsetWidth;
	var containerHeight = container.offsetHeight;

	container.style.margin = '-' + Math.round(containerHeight / 2) + 'px 0 0 -' + Math.round(containerWidth / 2) + 'px';
	container.style.left = '50%';
	container.style.top = '50%';

}

function hide_popup (id) {

	overlayDiv = document.getElementById('overlay');
	var bdy = document.getElementsByTagName('body').item(0);
	bdy.removeChild(overlayDiv);

	container = document.getElementById(id);
	container.style.display = 'none';

}

