<!--

	// Photo popup script Copyright © 2005 by Douglas M. Wilcox, all
	// rights reserved. E-Mail the reverse of ten.ylimafxocliw ta guod 
	// for permissions to use

var basePath = 'photos/'
var isSafari = navigator.userAgent.toLowerCase().indexOf("safari") > -1;

function photoPopUp(imageName, prefixBool){

	if(true != prefixBool){
		basePath = basePath + 'hi-res/'
	}
	// I hate Safari - Why can't I manipulate the document object? This worked even
	// on Netscape 4.3!!!
	if(!isSafari){
		var preZoomWindow = window.open("prePopUp.htm","prePopUpWindow","height=190,width=350")
		//if(prePopUpWindow){
			preZoomWindow.document.open()
			preZoomWindow.document.writeln('<html><head>')
			preZoomWindow.document.writeln('<title>Loading ...</title>')
			preZoomWindow.document.writeln('<style>h3,p{font-family: "Trebuchet MS",Verdana,Arial,Helvetica,Sans-Serif; font-color: rgb(255,255,255);}</style>')
			preZoomWindow.document.writeln('</head>')
			preZoomWindow.document.writeln('<body background="#FFFFFF" bgcolor="#FFFFFF">')
			preZoomWindow.document.writeln('<table cellpadding="0" cellspacing="0" width="100%" height="100%">')
			preZoomWindow.document.writeln('<tr><td align="center" background="#FFFFFF" valign="middle"><h3>Loading Larger Image ...</h3>')
			preZoomWindow.document.writeln('<p>(If image does not load, disable your popup <br />blocker for this site or <a href="' + basePath + imageName + '" target="_blank" onclick="setTimeout(\'preZoomWindow.close()\',2000)">click here instead</a>.)<br />&nbsp;</p>')
			
			preZoomWindow.document.writeln('</td></tr></table>')
			preZoomWindow.document.writeln('<p>&nbsp;</p>')
			preZoomWindow.document.writeln('<p>&nbsp;</p>')
			preZoomWindow.document.writeln('<p>&nbsp;</p>')
			preZoomWindow.document.writeln('<p>&nbsp;</p>')
			preZoomWindow.document.writeln('<p>&nbsp;</p>')
			preZoomWindow.document.writeln('<p><img name="hiGuy" src="' + basePath + imageName + '" onLoad="opener.zoomPopUp(\'' + imageName + '\',document.images[\'hiGuy\'].height,document.images[\'hiGuy\'].width); setTimeout(\'self.close();\',250);"></p>')
			preZoomWindow.document.writeln('</body></html>')
			preZoomWindow.document.close()
			return
		//}
	}
	window.open(basePath + imageName,"prePopUpWindow")
}

function zoomPopUp(imageName,zoomHeight,zoomWidth){

	var vMargin = 65; // 35 worked for IE; Firefox wants more.
	var hMargin = 12; // 12 worked for IE

	zoomHeight2 = zoomHeight
	zoomWidth2 = zoomWidth
	maxHeight = screen.availHeight - vMargin
	maxWidth = screen.availWidth - hMargin
	imageResized=''
	clickToClose = ' (Click to Close)'

	if(zoomHeight >= zoomWidth) // portrait-oriented image
		{
		if(zoomHeight > maxHeight) 
			{
			imageResized = ' - Resized to fit Your Screen'
			zoomHeight = maxHeight
			zoomWidth = zoomWidth * (maxHeight / zoomHeight2)
			}
		if(zoomWidth > maxWidth) // if still too wide
			{
			imageResized = ' - Resized to fit Your Screen'
			zoomWidth = maxWidth
			zoomHeight = zoomHeight * (maxWidth / zoomWidth2)
			}
		}
	else // must be landscape-oriented
		{
		if(zoomWidth > maxWidth)
			{
			imageResized = ' - Resized to fit Your Screen'
			zoomWidth = maxWidth
			zoomHeight = zoomHeight * (maxWidth / zoomWidth2)
			zoomHeight2 = zoomHeight
			}
		if(zoomHeight > maxHeight) // if still too tall
			{
			imageResized = ' - Resized to fit Your Screen'
			zoomHeight = maxHeight
			zoomWidth = zoomWidth * (maxHeight / zoomHeight2) // this is the last one to fix!
			}
		}

	var parameters = 'height=' + zoomHeight + ',width=' + zoomWidth

	var zoomWindow = window.open("zoomPopUp.htm","zoomPopUpWindow",parameters)

	var zoomY = (screen.availHeight / 2) - (zoomHeight / 2) - 14
	if (zoomY < 0){
		zoomY = 0
	}

	var zoomX = (screen.availWidth / 2) - (zoomWidth / 2)
	if (zoomX < 0) {
		zoomX = 0
	}

	zoomWindow.document.open()
	zoomWindow.document.writeln('<html><head>')
	zoomWindow.document.writeln('<title>Higher-Resolution Image' + imageResized + '</title>')
	zoomWindow.document.writeln('<script type="text/javascript">function haceNada(){}</script>')
	zoomWindow.document.write('</head><body background="#000000" bgcolor="#000000" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0"')
//	zoomWindow.document.write(' onBlur="self.close();"'
	zoomWindow.document.write('>')

	zoomWindow.document.write('<table background="#000000" width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">')
	zoomWindow.document.write('<tr background="#000000"><td background="#000000" valign="middle" align="center" width="100%" height="100%">')

//	zoomWindow.document.write('<a href="#" onClick="window.blur();">')

	zoomWindow.document.write('<img border="0" src="' + basePath + imageName + '" align="middle" height="' + zoomHeight + '" width="' + zoomWidth + '">')

//	zoomWindow.document.write('</a>')
	zoomWindow.document.write('</td></tr></table>')
	zoomWindow.document.writeln('<script type="text/javascript">')
	zoomWindow.document.writeln('setTimeout("window.focus();",250);')
	zoomWindow.document.writeln('window.moveTo(' + zoomX + ',' + zoomY + ');')
	zoomWindow.document.writeln('</script>')
	zoomWindow.document.writeln('</body></html>')
	imageResized = ''
	zoomWindow.document.close()

	basePath = 'photos/'
}
// -->