// Function that opens and centers an image in generated HTML
function popImage(URL,X,Y) {
	var now = new Date();
	var year = now.getYear();
	if (year < 2000)
	year = year + 1900;
	var wideSpace = (screen.width - (X + 12)) / 2;
	var highSpace = (screen.height - (Y + 83)) / 2;
	if (navigator.appName == 'Microsoft Internet Explorer') {
		imageWin = window.open("","IMG","width="+(X + 12)+",height="+(Y + 83)+",left="+wideSpace+",top="+highSpace+",status=1,resizable=1,scrollbars=0");
		imageWin.document.open();
		imageWin.document.write("<html><title>All-About-Tom.com</title><body style='margin: 0px;' onLoad='self.resizeTo("+(X + 12)+","+(Y + 83)+");self.moveTo("+wideSpace+","+highSpace+");self.focus();window.status=\"Click on any part of the image to close this window.\";' onBlur='setTimeout(self.close, 10000);' marginwidth='0' marginheight='0'>" + 
			"<div style='color: #DDDDAA; font: 128px 'Palatino Linotype', Georgia, 'Times New Roman', Times, serif; background-color: #FFFFCC; text-align: center; position: absolute; z-index: 1;" + 
			"top: " + (Y / 2) + "px; left: 0px; width: 100%;'>" + 
			"loading...</div>" + 
			"<div style='position:absolute; z-index: 2; left: 0px; top: 0px; width: 100%; height: 100%;'>" + 
			"<a href='javascript:window.close();' onMouseOver='window.status=\"Click on any part of the image to close this window.\"; return true;' title='[Close Window]'>" + 
			"<img src='"+URL+"' width='100%' height='100%' border='0' alt='[Close Window]'></a></div>");
	}
	else {
		imageWin = window.open("","IMG","width="+X+",height="+Y+",left="+wideSpace+",top="+highSpace+",status=0,resizable=0,scrollbars=0");
		imageWin.document.open();
		imageWin.document.write("<html><title>&copy;" + year + ", All-About-Tom.com</title><body style='margin: 0px;' ");
		if (parseInt(navigator.appVersion) > 5) {
			imageWin.document.write("onLoad='self.resizeTo("+(X + 6)+","+(Y + 25)+");");
		}
		imageWin.document.write("self.moveTo("+wideSpace+","+highSpace+");self.focus();self.refresh();' onBlur='setTimeout(self.close, 10000);'>" + 
			"<div style='position:absolute; left:0px; top:0px'>" + 
			"<a href='javascript:window.close();'>" + 
			"<img src='"+URL+"' width='"+X+"' height='"+Y+"' border='0' alt='[Close Window]'>" + 
			"</a></div></body></html>");
	}
	imageWin.document.close();
	imageWin.focus();
}

// Function that opens and centers an enlarged image in generated HTML
function popZoom(URL,X,Y) {
	var now = new Date();
	var year = now.getYear();
	if (year < 2000)
	year = year + 1900;
	var wideSpace = (screen.width - (X * 3) -10) / 2;
	var highSpace = (screen.height - (Y * 3) - 28) / 2;
	if (navigator.appName == 'Microsoft Internet Explorer') {
		zoomWin = window.open("","IMG","width="+(X * 3)+",height="+(Y * 3)+",left="+wideSpace+",top="+highSpace+",resizable=1,scrollbars=0");
		zoomWin.document.open();
		zoomWin.document.write("<html><title>All-About-Tom.com</title><body style='margin: 0px;' onLoad='self.resizeTo(" + ((X * 3) + 12) + "," + ((Y * 3) + 31) + ");self.moveTo("+wideSpace+","+highSpace+");self.focus();status=\"Click on any part of the image to close this window.\";' onBlur='setTimeout(self.close, 10000);' marginwidth='0' marginheight='0'>" + 
			"<div style='position:absolute; z-index: 2; left:0px; top:0px; width: 100%; height: 100%;'>" + 
			"<a href='javascript:window.close();'>" + 
			"<img src='"+URL+"' width='100%' height='100%' border='0' alt='[Close Window]'></a></div></body></html>");
	}
	else {
		zoomWin = window.open("","IMG","width="+(X * 3)+",height="+(Y * 3)+",left="+wideSpace+",top="+highSpace+",resizable=1,scrollbars=0");
		zoomWin.document.open();
		zoomWin.document.write("<html><title>&copy;2003, All-About-Tom.com</title><body ");
		if (parseInt(navigator.appVersion) < 5) {
			zoomWin.document.write("onLoad='self.resizeTo("+(X * 3)+","+(Y * 3)+");");
		}
		else {
			zoomWin.document.write("onLoad='self.resizeTo("+((X * 3) + 8)+","+((Y * 3) + 29)+");");
		}
		zoomWin.document.write("self.moveTo("+wideSpace+","+highSpace+");self.focus();' onBlur='setTimeout(self.close, 10000);'>" + 
			"<div style='position:absolute; left:0px; top:0px'>" + 
			"<a href='javascript:window.close();'>" + 
			"<img src='"+URL+"' width='"+(X*3)+"' height='"+(Y*3)+"' border='0' alt='[Close Window]'>" + 
			"</a></div></body></html>");
	}
	zoomWin.document.close();
	zoomWin.focus();
}

