function Windows_SLXShowPictureInNewCenteredWindow(APictureURL,ATitle)
{
var LNewWindow;
var LMagic="SCR"+"IPT";
var LImage;

LNewWindow=window.open("", "", "toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=0, resizable=1, left=20, top=20, width=300, height=60");
with(LNewWindow.document)
  {
  open();
  writeln("<HTML>");
  writeln("<HEAD>");
  writeln("<META http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\">");
  writeln("<TITLE>"+ATitle+"</TITLE>");
  writeln("</HEAD>");
  writeln("<BODY");// scroll=no");
  writeln("style=\"background-color: silver; border: 0px; margin: 0px; padding: 0px;");
  writeln("font-weight: bold; font-size: 14px; font-family: Verdana sans-serif\">");
  writeln("</BODY scroll=no>");
  writeln("</HTML>");
  close();
  }
Windows_SLXLoadImage(LNewWindow, APictureURL);
//return false;
}

function Windows_SLXSetWindowPosition(AWindow, ALeft, ATop, AWidth, AHeight)
{
AWindow.moveTo(0,0);
AWindow.resizeTo(AWidth,AHeight);
AWindow.moveTo(ALeft,ATop);
}

function Windows_SLXLoadImage(AWindow, APictureURL)
{
var LImage;
LImage=new Image();

AWindow.document.body.innerHTML="<BR><DIV style='text-align: center; font-size: medium; color: black'>Proszę czekać.<BR>Trwa ładowanie zdjęcia.</DIV>";
LImage.onload=function()
  {
  LImage.onload="";
  Windows_SLXCenterWindow(AWindow, LImage.width, LImage.height);
  AWindow.document.body.innerHTML="<IMG src=\""+APictureURL+"\">";  
  }
LImage.onabort=function()
  {
  AWindow.document.body.innerHTML="<BR><DIV style='text-align: center; font-size: medium; color: black'>Załadowanie zdjęcia<BR>nie powiodło się.</DIV>";
//    +"<A HREF='javascript:window.location.reload()' style='font-size: x-small; color: red'>Odśwież</A></DIV>";
  }
LImage.onerror=LImage.onabort;

LImage.src=APictureURL;
}

function Windows_SLXCenterWindow(AWindow, AContentWidth, AContentHeight)
{
var LCaptionHeight=28; // domyślna wysokość paska tytułowego
var LScrollBarSize=17; // domyślna wielkość paska przesuwania
var LWidth,LHeight,LLeft,LTop;
var LAdditionalHeight=4+25, LAdditionalWidth=9; // domyślne szerokości obramowania + pasek stanu
var LDeltaX=0, LDeltaY=0;

if((AWindow.innerHeight != undefined) && (AWindow.outerHeight != undefined)) LAdditionalHeight=AWindow.outerHeight-AWindow.innerHeight;
if((AWindow.innerWidth != undefined) && (AWindow.outerWidth != undefined)) LAdditionalWidth=AWindow.outerWidth-AWindow.innerWidth;
LAdditionalHeight+=LCaptionHeight;
LWidth=AContentWidth+LAdditionalWidth;
LHeight=AContentHeight+LAdditionalHeight;
if(AWindow.screen.availLeft != undefined) LDeltaX=AWindow.screen.availLeft;
if(AWindow.screen.availTop != undefined) LDeltaY=AWindow.screen.availTop;

var LShowScrolls=false;
if(LWidth > AWindow.screen.availWidth)
  {
  LWidth=AWindow.screen.availWidth;
  LShowScrolls=true;
  LHeight+=LScrollBarSize;
  }
if(LHeight > AWindow.screen.availHeight)
  {
  LHeight=AWindow.screen.availHeight;
  LShowScrolls=true;
  LWidth+=LScrollBarSize; // LWidth może przekroczyć MaxWidth
  }
if(LShowScrolls) AWindow.document.body.scroll="yes";

LLeft=(AWindow.screen.availWidth-LWidth)/2+LDeltaX;
LTop=(AWindow.screen.availHeight-LHeight)/2+LDeltaY;
Windows_SLXSetWindowPosition(AWindow,LLeft,LTop,LWidth,LHeight);
}
