function PopUpCustomWindow(imagewidth, imageheight, URL, Title)
{

var RightScrollBarSize = 40;
var DownScrollBarSize = 0;
var TaskBarSize = 40;
var RightSideFix = 15;
var DownSideFix = 0;
var ImageHeightFix = 30;

if ((screen.width <= imagewidth) || (screen.height <= (imageheight+ImageHeightFix)))
 {
  var WindowParameters = "location=no, scrollbars=yes, menubars=no, toolbars=no, resizable=yes" +
  ",left=" + (RightScrollBarSize/2) +
  ",top=" + (TaskBarSize) +
  ",width=" + (screen.width-RightScrollBarSize) +
  ",height=" + (screen.height-TaskBarSize*2);
 }
else
 {
  var WindowParameters = "location=no, scrollbars=no, menubars=no, toolbars=no, resizable=no" +
  ",left=" + ((screen.width-imagewidth)/2) +
  ",top=" + ((screen.height-(imageheight+ImageHeightFix))/2) +
  ",width=" + (imagewidth+RightSideFix) +
  ",height=" + ((imageheight+ImageHeightFix)-DownSideFix);
 }
   
PopUp = window.open('', '', WindowParameters);
PopUp.document.open();
PopUp.document.writeln("<html>");
PopUp.document.writeln("<head>");
PopUp.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">');
PopUp.document.writeln('<meta name="Author" content="Doza">');
PopUp.document.write("<title>");
PopUp.document.write(Title);
PopUp.document.writeln("</title>");
PopUp.document.writeln("</head>");
PopUp.document.writeln("<body>");
PopUp.document.writeln("<center>");
PopUp.document.write("<img src='");
PopUp.document.write(URL);
PopUp.document.write("' alt='");
PopUp.document.write(Title);
PopUp.document.writeln("'>");
PopUp.document.writeln("</center>");
PopUp.document.writeln("</body>");
PopUp.document.writeln("</html>");
PopUp.document.close();

}

