function show_pic(path, tit)
{
	if(!tit) tit = 'pic';
	var w = 800;
	var h = 600;
    var left = parseInt((screen.availWidth/2) - (w/2));
    var top  = parseInt((screen.availHeight/2) - (h/2));
	var nw = window.open('','pic','left='+left+',top='+top+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width='+w+',height='+h);
	var buf = '';
	buf += '<html><head><meta http-equiv="Content-Type" content="text/html; charset=cp1251"><title>'+tit+'</title>' + "\n";
	buf += '</head><body style="padding:0px; margin:0px; background-color:white">' + "\n";
	buf += '<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="center" valign="middle">' + "\n";
	buf += '<a href="javascript: this.close();" title="close window">' + "\n";
	buf += '<img src="'+path+'" alt="close window" border="0" onload="window.setTimeout(\'fit_pic('+w+', '+h+');\', 50)" align="absmiddle" />' + "\n";
	buf += '</a></td></tr></table>' + "\n";
	//
	buf += '<script type="text/javascript" language="JavaScript">' + "\n";
	buf += 'function fit_pic(w, h)' + "\n";
	buf += '{' + "\n";
	buf += '	var width_orig  = window.document.images[0].width;' + "\n";
	buf += '	var height_orig = window.document.images[0].height;' + "\n";
	buf += '	if(width_orig > height_orig)// w_o > h_o' + "\n";
	buf += '	{' + "\n";
	buf += '		h = (w / width_orig) * height_orig;' + "\n";
	buf += '	}' + "\n";
	buf += '	else// h_o > w_o' + "\n";
	buf += '	{' + "\n";
	buf += '		w = (h / height_orig) * width_orig;' + "\n";
	buf += '	}' + "\n";
	buf += '	//window.alert( h + " - " + w );' + "\n";
	buf += '	window.document.images[0].width = w;' + "\n";
	buf += '	window.document.images[0].height = h;' + "\n";
	buf += '	window.resizeTo(w+20, h+50);' + "\n";
	buf += '	window.focus();' + "\n";
	buf += '}' + "\n";
	buf += '</script>' + "\n";
	//
	buf += '</body></html>' + "\n";
	nw.document.write(buf);
	nw.document.close();
	nw.focus();
}

