function OpenNewWindow(prefix, params, pic, amount, firstcall) {
	ScreenWidth = screen.width;
	ScreenHeight = screen.height;
	
	xsize = 700 + 8;
	ysize = 560 + 85;

	xpos = (ScreenWidth/2)-(xsize/2);
	ypos = (ScreenHeight/2)-(ysize/2);
	
	var params_orig = params;
	var index = params.indexOf(",");
	var length = params.length;
	var images = new Array();
	var i = 0;
	images[i] = params.substr(0, index);
	while (index != -1) {
		params = params.substr(index+1, length);
		i = i+1;
		var index_neu = params.indexOf(",");
		if (index_neu == -1) {
			images[i] = params.substr(0, length);
		} else {
			images[i] = params.substr(0, index_neu);
		}
		index = index_neu;
	}
	
	picture = prefix + images[pic];
	var navigation = getNavigation(prefix, params_orig, pic, amount);
	
	if (firstcall == 1) {
		NewWindow = window.open("","Picture","height="+ysize+",width="+xsize+",scrollbars=no,resizable=yes,statusbar=no,top="+ypos+",left="+xpos+"");
		NewWindow.document.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"de\" lang=\"de\">\n\n");
		NewWindow.document.write("<head>\n\t<title>Zum Schlie&szlig;en klicken</title>");
		NewWindow.document.write("\n\t<link rel='stylesheet' type='text/css' href='http://www.cyberhouse.at/fileadmin/layout/js_new_window_style.css' />");
		if(!document.all) {
		NewWindow.document.write("\n\t<script type='text/javascript' src='/fileadmin/scripts/gallery_script.js'></script>");
		}
		NewWindow.document.write("\n</head>");
		NewWindow.document.write("\n\n<body onload='focus();'>");
		NewWindow.document.write("\n\t<a href='javascript:window.close();' title='Zum Schlie&szlig;en klicken'>\n\t\t<div id='picture'>\n\t\t\t<img src='");
		NewWindow.document.write(picture);
		NewWindow.document.write("\' alt='Zum Schlie&szlig;en klicken' />\n\t\t</div>\n\t</a>");
		NewWindow.document.write(navigation);
		NewWindow.document.write("\n</body>\n</html>");
		NewWindow.document.close();
		NewWindow.resizeTo(xsize,ysize);
	} else {
		document.getElementById("picture").innerHTML = "<img src='" + picture + "' alt='Zum Schlie&szlig;en klicken' />"; 
		document.getElementById("navigation").innerHTML = navigation;
	}
}

function getNavigation(prefix, params, pic, amount) {
	var navi = "\n<div id='navigation'>";
	
	// create "PREVIOUS"-link
	 if(!document.all) {
		if (pic > 0) {
			var prev = pic - 1;
			navi += "\n\t<a href=\"javascript:OpenNewWindow('"+prefix+"','"+params+"','"+prev+"','"+amount+"','0');\">&laquo;&nbsp;Zur&uuml;ck</a>";
		} else {
			navi += "\n\t<span class='inactive'>&laquo;&nbsp;Zur&uuml;ck</span>";
		}
	} 
	
	// create "CLOSE"-Link
	navi += "\n\t<a href=\"javascript:window.close();\">Schlie&szlig;en</a>";
	
	// create "NEXT"-link
	if(!document.all) {
		if (++pic < amount) {
			navi += "\n\t<a href=\"javascript:OpenNewWindow('"+prefix+"','"+params+"','"+pic+"','"+amount+"','0');\">Weiter&nbsp;&raquo;</a>";
		} else {
			navi += "\n\t<span class='inactive'>Weiter&nbsp;&raquo;</span>";
		}
	}
	navi += "\n</div>";
	
	return navi;
}