var imgWait;
var waitWindow;
var waitIframe;

function preLoad() {
	imgWait = new Image();
	imgWait.src = "/_images/wait30trans.gif";
}

function popupWait() {
	var width = 300;
	var height = 150;
	waitWindow = document.createElement("div");
	waitWindow.className = "wait";

	var x_pos = 0;
	var y_pos = 0;
	js_popup.functions.init();
	js_popup.controls.boxWidth = width;
	js_popup.controls.boxHeight = height;

	// zentrierte Position der Box errechnen
	if (window.innerWidth) {
		x_pos = Math
				.ceil((js_popup.controls.winInnerWidth - js_popup.controls.boxWidth)
						/ 2 + window.pageXOffset);
		y_pos = Math
				.ceil((js_popup.controls.winInnerHeight - js_popup.controls.boxHeight)
						/ 2 + window.pageYOffset);
	} else {
		x_pos = Math
				.ceil((js_popup.controls.winInnerWidth - js_popup.controls.boxWidth)
						/ 2 + js_popup.IE.scrollLeft);
		y_pos = Math
				.ceil((js_popup.controls.winInnerHeight - js_popup.controls.boxHeight)
						/ 2 + js_popup.IE.scrollTop);
	}

	// Padding berücksichtigen
	x_pos -= 15;
	y_pos -= 15;

	// übergroßes Bild? -> in Linke obere Ecke positionieren
	if (x_pos < 0)
		x_pos = 0;
	if (y_pos < 0)
		y_pos = 0;

	waitWindow.style.left = x_pos + "px";
	waitWindow.style.top = y_pos + "px";
	waitWindow.style.height = height + "px";
	waitWindow.style.width = width + "px";

	waitWindow.innerHTML = '<div style="margin-top:30px; font-weight:bold;" align="center"><b>Bitte warten Sie einen Moment.<br/>'
			+ 'Die Daten werden geladen...</b></div><div style="margin-top:30px;" align="center">'
			+ '<img src="/_images/wait30trans.gif" border="0" width="30" height="30" id="_wWimG_"/>'
			+ '<script type="text/javascript">'
			+ 'document._wWimG_.src = imgWait.src;' + '</script></div>';
	var b = document.getElementsByTagName("body")[0];
	waitIframe = document.getElementById("_popupIfr_");
	waitIframe.style.left = x_pos + "px";
	waitIframe.style.top = y_pos + "px";
	waitIframe.style.height = height + "px";
	waitIframe.style.width = width + "px";
	waitIframe.style.display = "block";
	b.appendChild(waitWindow);
	return true;
}

function waitOff() {
	if (waitWindow)
		waitWindow.parentNode.removeChild(waitWindow);
	if (waitIframe)
		waitIframe.style.display = 'none';
	waitWindow = void 0;
	waitIframe = void 0;
}

preLoad();
waitOff();

