function openWin(stlink,w,h,inst) {

	var weite = 750;
	var hoehe = 550;
	var sWidth = screen.width;
	var sHeight = screen.height;
	var scroll = "scrollbars=no";
	var oben = 0;
	var links = 0;
	
	if (w == "f") {
		weite = sWidth;
		links = 0;
	} else if (w != "") {
		weite = w;
		links = (screen.width-weite)/2
	}
	if (h == "f") {
		hoehe = sHeight;
		hoehe = screen.height;
		scroll =  "scrollbars=yes";
		oben = 0;
	} else if (h != "") {
		hoehe = h;
		oben = (screen.height-hoehe)/2
	}
	
	if (inst==""){
		var inst="Statements";
	}


	var param = "width="+ weite +",height=" +hoehe+",resizable=0," + scroll + ",menubar=0,status=0,xscreen=0,yscreen=0,left="+ links + ",top=" +oben;
	var url = stlink;
	window.open(url,inst,param);
}
var newWin;
var xPath = "http://www.cultureprojects.com/x.js";

function imgPopUp(cont,text, winname,w,h,scroll) {
	var width = (w)? (w) : 700;
	var height = (h)? (h) : 500;
	var left = parseInt((screen.availWidth/2) - (width/2));
	var top = parseInt((screen.availHeight/2) - (height/2));
	var scrolling = (scroll == 1)? ',scrollbars=yes, resizable=yes, menubar=no' : ',scrollbars=no, resizable=yes, menubar=no'
	var param = "width=" + width + ", height=" + height + ", left=" + left + ", top=" + top; 
	newWin = window.open("", winname, param + scrolling);
	newWin.resizeTo(10, 10);
		setTimeout("putInWindow('" + cont + "', '" + text + "')", 50);
		newWin.focus();
	return false;
}


function putInWindow(cont, text) {
	var newCont = "<html><head><title>Preview</title>";
	newCont += "<script type='text/javascript' src=" + xPath + "><\/script>\n";
	newCont += "<script>\n";
	newCont += "window.onload=function(){\n";
	newCont += "if(xGetElementById('textBox').innerHTML != ''){\n";
	newCont += "var ih = document.getElementById('img').height;\n";
	newCont += "var th = xHeight('textBox')+10;\n";
	newCont += "var bh = xHeight('body');\n";
	newCont += "var h = ih+th;\n";
	newCont += "var dh = h-bh;\n";
	newCont += "var w = document.getElementById('img').width;\n";
	newCont += "var bw = xWidth('body');\n";
	newCont += "var dw = w-bw;\n";
	//newCont += "alert(ih + ' - ' + th + ' - ' + h);\n";
	newCont += "window.resizeTo(w+8, 0);\n";
	newCont += "window.resizeBy(0, dh);\n";
	//newCont += "window.moveBy(-dw/2, -dh/2);\n";
	newCont += "xTop('textBox', ih);";
	newCont += "xShow('textBox');";
	newCont += "window.focus();";
	newCont += "}\n";
	newCont += "}\n";
	newCont += "\n<\/script>";
	newCont += "</head>";
	newCont += "<body id='body' style='margin: 0; padding: 0; height: 100%'>"
	newCont += "<div style='position: relative; z-index: 1; font: 11px Verdana, sans-serif; color:#8A8A8A; margin-top: 30%; text-align: center;'>Bild wird geladen...</div>";
	newCont += "<div id='imageBox' style='position: absolute; z-index: 100; top: 0'><img id='img' src='"+ cont + "' onclick='window.close();' style='cursor: pointer;' title='Fenster schließen'></div>";
	newCont += "<div id='textBox' style='position: absolute;visibility: hidden; z-index: 100; top: 0;padding: 5px 20px; font: 11px Arial, sans-serif; color:#8A8A8A;'>" + text + "</div>";
	newCont += "</body></html>";
	newWin.document.write(newCont);
	newWin.document.close();
}