// Function that opens and centers a captioned image in generated HTML
function popCapImage(URL,X,Y,caption) {
	var now = new Date();
	var year = now.getYear();
	if (year < 2000)
	year = year + 1900;
	var wideSpace = (screen.width - X - 10) / 2;
	var highSpace = (screen.height - Y - 8) / 2;
	if (navigator.appName == 'Microsoft Internet Explorer') {
		capImageWin = window.open("","IMG","width="+X+",height="+(Y + 30)+",left="+wideSpace+",top="+highSpace+",status=1,resizable=1,scrollbars=0");
		capImageWin.document.open();
		capImageWin.document.write("<html><title>All-About-Tom.com</title><body onLoad='self.resizeTo("+(X + 12)+","+(Y + 80)+");self.moveTo("+wideSpace+","+(highSpace - 28)+");self.focus();status=\"Click on any part of the image to close this window.\";' onBlur='setTimeout(self.close, 10000);' marginwidth='0' marginheight='0'>" + 
			"<div style='color: #e90; font-size: 24pt; font-family: Cupertino, Verdana; text-align: center; position: absolute; z-index: 1;" + 
			"top: " + (Y / 2) + "px; left: 0px; width: 100%;'>" + 
			"loading...</div>" + 
			"<div style='color: #e90; position: absolute; z-index: 2; top: 0px; left: 0px;'>" + 
			"<a href='javascript:window.close();' onMouseOver='window.status=\"Click on any part of the image to close this window.\"; return true;'>" + 
			"<img src='"+URL+"' width='" + X + "' height='" + Y + "' border='0' alt='[Close Window]'></a></div>" + 
			"<div style='color: #c60; font-size: 8pt; font-family: Tahoma, Verdana, Arial; text-align: center; padding-top: 4px; padding-bottom: 4px; border-top: 8px solid #000; position: absolute; z-index: 3;" + 
			"top: " + Y + "px; left: 0px; width: " + X + "px; height: 29px; cursor: default;'>" + caption + "</div>" + 
			"<div style='color: #a9a9a9; font-weight: bold; font-size: 7pt; font-family: Tahoma, Verdana, Arial; background-color: #fff; padding: 3px; padding-left: 4px; border-top: 8px solid #000; border-left: 8px solid #000; position: absolute; z-index: 3;" + 
			"top: " + (Y - 26) + "px; left: " + (X - 108) + "px; width: 108px; height: 26px; cursor: default;'>&copy;" + year + ", Tom Ryan</div></body></html>");
	}
	else {
		capImageWin = window.open("","IMG","width="+X+",height="+(Y + 14)+",left="+wideSpace+",top="+highSpace+",status=0,resizable=1,scrollbars=0");
		capImageWin.document.open();
		capImageWin.document.write("<html><title>&copy;" + year + ", All-About-Tom.com</title><body ");
		if (parseInt(navigator.appVersion) < 5) {
			capImageWin.document.write("onLoad='self.resizeTo("+X+","+(Y + 14)+");self.moveTo("+wideSpace+","+(highSpace - 7)+");self.focus();' onBlur='setTimeout(self.close, 10000);'>" + 
			"<div style='color: #c60; font-family: Tahoma, Verdana, Arial; font-size: 8pt; position:absolute; left:0px; top:0px; cursor: default;'>");
		}
		else {
			capImageWin.document.write("onLoad='self.resizeTo("+(X + 8)+","+(Y + 43)+");self.moveTo("+wideSpace+","+(highSpace - 21)+");self.focus();' onBlur='setTimeout(self.close, 10000);'>" + 
				"<div style='color: #c60; font-family: Tahoma, Verdana, Arial; font-size: 8pt; text-align: center; position:absolute; left:0px; top:0px; cursor: default;'>");
		}
		capImageWin.document.write("<a href='javascript:window.close();'>" + 
			"<img src='"+URL+"' width='"+X+"' height='"+Y+"' border='0' alt='[Close Window]'>" + 
			"</a><br /><center>"+caption+"</center></div></body></html>");
	}
	capImageWin.document.close();
	capImageWin.focus();
}

