function getScrollXY() {
  var scrOfX = 0, 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 ];
}

  function showImage(path, width, height) {
    var x,y;
    coords  = getScrollXY();
    x = coords[0];
    y = coords[1];

    pnl = document.createElement("div");
    pnl.innerHTML = '&nbsp;';
    pnl.className = 'previewPanel';
    pnl.id = 'prwPanel';
    pnl.style.width = Math.ceil(document.body.clientWidth + x) + 'px';
    pnl.style.height = Math.ceil(document.body.clientHeight + y) + 'px';

    document.body.insertBefore(pnl, document.body.childNodes[0]);

    img = document.createElement("img");
    img.className = 'previewImage';  
    img.id = 'prwImage';  
    img.src = path;
    img.width = width;
    img.height = height;
    t = document.body.clientHeight / 2 - height / 2 + y;
    img.style.top = Math.ceil(t)+'px';
    l = document.body.clientWidth / 2 - width / 2 + x;
    img.style.left = Math.ceil(l)+'px';

    img.onclick = function () {document.body.removeChild(img); document.body.removeChild(document.getElementById("prwPanel"));};
    first = document.body.childNodes[0];
    document.body.insertBefore(img, first);
    fade('prwPanel',0.25,0.10);
    fade('prwImage',1,0.20);
  }
