function picturePopup(type, title, id, width, height)
{
	if( width > screen.width || height > screen.height )
	{
		var left = 0;
		var top = 0;
		var width = screen.width;
		var height = screen.height;
		var scale = screen.width+'x'+screen.height+':fit';
	}
	else
	{
		var left = (screen.width - width) / 2;
		var top = (screen.height - height) / 2;
		var scale = '';
	}
	
	imgPopperWindowObj = window.open('', 'imgPopper', 'left='+left+',top='+top+',height='+height+',width='+width+',toolbar=0,location=0,directoties=0,status=0,menubar=0,scrollbars=0,resizable=1');

	var docObj = imgPopperWindowObj.document;
	docObj.write('<html><head><title>'+title+'</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	docObj.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">');
	docObj.write('<a href="javascript:void(0);" onclick="self.close()"><img src="/autoimages/'+type+'/'+id+'/'+scale+'" border="0" title="Закрыть окно"></a>');
	docObj.write('</body></html>');
	docObj.close();
	
	imgPopperWindowObj.screenX = left;
	imgPopperWindowObj.screenY = top;
	imgPopperWindowObj.innerWidth = width;
	imgPopperWindowObj.innerHeight = height;

	if( window.focus )
	{
		imgPopperWindowObj.focus();
	}
}
