function popup( url, w, h )
{
	var last, scrl=false;
	if( last ) last.close();

	sw = screen.availWidth;
	sh = screen.availHeight;

	if( w >= sw-30 ){ w = sw-30; scrl = true; h+=16 }
	if( h >= sh-50 ){ h = sh-50; scrl = true; w+=16 }

	var popup = "";
	var l = ( sw / 2 ) - (w/2);
	var t = ( sh / 2 ) - (h/2);

	popup = window.open( '', '_blank', 'height='+h+',width='+w+',screenX=150,screenY=150,top='+t+',left='+l+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=' + ( scrl ? 'yes' : 'no' ) + ',resizable=yes')

	popup.document.write(
		'<html>'+
			'<head>'+
			'<title>'+url+'</title>'+
		'</head>'+
		'<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=black onclick="window.close()">'+
			'<table width=100% cellpadding=0 cellspacing=0 border=0>'+
			'<tr>'+
				'<td align=center valign=center>'+
					'<a href="javascript:window.close()" title="kliknij aby zamknac okienko">'+
					'<img src="'+url+'" border=0></a>'+
				'</td>'+
			'</tr>'+
			'</table>'+
		'</body>'+
		'</html>'
	);

	last = popup;
	popup.focus();
}