function popup(pfad, titel) {
	var width = get_percent(screen.width, 50);
	var height = get_percent(screen.height, 50);
	var parts = pfad.match(/(.*)\/([^\\\/]+)$/);
	/*alert(parts[1]);
	alert(parts[2]);*/
	pfad = parts[1] + "/" + encodeURIComponent(parts[2]);
	popup_window = window.open("", "popup", "depent=yes,width=" + width + ",height=" + height + ",menubar=no,toolbar=no,status=no,location=no,scrollbars=yes,resizable=yes");
	popup_window.document.writeln('<html><head><title>' + titel + '</title>');
	popup_window.document.writeln('<script language="Javascript">');
	popup_window.document.writeln('var pruefinterval=0;');
	popup_window.document.writeln('var posx = opener.get_center(screen.width,' + width + ');');
	popup_window.document.writeln('var posy = opener.get_center(screen.height,' + height + ');');
	popup_window.document.writeln('window.moveTo(posx, posy);');
	popup_window.document.writeln('function Groesse() {');
	popup_window.document.writeln('    if (document.all) {');
	popup_window.document.writeln('        var pic = document.all["pic"];');
	popup_window.document.writeln('    } else {');
	popup_window.document.writeln('        var pic = document.getElementById("pic");');
	popup_window.document.writeln('    }');
	popup_window.document.writeln('    if (pic.complete == true) {');
	popup_window.document.writeln('        var rand = 0; // Für Scrollleisten');
	popup_window.document.writeln('        var width = opener.get_percent(screen.width, 85);');
	popup_window.document.writeln('        var height = opener.get_percent(screen.height, 85);');
	popup_window.document.writeln('        if (pic.width < screen.width) { width = pic.width + rand ; }');
	popup_window.document.writeln('        if (pic.height < screen.height) { height = pic.height + rand; }');
	popup_window.document.writeln('        posx = opener.get_center(screen.width, width);');
	popup_window.document.writeln('        posy = opener.get_center(screen.height, height);');
	popup_window.document.writeln('        window.moveTo(posx, posy);');
	popup_window.document.writeln('        window.resizeTo(width, height);');
	popup_window.document.writeln('        window.clearTimeout(pruefinterval);');
	popup_window.document.writeln('    }');
	popup_window.document.writeln('}');
	popup_window.document.writeln('pruefinterval = window.setTimeout("Groesse()",1000);');
	popup_window.document.writeln('</script></head>');
	popup_window.document.writeln('<body style="padding:0px;margin:0px;" onLoad="Groesse();">');
	popup_window.document.writeln('<a href="javascript:window.close();"><img id="pic" src="' + pfad + '" border="0" title="' + titel + '"/></a>');
	popup_window.document.writeln('</body></html>');
	popup_window.document.close();
	popup_window.focus();
}

function get_percent(value, percent) {
	if (percent < 1) {
		percent = 100;
	}
	var new_value = Math.round((value / 100) * percent);
	return new_value;
}

function get_center(full_size, size) {
	var pos = Math.round((full_size / 2) - (size / 2));
	return pos;
}