function tofront(thelink, wintype, winwi, winhi) {
	var winName = thelink.target;
	makeFrontWindow(thelink, winName, wintype, winwi, winhi);
}

function makeFrontWindow (thelink, winName, wintype, winwi, winhi) {
/*The wintypes are:

idtl = image detail views (only scroll and resize, default size in pixels); page should include a close link

fdoc = documents in frames (e.g. pdf) (only scroll and resize, default size relative to screen if available); should include a close link

default (all features enabled, default size relative to screen if available)
*/

	if (wintype == "idtl") {
	 if (!winwi) { winwi = 620; } /* if size is not passed as arguments, use these defaults */
	 if (!winhi) { winhi = 490; }
		startpostn = "screenx=50,screeny=50,left=50,top=50";
	 newWindow = window.open(thelink, winName, "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no,width=" + winwi + ",height=" + winhi + startpostn);
	}
	
	if (wintype == "fdoc") {
		if (!winwi && !winhi) {
			if (window.screen) { /* if size is not passed as arguments, use % of screen size */
				winwi = screen.width * .9;
				winhi = screen.height * .82;
			}
		}
	 if (!winwi) { winwi = 750; } /* if screen size is unknowm use these as defaults */
	 if (!winhi) { winhi = 550; }
		startpostn = "screenx=50,screeny=50,left=50,top=50";
		newWindow = window.open(thelink, winName, "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no,width=" + winwi + ",height=" + winhi + startpostn);
	}
	
	else {
		if (!winwi && !winhi) {
			if (window.screen) { /* if size is not passed as arguments, use % of screen size */
				winwi = screen.width * .9;
				winhi = screen.height * .68; /* smaller size required to allow for additional chrome */
			}
		}
	 if (!winwi) { winwi = 750; } /* if screen size is unknowm use these as defaults */
	 if (!winhi) { winhi = 525; }
		startpostn = "screenx=25,screeny=25,left=25,top=25";
	 newWindow = window.open(thelink, winName, "scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,location=yes,status=yes,width=" + winwi + ",height=" + winhi + startpostn);
	}

	newWindow.focus();
}
