function ViewImage(
aImageURL,
aImageTitle,
aImageWidth,
aImageHeight)
{
   aImageWidth +=20;
   aImageHeight+=20;
   aImageWidth  =Max(aImageWidth, 100);
   aImageHeight =Max(aImageHeight,100);
   // imageX       = screen.AvailWidth -aImageWidth  -20;
   // imageY       =(screen.AvailHeight-aImageHeight)/2;
   attribs      ="width="   +aImageWidth+",height=" +aImageHeight; 
   //              ",screenX="+imageX     +",screenY="+imageY;

   imageWindow                 =window.open(aImageURL,"",attribs);
   imageWindow.document.bgColor="#FFFFFF";
   imageWindow.document.title  =unescape(aImageTitle);

   // if (imageWindow.screenX != imageX || imageWindow.screenY != imageY)
   // {
   //    imageWindow.moveTo(imageX,imageY);
   // }
}



function Max(
aVal1,
aVal2)
{
   if (aVal1 > aVal2)
   {
      result=aVal1;
   }
   else
   {
      result=aVal2;
   }

   return(result);
}



// -- Stolen from http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=16 --

function getScrollXY()
{
   var scrOfX = 0;
   var scrOfY = 0;
   if (typeof(window.pageYOffset) == 'number')
   {
      //Netscape compliant
      scrOfY = window.pageYOffset;
      scrOfX = window.pageXOffset;
   }
   else if (document.body &&
           (document.body.scrollLeft || document.body.scrollTop))
   {
      //DOM compliant
      scrOfY = document.body.scrollTop;
      scrOfX = document.body.scrollLeft;
   }
   else if (document.documentElement &&
           (document.documentElement.scrollLeft || document.documentElement.scrollTop))
   {
      //IE6 standards compliant mode
      scrOfY = document.documentElement.scrollTop;
      scrOfX = document.documentElement.scrollLeft;
   }

   return([scrOfX,scrOfY]);
}
