var NS = (navigator.appName=="Netscape")?true:false;
var IE4 = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;

var photoWindow;

var heightOffset = 50;
var widthOffset = 4;

function popupPhoto(url)
{
  if( photoWindow )
  {
    photoWindow.close();
  }

  photoWindow = window.open( url, "", "resizable=1,height=400,width=300");

  registerPopup( photoWindow );
}

function fitPhoto() {
 iWidth = (NS)?window.innerWidth:document.body.clientWidth;
 iHeight = (NS)?window.innerHeight:document.body.clientHeight;
 iWidth = document.images[0].width - iWidth;
 iHeight = document.images[0].height - iHeight;
 window.resizeBy(iWidth, iHeight);
 self.focus();
};

function fitPhotoPlus()
{
	if( IE4 )
	{
		tWidth = 10 + widthOffset + document.images[0].width;
		tHeight = 26 + heightOffset + document.images[0].height;
		window.resizeTo(tWidth,tHeight);
	}
	else
	{
		rWidth = widthOffset + document.images[0].width - window.innerWidth;
		rHeight = heightOffset + document.images[0].height - window.innerHeight;
		window.resizeBy(rWidth, rHeight);
	}

	self.focus();
};