// Function that opens and centers a Flash animation in generated HTML
function popFlash(URL,X,Y) {
	var now = new Date();
	var year = now.getYear();
	if (year < 2000)
	year = year + 1900;
	var wideSpace = (screen.width - X - 10) / 2;
	var highSpace = (screen.height - Y - 8) / 2;
	popFlash = window.open("","SWF","width="+(X+8)+",height="+(Y+87)+",left="+wideSpace+",top="+highSpace+",scrollbars=1");
	popFlash.document.open();
	popFlash.document.write("<html><title>&copy;" + year + ", All-About-Tom.com</title><body onLoad='self.resizeTo("+(X+8)+","+(Y+87)+");self.moveTo("+wideSpace+","+highSpace+");self.focus();'><div style='position:absolute; left:0px; top:0px'>" + 
		"<object classid='clsid:D27CDB6E-AE6D-11CF-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='"+X+"' height='"+Y+"' id='popFlash'>" + 
		"<param name='movie' value='"+URL+"'><param name='quality' value='high'>" + 
		"<embed src='"+URL+"' quality='high' width='"+X+"' height='"+Y+"' name='popFlash' align='' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'>" + 
		"</embed></object></div></body></html>");
	popFlash.document.close();
	popFlash.focus();
}

// Function that opens and centers a web page in a new window with or without scrollbars
function popPage(URL,X,Y,scroll) {
	var wideSpace = (screen.width - X - 10) / 2;
	var highSpace = (screen.height - Y - 28) / 2;
	var popPageWin = window.open(URL,"popPage","width="+X+",height="+Y+",left="+wideSpace+",top="+highSpace+",status=1,scrollbars="+scroll);
}

// Function that opens a web page in a new, full-screen window
function popFull(URL) {
	var X = (screen.width - 10);
	var Y = (screen.height - 28);
	var popFullWin = window.open(URL,"popFull","width="+X+",height="+Y+",left=0,top=0,scrollbars="+scroll);
}

// Function that opens and centers another website in a new window
function popSite(URL) {
	var X = (screen.width - 110);
	var Y = (screen.height - 200);
	var popSiteWin = window.open(URL,"popSite","width="+X+",height="+Y+",left=50,top=50,toolbar=1,menubar=1,status=1,location=1,resizable=1,scrollbars=1");
}

// Function that asks a question before opening a site in a new window
function confirmPopSite(Query,URL) {
	var X = (screen.width - 110);
	var Y = (screen.height - 200);
	var answer = confirm(Query)
	if (answer) {
		window.open(URL,"popSite","width="+X+",height="+Y+",left=50,top=50,toolbar=1,menubar=1,status=1,location=1,resizable=1,scrollbars=1");
	}
}

// Function that scrolls through an image gallery
function imgScroll(X,D) {
	var distance = (X * D);
	scroll(distance);
}