function imgpopup(imgurl,imgtxt)
{

	var eigenschaften,sbreite,shoehe,fenster,b,h;
	b = 200;
	h = 200;

	// wenn eine feste Position für die Anzeige gewünscht wird
	// dann für die Variable 'FestePosition' ein "ja" eintragen
	// und die X- / Y-Werte (linke obere Ecke) hier eintragen

	var FestePosition = "ja";  // "ja" oder "nein" eintragen
	VonLinks = 20;
	VonOben = 20;

	if(FestePosition == "ja") {
		x = VonLinks;
		y = VonOben;

	} else {


		// stellt die Bildschirmabmessungen fest
		var ns6 = (!document.all && document.getElementById);
		var ie4 = (document.all);
		var ns4 = (document.layers);

		if(ns6||ns4) {
			sbreite = innerWidth;
			shoehe = innerHeight;
		} else if(ie4) {
			sbreite = document.body.clientWidth;
			shoehe = document.body.clientHeight;
			//shoehe = document.documentElement.clientHeight;
		}

		//alert("festgestellte Höhe: " + shoehe);
	
		x = (sbreite-b)/2;
		y = (shoehe-h)/2;
	
	}
	
	eigenschaften="left="+x+",top="+y+",screenX="+x+",screenY="+y+",width="+b+",height="+h+",menubar=no,toolbar=no,status=yes,scrollbars=yes,resizable=yes";
	
	fenster = window.open("","",eigenschaften);
	fenster.focus();
	fenster.document.open();
	// http://www.phpied.com/javascript-include
	with (fenster) {
		document.write("<html><head>"+"\n");
		document.write("<title>click to close</title>"+"\n");	
		document.write('<link href="/css/default.css" rel="stylesheet" type="text/css">'+"\n");	
		// geändert 2004 für Mozilla
		document.write('<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt">'+"\n");
		document.write('var pop_image, load_image, load_info, pop_imagepath;'+"\n");
		document.write("var imgtxt = '" + escape(imgtxt) + "';"+"\n");
		document.write('function info_txt(info) {'+"\n");
		document.write('	var de = 0, en = 1;	var lang;'+"\n");
		document.write('	var languageinfo = navigator.language ? navigator.language : navigator.userLanguage;'+"\n");
		document.write('	if (languageinfo.substr(0,2) == "de") {lang = de; } else {lang = en;}'+"\n");
		document.write('	var txt = new Array();'+"\n");
		document.write('	txt[de] = new Object();'+"\n");
		document.write('	txt[de]["lade"] = "Lade...";'+"\n");
		document.write('	txt[de]["img_vorh"] = "Bild gefunden!";'+"\n");
		document.write('	txt[de]["img_n_vorh"] = "Fehler: Bild nicht vorhanden!";'+"\n");
		document.write('	txt[de]["abort"] = "Warnung: Ladevorgang abgebrochen!";		'+"\n");
		document.write('	txt[en] = new Object();'+"\n");
		document.write('	txt[en]["lade"] = "Load...";'+"\n");
		document.write('	txt[en]["img_vorh"] = "Image exists!";'+"\n");
		document.write('	txt[en]["img_n_vorh"] = "Error: Image does not exist!";'+"\n");
		document.write('	txt[en]["abort"] = "Warning: Abort loading!";'+"\n");
		document.write('	return(txt[lang][info]);}'+"\n");
		document.write('function d(o){return document.getElementById(o);}'+"\n");
		document.write('function loadimage(_pop_imagepath)'+"\n");
		document.write('{'+"\n");
		document.write('	pop_image = d("pop_image");'+"\n");
		document.write('	pop_image.style.display = "none";'+"\n");
		document.write('	load_image = d("load_image");'+"\n");
		document.write('	load_image.style.display = "block";	'+"\n");
		document.write('	load_info = d("load_info");'+"\n");
		document.write('	var pop_imageserver = "http://"+window.location.hostname;'+"\n");
		document.write('	pop_imagepath = _pop_imagepath;'+"\n");
		document.write('	pop_image.src = pop_imagepath;'+"\n");
		document.write('	pop_image.onload = check_load;'+"\n");
		document.write('	pop_image.onerror = load_error;'+"\n");
		document.write('	pop_image.onabort = load_abort;'+"\n");
		document.write('}'+"\n");
		document.write('function load_error(){'+"\n");
		document.write('	load_info.innerHTML = info_txt("img_n_vorh");'+"\n");
		document.write('	load_image.style.display = "none";}'+"\n");
		document.write('function load_abort(){	load_info.innerHTML = info_txt("abort"); '+"\n");
		document.write('	load_image.style.display = "none";}'+"\n");
		document.write('function check_load(){'+"\n");
		document.write('	if (pop_image.complete == false) {'+"\n");
		document.write('		setTimeout("check_load();", 50);'+"\n");
		document.write('	} else {	size_window()	}}'+"\n");
		document.write('function size_window(){'+"\n");
		document.write('	var win_x, win_y;'+"\n");
		document.write('	load_image.style.display = "none";	'+"\n");
		document.write('	pop_image.style.display = "block";'+"\n");
		document.write('	win_x = pop_image.width < 800 ? pop_image.width + 45 : 800;'+"\n");
		document.write('	win_y = pop_image.height < 600 ? pop_image.height + 90 : 600;'+"\n");	
		document.write('	document.getElementById("content_main").style.width = pop_image.width ;'+"\n");		
		document.write('	if (imgtxt != "" || imgtxt != "undefined") { win_y = win_y + 100; document.getElementById("content_main").style.display = "block";}'+"\n");
		document.write('	window.resizeTo(win_x,win_y);}'+"\n");		
		// bei click  schliessen , on click close
		document.write("function click() { /*window.close();*/ } "+"\n");
		document.write("//document.onmousedown=click "+"\n");
		// geändert 2004 für Mozilla
		document.write('</scr' + 'ipt>'+"\n");
		document.write("</head>"+"\n");
		// bei Focusverlust schliessen, close if window looses focus
		// Zeile geändert Aug 2003 (Dreamweaver machte Problemeonblur=\"window.close()\" )
		document.write('<' + "body onload=\"loadimage('"+imgurl+"')\" ");
		document.write('marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" style="background-color:#FFFFFF;" >'+"\n");
		//document.write('<scr' + 'ipt type="text/javascript" language="JavaScript" src="' + myurl + '"></scr' + 'ipt>'+"\n"); 		
		//document.write("<img src='"+ imgurl +"' border='0'>"+"\n");
		document.write('<div align="center" ><div id="load_info" style="font-weight:bold; color:#CC3333;"></div>'+"\n");
		document.write('<img id="load_image" src="/img/allg/imgpopup_ajax_loader.gif" style="display: none;" alt="load..." title="click to close" onclick="window.close()" />'+"\n");
		document.write('<img id="pop_image" src="blank.jpg" style="display: none;" alt="" title="click to close"  onclick="window.close()" />'+"\n");

		document.write('<div id="content_main" style="display:none; text-align:left; margin:10px 5px 10px 5px; padding:10px 5px 10px 5px; border-color:#CC3333; border-style:solid; border-width:1px;">'+"\n");
		document.write('<p>'+unescape(imgtxt)+'</p>');		
		document.write('</div>'+"\n");
		document.write('<p><a href="javascript:window.close()">schliessen</a></p>'+"\n");		
		document.write('</div>'+"\n");		
		document.write("</body></html>"+"\n");
		fenster.document.close();
	}
}


