<!--

// Copyright (C) 2003 DS Innovations

var picwnd;

function showpic(picnum) {
  // Get the screen size of the user's machine.
  scrx = screen.availWidth;
  scry = screen.availHeight;

  // Distill the big, long-worded vars down to local vars for ease of use.
  url = document.pix[picnum].url;
  comment = document.pix[picnum].comment;
  px = document.pix[picnum].x;
  py = document.pix[picnum].y;

  if (comment != "") len = 155;
  else len = 55;

  if ((px+20) < scrx && (py+len) < scry) {
    // This will fit on the users screen at full size.
    openpicwin(url,comment,px,py);
  } else {
    // This needs to be scaled to fit.  We find out which side is the long side and resize it accordingly.
    if ((py+len) > scry) ratio = (scry-len) / py;
    else ratio = (scrx-20) / px;

    x = Math.round(px * ratio);
    y = Math.round(py * ratio);

    openpicwin(url,comment,x,y);
  }
}

function openpicwin(url,comment,x,y) {
  if (comment != "") len = 155;
  else len = 55;

  // If there's another window already open, we're going to close it.  This will prevent confused people from having 10 windows open.
  if (typeof picwnd == "object") {
    if (!picwnd.closed) picwnd.close();
  }
  // We open our window and write the source for it locally.  This prevents having a stub on the server and increasing CPU usage there.
  picwnd = window.open(url,"picwin","width="+(x+20)+",height="+(y+len)+",resizable=no,menubar=no,location=no,directories=no");
  picwnd.document.writeln('<html><head><title>Slave Pit, Inc.</title></head>');
  picwnd.document.writeln('<body bgcolor="#030611" text="#FFFFFF" link="#A6905F" vlink="#736035" alink="#736035" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
  picwnd.document.writeln('<p align="center"><img src="'+url+'" width="'+x+'" height="'+y+'" border="0"></p>');
  if (comment != "") picwnd.document.writeln('<p align="center">'+comment+'</p>');
  picwnd.document.writeln('<p align="center"><a href="" onClick="window.close();return false">Close window</a></p>');
  picwnd.document.writeln('</body></html>');
  picwnd.document.close();
  picwnd.focus();
}

// Copyright (C) 2003 DS Innovations

//-->