
function closewindow() {
  self.close();
}

function viewFsImage (pAID,pWidth,pHeight) {

  var xFile = 'Image.aspx?AID=' + pAID;

  var xWidth = 0;
  if (pWidth >= screen.Width - 40) {
    xWidth = screen.Width - 40;
  } else {
    xWidth = pWidth + 40;
  }

  var xHeight = 0;
  if (pHeight >= screen.AvailHeight - 80) {
    xHeight = screen.AvailHeight - 80;
  } else {
    xHeight = pHeight + 80;
  }

  var xLeft = screen.Width / 2 - xWidth / 2;
  var xTop = 20;

  var xParams = 'resizable=1,toolbar=0,directories=0,scrollbars=1,location=0,width='+xWidth+',height='+xHeight+',left='+xLeft+',top='+xTop;

  var xWin = window.open(xFile,'',xParams);
  if (xWin.opener == null) {
    xWin.opener = self;
  }

}


function viewFsImageSet (pAID,pNo,pWidth,pHeight) {

  var xFile = 'ImageSet.aspx?AID=' + pAID + '&P=' + pNo;

  var xWidth = 0;
  if (pWidth >= screen.Width - 40) {
    xWidth = screen.Width - 40;
  } else {
    xWidth = pWidth + 40;
  }

  var xHeight = 0;
  if (pHeight >= screen.AvailHeight - 80) {
    xHeight = screen.AvailHeight - 80;
  } else {
    xHeight = pHeight + 80;
  }

  var xLeft = screen.Width / 2 - xWidth / 2;
  var xTop = 20;

  var xParams = 'resizable=1,toolbar=0,directories=0,scrollbars=1,location=0,width='+xWidth+',height='+xHeight+',left='+xLeft+',top='+xTop;

  var xWin = window.open(xFile,'',xParams);
  if (xWin.opener == null) {
    xWin.opener = self;
  }

}
