function GetSize(vImg)
{
Photo2= new Image();
Photo2.src=(vImg);
hSize = Photo2.height
wSize = Photo2.width
}

function OpenPhoto(img){
  Photo1= new Image();
  img = "scans/" + img + ".jpg";
  Photo1.src=(img);
  Control(img);
}

function Control(img){
  if((Photo1.width!=0)&&(Photo1.height!=0)){
    viewPhoto(img);
  }
  else{
    dothis="Control('"+img+"')";
    interval=setTimeout(dothis,20);
  }
}

function viewPhoto(img){
  vWidth=Photo1.width;
  vHeight=Photo1.height;
  stringa="resizable=1,scrollbars=0,width="+vWidth+",height="+vHeight;
  
  //if(ScanWin && !ScanWin.closed){  ScanWin.close(); }
  
  
  ScanWin=window.open("","ScanWindow",stringa);
  titleText = img.replace("-", " ");
  titleText = titleText.replace(".jpg", "");
  titleText = titleText.replace("scans/", "An example of: ");
  
		ScanText = ''
		ScanText = ScanText + '<html><head><title>';
		ScanText = ScanText + titleText;
		ScanText = ScanText + ' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</title></head><body onload="self.focus()" background="images/parch-dark.jpg">';
		ScanText = ScanText + '<a href="javascript:self.close()"><img src="';

		ScanText = ScanText + img;

		ScanText = ScanText + '" border="0" alt="Click here to close this window"></a>';
		ScanText = ScanText + '<center><a href="javascript:self.close()"><img src="images/CloseWindow.gif" width="178" height="35" border="0" alt="Close This Window"></a></center></body></html>';

		ScanWin.resizeTo(vWidth+40,vHeight+99)
		
		ScanWin.document.write(ScanText);
		ScanWin.document.close();

}
