function OpenNewWin(img,width,height,title)
{
var saw=screen.availWidth;
var sah=screen.availHeight;

if (typeof(NewWind) != "undefined") 
	if (!NewWind.closed) NewWind.close();
	
	var dir=location.href.substring(0,location.href.lastIndexOf('\/'));

	if ((width <= saw) && (height <= sah))
	{
		var sw=parseInt((saw-width)/2);
		var sh=parseInt((sah-height)/2);
		NewWind=window.open("", "_win", "width="+width+",height="+height+",top="+sh+",left="+sw+",resizable=no,location=no,menubar=no,scrollbars=no,status=no,directories=no,toolbar=no");
		NewWind.document.write('\n<html lang="ru">\n<head>\n<title>'+title+'<\/title>\n<base href=\"'+dir+'\/\">\n');
		NewWind.document.write('<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1251\">\n<\/head>\n\t');
		NewWind.document.write('<body style=\"background: url('+img+');\"><\/body>\n<\/html>');
	}
	else
	{
		var sw=100;
		var sh=100;
		NewWind=window.open("", "_win", "width="+(saw-sw)+",height="+(sah-sh)+",top="+sh/2+",left="+sw/2+",resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,directories=no,toolbar=no");
		NewWind.document.write('\n<html lang="ru">\n<head>\n<title>'+title+'<\/title>\n<base href=\"'+dir+'\/\">\n');
		NewWind.document.write('<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1251\">\n<\/head>\n\t');
		NewWind.document.write('<body style=\"margin: 0 0 0 0;\"><img src=\"'+img+'\" alt=\"\"><\/body>\n<\/html>');
	}
	
	NewWind.document.close();
	
	if (window.focus)
	{
		NewWind.focus();
	}
}

