var winNew = null;
var winFocus = null;

function popup(strContent, strURL)
	{
	winNew = null;

	// Pro Fenster ein Array mit Fensternamen
	var nFoto      = new Array ("foto","foto");
	var nImpressum = new Array ("impressum","impressum");
	var nGesund = new Array ("gesund","gesund");
	var nNetzwerk = new Array ("netzwerk","netzwerk");
	var nSonstige = new Array ("sonstige","sonstige");
	
	var aNames = new Array (nFoto,nImpressum,nGesund,nNetzwerk,nSonstige);

	// Pro Fenster ein Array mit Fensternamen/left/oben/width/height/toolbar/status/menubar/resizable/scrollbars
	var spFoto      = new Array("foto", 180, 70, 650, 670, 0, 0, 0, 0, 0);
	var spImpressum = new Array("impressum", 180, 95, 270, 370, 0, 0, 0, 0, 0);
	var spGesund      = new Array("gesund", 180, 70, 450, 500, 0, 0, 0, 0, 0);
	var spNetzwerk      = new Array("netzwerk", 180, 70, 450, 500, 0, 0, 0, 0, 0);
	var spSonstige      = new Array("sonstige", 180, 70, 450, 500, 0, 0, 0, 0, 0);
	
	var aSizePos = new Array(spFoto,spImpressum,spGesund,spNetzwerk,spSonstige);

	var strWindowName = "";
	for(var nName=0; nName<aNames.length; nName++)
		{
		if(aNames[nName][0] == strContent)
			strWindowName = aNames[nName][1];
		}

	if(strWindowName == "")
		{
		alert("Ein Fehler ist aufgetreten! \nDas Fenster konnte leider nicht geöffnet werden.");
		return;
		}

	// Größe und Position des Fensters aus Array
	for(var nWindow=0; nWindow<aSizePos.length; nWindow++)
		{
		if(aSizePos[nWindow][0] == strWindowName)
			{
			var nBrowser = browserversion();
			var nScreenWidth = 1024;
			var nScreenHeight = 768;
			var nLeft = aSizePos[nWindow][1];
			var nTop = aSizePos[nWindow][2];
			var nHeight = aSizePos[nWindow][4]

			//--- Welche Aufloesung? ---
			if(nBrowser >= 4)
				{
				nScreenWidth = screen.width;
				nScreenHeight = screen.height;
				}

			//--- Zentrierung wenn hoeher als 1024x768 ---
			if(nScreenWidth > 1024)
				nLeft = nLeft + ((nScreenWidth - 1024) / 2);
			if(nScreenHeight > 768)
				nTop = nTop  + ((nScreenHeight - 768) / 2);

			// Hoehenerweiterung fuer Netscape
			//if(netscape())
				//nHeight += 25;

			//--- Nachjustierung, wenn Statusbar oder Menubar fehlt ---
			if((aSizePos[nWindow][5] == 1) && (nTop >= 44))
				nTop = nTop - 44;
			if((aSizePos[nWindow][7] == 1) && (nTop >= 24))
				nTop = nTop - 24;

			//--- neus fenster oeffnen oder bestehendes befuellen ---
			var strOptions = "";
			var strOptions = strOptions +  "toolbar=" + aSizePos[nWindow][5];
			var strOptions = strOptions + ",location=0";
			var strOptions = strOptions + ",directories=0";
			var strOptions = strOptions + ",status=" + aSizePos[nWindow][6];
			var strOptions = strOptions + ",menubar=" + aSizePos[nWindow][7];
			var strOptions = strOptions + ",scrollbars=" + aSizePos[nWindow][9];
			var strOptions = strOptions + ",resizable=" + aSizePos[nWindow][8];
			var strOptions = strOptions + ",left=" + nLeft;
			var strOptions = strOptions + ",top=" + nTop;
			var strOptions = strOptions + ",width=" + aSizePos[nWindow][3];
			var strOptions = strOptions + ",height=" + nHeight;

			winNew = window.open(strURL, strWindowName, strOptions);

			if(winNew.opener == null)
				winNew.opener = this;

			// Fokus auf neues Fenster richten
			if(((nBrowser == 3) && (netscape())) || (nBrowser >= 4))
				winNew.focus();

			return;
			}
		}
	return;
	}

//--- Focus check ---
function setfocustimer()
	{
	if(winFocus == null)
		return;

	nBrowser = browserversion();

	//--- neues fenster focusieren ---
	if(((nBrowser == 3) && (netscape())) || (nBrowser >= 4))
		winFocus.focus();
	winFocus = null;
	}