function openPage(title, date) {
	document.write("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">");
	document.write("<HTML>");
	document.write("<HEAD>");
	document.write("<SCRIPT SRC=/hitcount.js></SCRIPT>");
	document.write("<LINK REL=STYLESHEET HREF=/ftree/ftree.css TYPE=text/css>");
	document.write("<TITLE>" + title + "</TITLE>");
	document.write("</HEAD>");
	document.write("<BODY>");
	document.write("<H1>" + title + "</H1>");
	document.write("<P>" + date + "</P>");
}

function flexImage(fileRoot, alignment, comment) {
	switch (alignment) {
		case "TL":
			style = "STYLE=\"margin-top: 0pt; margin-bottom: 1ex; margin-left: 0pt; margin-right: 3ex;\"";
			align = "ALIGN=LEFT";
			break;
		case "TR":
			style = "STYLE=\"margin-top: 0pt; margin-bottom: 1ex; margin-left: 3ex; margin-right: 0pt;\"";
			align = "ALIGN=RIGHT";
			break;
		case "ML":
			style = "STYLE=\"margin-top: 1ex; margin-bottom: 1ex; margin-left: 0pt; margin-right: 3ex;\"";
			align = "ALIGN=LEFT";
			break;
		case "MR":
			style = "STYLE=\"margin-top: 1ex; margin-bottom: 1ex; margin-left: 3ex; margin-right: 0pt;\"";
			align = "ALIGN=RIGHT";
			break;
		case "BR":
			style = "STYLE=\"margin-top: 1ex; margin-bottom: 0pt; margin-left: 3ex; margin-right: 0pt;\"";
			align = "ALIGN=LEFT";
			break;
		case "BR":
			style = "STYLE=\"margin-top: 1ex; margin-bottom: 0pt; margin-left: 3ex; margin-right: 0pt;\"";
			align = "ALIGN=RIGHT";
			break;
	}
	if (screen.width > 1000) {
		document.write(
			"<IMG SRC=\"" +	fileRoot + ".jpg" 
		+ 	"\" VALIGN=TOP " + align 
		+ 	" CLEAR=none " + style 
		+ 	" ALT=\"" + comment + "\""
		);
	}
	else {
		// Use the low resolution image (with the _lr postfix to the name)
		document.write(
			"<IMG SRC=\"" +	fileRoot + "_lr.jpg" 
		+ 	"\" VALIGN=TOP " + align 
		+ 	" CLEAR=none " + 	style 
		+ 	" ALT=\"" + comment + "\""
		);
	}
}

function closePage() {
	document.write("<P>");
	document.write("<HR>");
	if (parent.frames.length == 0) {
		document.write("<P CLASS=error><B>N.B. </B>This site is designed to be viewed with a menu. Click <A HREF=/ftree/index.html TARGET=_top>here</A> to display the home page and menu.</P>");
	}
	document.write("<P><TABLE CLASS=layout WIDTH=100%><TR><TD CLASS=layout ALIGN=left>[ ");
	document.write("<A HREF=/ftree/home.html onMouseOver=\"status='Home page'; return true;\" onMouseOut=\"status='';\">Home</A>");
	document.write(" | ");
	document.write("<A HREF=/ftree/search.html onMouseOver=\"status='Search this site'; return true;\" onMouseOut=\"status='';\">Search</A>");
	document.write(" | ");
	document.write("<A HREF=/ftree/sitemap.html onMouseOver=\"status='See a map of this site'; return true;\" onMouseOut=\"status='';\">Site Map</A>");
	document.write(" | ");
	document.write("<A HREF=mailto:ftree@r-senior.demon.co.uk onMouseOver=\"status='Send e-mail to richard@r-senior.demon.co.uk'; return true;\" onMouseOut=\"status='';\">E-Mail</A>");
	document.write(" ]</TD>");
	if (Date.parse(document.lastModified) != 0) {
		document.write('<TD ALIGN=right CLASS=layout STYLE="color: #c0c0c0; text-align: right; font-size: x-small">Last uploaded ' +  document.lastModified + '</TD>');
	}
	document.write("</TABLE></P>");
	registerHit();
	document.write("</BODY>");
	document.write("</HTML>");
}
