function getViewportSize() {
	var box = new Object();
	box.x = "[unbekannt]";
	box.y = "[unbekannt]";
	if (self.innerHeight) {
		box.x = self.innerWidth;
		box.y = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		box.x = document.documentElement.clientWidth;
		box.y = document.documentElement.clientHeight;
	} else if (document.body) {
		box.x = document.body.clientWidth;
		box.y = document.body.clientHeight;
	}
	return box;
}
// box = getViewportSize();
// document.write("<h4>ViewPort Size 1 = " + box.x + " : " + box.y + "</h4>");


function openNewWindow(Adresse) {
	openNewWindow(Adresse, false)
}

function openNewWindow(Adresse, forceScrollbars) {
	var optimalWidth  = 1215; // 1185 AppletWidth + ViewWidth + padding left/right 
	var optimalHeight = 740;  // 700 AppletHeight + 20 top/bottom padding
	return openNewWindowSized(Adresse, optimalWidth, optimalHeight, forceScrollbars);
}

function openNewWindowSized(Adresse, optimalWidth, optimalHeight, forceScrollbars) {
	var maxWidth  = screen.width;
	var maxHeight = screen.height;
	
	var newWidth  = Math.min(maxWidth,  optimalWidth);
	var newHeight = Math.min(maxHeight, optimalHeight);
	
	var left = (maxWidth-newWidth)/2;
	var top  = (maxHeight-newHeight)/2;
	if (top >= 40) top -= 40; // Browser oeffnen ein leicht zu grosses Fenster.
	else top = 0;
	
	var scrollbars = "scrollbars=";
	if (forceScrollbars || newWidth < optimalWidth || newHeight < optimalHeight) scrollbars+="yes";
	else scrollbars+="no";
	
	var featureString = "menubar=no, toolbar=no, location=no, status=no, resizable=yes, " + scrollbars;
	var sizeString =  "width=" + newWidth + ",height=" + newHeight + ",left=" + left + ",top=" + top;
	// sizeString += ",innerWidth=" + newWidth + ",innerHeight=" + newHeight;
	
	var windowProperties = featureString + ", " + sizeString;
	// alert(windowProperties);
	
	// Funktioniert im IE nur wenn Adresse relativ ist.
	MeinFenster = window.open(Adresse, "_blank", windowProperties);
	MeinFenster.focus();
	// MeinFenster.document.write(sizeString);
	
	// MeinFenster.resizeTo(newWidth, newHeight);
	return false;
}
