// Main Routines to create and populate page layout

function PageStart(prefix)
{
	if (prefix == null) { prefix = ""; }
	document.write('<BODY topmargin=0 leftmargin=0>');
	document.write('<TABLE width=100% border=0 cellpadding=0 cellspacing=0>');
	document.write('<!-- Header Row -->');
	document.write('<TR><TD BGCOLOR="#f5e4c2" colspan=4>');
	document.write('<FONT Face="Arial" SIZE=6 color="Maroon"><CENTER>Martin Baxter\'s Web Pages</CENTER></FONT>');
	document.write('</TR>');
	document.write('<TR><TD width=15>&nbsp;<TD width=230 valign=top>&nbsp;');
	document.write('<!-- Menubar -->');
	document.write('<CENTER><IMG SRC="' + prefix + 'mwb_new.jpg" alt="Martin Baxter"></CENTER><P>');
	document.write('<TABLE cellspacing=2 class=menubar>');
	document.write('<TR CLASS=headerstyle><TD><B><A href="' + prefix + 'index.html">Home page</A></B></TD></TR>');
	document.write('<TR CLASS=menuitem><TD><A href="http://www.electoralcalculus.co.uk/index.html">UK General Election Prediction</A><BR><FONT size=-1>Analysis of past elections and predictions for the next one</FONT></TD></TR>');
	document.write('<TR CLASS=menuitem><TD><A href="http://www.financialcalculus.co.uk/book.html">Financial Calculus</A><BR><FONT size=-1>Information about the best-selling book about derivative pricing</FONT></TD></TR>');
	document.write('<TR CLASS=menuitem><TD><A href="' + prefix + 'publist.html">Academic Publications</A><BR><FONT size=-1>Various public papers available for download</FONT></TD></TR>');
	document.write('<TR CLASS=menuitem><TD><A href="' + prefix + 'cv.html">CV</A> <FONT size=-1>for Martin Baxter</FONT></TD></TR>');
	document.write('<TR CLASS=menuitem><TD><A href="' + prefix + 'trivia.html">Trivia</A><BR><FONT size=-1>With Point Ruler, Black Wednesday and invasions</FONT></TD></TR>');
	document.write('<TR CLASS=menuitem><TD><A href="' + prefix + 'contact.html">Contact information</A></TD></TR>');
	homename = "home"
	homeserver = "martinbaxter.co.uk"	
	document.write('<TR CLASS=menuitem><TD><A href=mailto:' + homename + '@' + homeserver + '>Email me</A></TD></TR>');
	document.write('</TABLE>');
	document.write('<HR width=230 align=left>');
	document.write('<FONT size=-2>&copy; 2011 Martin Baxter</FONT>');
	document.write('<!-- End of Menubar -->');
	document.write('<TD width=20 valign=top>&nbsp;');	// blank space between menubar and rest of page
	document.write('<TD valign=top><BR>');
	return;
}

function PageEnd()
{
	document.write('</TR>');
	document.write('</TABLE>');
	document.write('</BODY>');
	return;
}



function log(message)
{
	if (!log.window_ || log.window_.closed) 
	{
		var win = window.open("", null, "width=400,height=200," +
							  "scrollbars=yes,resizable=yes,status=no," +
							  "location=no,menubar=no,toolbar=no");
		if (!win) return;
		var doc = win.document;
		doc.write("<html><head><title>Debug Log</title></head>" +
				  "<body></body></html>");
		doc.close();
		log.window_ = win;
	}
	var logLine = log.window_.document.createElement("div");
	logLine.appendChild(log.window_.document.createTextNode(message));
	log.window_.document.body.appendChild(logLine);
}

