// JavaScript Document
function menuItem(HRef, Title, ThisPage, up)
{
	HRef = up + HRef;
	if (HRef == ThisPage)
  {
    cell = '<tr><td class="menu selected">' + Title + '</td></tr>';
  }
  else
  {
		cell = '<tr><td class="menu link" id="' + Title + '" onmouseover=\'document.getElementById("' + Title + '").bgColor="#FF9966"\' onmouseout=\'document.getElementById("' + Title + '").bgColor="#FFFFCC"\' bgcolor="#FFFFCC" onclick=\'window.location="' + HRef + '"\'><a href="' + HRef + '">' + Title + '</a></td></tr>';
  }
	document.write(cell);
}

function menuBuilder(myLocation, up)
{
	var strLocation = "'" + myLocation + "'";
	var myLength = strLocation.length;
	var ThisPage = strLocation.slice(strLocation.lastIndexOf('/', myLength) + 1, myLength - 1);
	
  document.write('<table class="menu">');
  menuItem("Home.html",       "Home",     ThisPage, up);
  menuItem("Contact.html",    "Contact",  ThisPage, up);
  menuItem("Links.html",      "Links",    ThisPage, up);
  document.write('</table>');
}

function mcsmail(recipient)
{
  var add2 = 'moorcroftcs.co.uk';
  var address = '<a href="mailto: ' + recipient + '@' + add2 + '">' + recipient + '@' + add2 + '</a>';
  document.write(address);
}

function writeFooter()
{ 
  var lmDate = new Date(document.lastModified);
  var day = lmDate.getDate();
  var mon = lmDate.getMonth() + 1;
  var yr = lmDate.getYear();
  if (navigator.appName.indexOf('Microsoft') == -1) yr += 1900;
  var footer = '<table class="footer"><tr><td class="footer">&copy; ' + yr 
  + ' Anthony Houghton</td><td class="footer" style="text-align:center;"><script language="JavaScript" type="text/javascript">mcsmail("webmaster");</script></td><td class="footer" style="text-align:right;">Last updated: ' 
  + day + '/' + mon + '/' + yr + '</td></tr></table>';
  document.write(footer);
}

