// JavaScript Document');

var Home = "http://heathrobinson.org/";
// var Home = "http://louisa.netweaver.co.uk/~heathrob/";

var MenuGroupName = new Array();
var MenuGroupPageTitle = new Array();
var MenuGroupFolder = new Array();
var MenuGroupLink = new Array();
var MenuGroupLink2 = new Array();
var MenuGroupSubLimit = new Array();
var MenuGroupSubNames = new Array();
var MenuGroupSubPageTitles = new Array();
var MenuGroupSubFolders = new Array();
var MenuGroupSubLinks = new Array();
var MenuSubName = new Array();
var MenuSubFolder = new Array();
var MenuSubLink = new Array();
var MiniName = new Array();
var MiniLink = new Array();

var I = 0;
MenuGroupName[I] = 'Homepage';
MenuGroupPageTitle[I] = 'Homepage';
MenuGroupFolder[I] = '';
MenuGroupLink[I] = 'index.htm';

I++;
MenuGroupName[I] = 'About the Trust';
MenuGroupPageTitle[I] = 'About the Trust';
MenuGroupFolder[I] = 'trust/';
MenuGroupLink[I] = 'index.htm';
MenuGroupSubNames[I] = '';

I++;
MenuGroupName[I] = 'W H Robinson';
MenuGroupPageTitle[I] = 'About William Heath Robinson';
MenuGroupFolder[I] = 'robinson/';
MenuGroupLink[I] = 'index.htm';
MenuGroupSubNames[I] = '';

I++;
MenuGroupName[I] = 'Museum';
MenuGroupPageTitle[I] = 'The Heath Robinson Museum';
MenuGroupFolder[I] = 'museum/';
MenuGroupLink[I] = 'index.htm';
MenuGroupSubNames[I] = '';

I++;
MenuGroupName[I] = 'Touring Exhibition';
MenuGroupPageTitle[I] = 'The Touring Exhibition';
MenuGroupFolder[I] = 'exhibition/';
MenuGroupLink[I] = 'index.htm';
MenuGroupSubNames[I] = '';

I++;
MenuGroupName[I] = 'Copyright';
MenuGroupPageTitle[I] = 'Copyright';
MenuGroupFolder[I] = 'copyright/';
MenuGroupLink[I] = 'index.htm';
MenuGroupSubNames[I] = '';

I++;
MenuGroupName[I] = 'Contact Us';
MenuGroupPageTitle[I] = 'How to Contact Us';
MenuGroupFolder[I] = 'contact/';
MenuGroupLink[I] = 'index.htm';
MenuGroupSubNames[I] = '';


X = new String(window.location.href);
var ThisPageFileString = X.substr(X.indexOf(Home)+Home.length, X.length-X.indexOf(Home)-Home.length);
Y = new String(window.location.href);
var ThisPageFolderName = Y.substr(Y.indexOf(Home)+Home.length, Y.lastIndexOf('/')-Y.indexOf(Home)-Home.length) + '/';

Z = new String(window.location.href);
P = new String(Z.substr(Z.indexOf(Home)+Home.length, Z.lastIndexOf('/')-Z.indexOf(Home)-Home.length) + '/');
Q = new String(P.substr(P.indexOf('/')+1, P.lastIndexOf('/')-P.indexOf('/')));
var LevelOne = P.substr(0,P.indexOf('/')) + '/';
var LevelTwo = Q.substr(0,Q.indexOf('/')) + '/';

var IsASubSelected;
var MenuCode = "";
var ThisPageName = "Homepage";

// Loop through each page in the menu to determine how to construct the menu line
// This will depend on the type of menu construction and which page is currently being displayed
for (var i = 0; i < MenuGroupName.length; i++) {

// Each page in the menu can be one of three types ... 
// Top Level (ie Homepage)
// Single Page (with no pages below it)
// Multiple Page (either the top of the group or a member in the group
// Determine which of the three types of page it is ...
// ... and work out if it is the current page
if      (MenuGroupFolder[i].length == 0)  // Is this a top level page - ie is it the homepage (which is never in a sub-folder)
        {if   (MenuGroupLink[i] == ThisPageFileString)  // Is this the current page
              {ThisPageName = MenuGroupPageTitle[i];
			   MenuCode += '<p class="XLineSingle"><a href="' + Home + MenuGroupLink[i] + '" class="XLinkThis"><img src="' + Home + '_graphics/menubulletchosen.gif" border="0">' + MenuGroupName[i] + '</a></p>';}
         else {MenuCode += '<p class="XLineSingle"><a href="' + Home + MenuGroupLink[i] + '" class="XLink"><img src="' + Home + '_graphics/menubullet.gif" border="0">' + MenuGroupName[i] + '</a></p>';}
	    }
else if (MenuGroupSubNames[i].length == 0) // Is this a single page below the top level (ie it has no sub pages)
        {if   (MenuGroupFolder[i] == LevelOne)  // Is this the current page
              {ThisPageName = MenuGroupPageTitle[i];
			   MenuCode += '<p class="XLineSingle"><a href="' + Home + MenuGroupFolder[i] + MenuGroupLink[i] + '" class="XLinkThis"><img src="' + Home + '_graphics/menubulletchosen.gif" border="0">' + MenuGroupName[i] + '</a></p>';}
         else {MenuCode += '<p class="XLineSingle"><a href="' + Home + MenuGroupFolder[i] + MenuGroupLink[i] + '" class="XLink"><img src="' + Home + '_graphics/menubullet.gif" border="0">' + MenuGroupName[i] + '</a></p>';}
        }
else    {// Then ... it must be a multi page ... either the group page or a sub page
         MenuSubName = MenuGroupSubNames[i].split('#');
         MenuSubPageTitle = MenuGroupSubPageTitles[i].split('#');
         MenuSubFolder = MenuGroupSubFolders[i].split('#');
         MenuSubLink = MenuGroupSubLinks[i].split('#');
		 // Now it gets a little complicated: we are checking three option
		 // (1) the current page is the group page - in which case we display it as select and display the sub pages
		 // (2) the current page is one of the sub pages within this group - in which case we display the group page and the sub pages (showing the current page as selected)
		 // (3) the current page has nothing to do with this group - so we display the group page as nornal
		 // Here goes ...
		 // (1) See if the current page is the group level page
		 if  (ThisPageFileString == MenuGroupFolder[i] + MenuGroupLink[i])  // It is, so we show the group page as the current page 
              {ThisPageName = MenuGroupPageTitle[i];
			   MenuCode += '<p class="XLineGroup"><a href="' + Home + MenuGroupFolder[i] + MenuGroupLink[i] + '" class="XLinkThis"><img src="' + Home + '_graphics/menubulletchosen.gif" border="0">' + MenuGroupName[i] + '</a></p>';
			   for  (var j=0; j < MenuSubName.length; j++)
                    {MenuCode += '<p class="XLineSub"><a href="' + Home + MenuSubFolder[j] + MenuSubLink[j] + '" class="XSubLink">' + MenuSubName[j] + '</a></p>';}}
         else {// (2) See if one of the entries within the group has the same folder as the current page
               IsASubSelected = "-1";
               for  (var j=0; j < MenuSubName.length; j++){if  (ThisPageFolderName == MenuSubFolder[j]) {IsASubSelected = j; }}
               if   (IsASubSelected > -1)
                    {// One of the entries within the group has the same folder as the current page
  				     MenuCode += '<p class="XLineGroup"><a href="' + Home + MenuGroupFolder[i] + MenuGroupLink[i] + '" class="XLink"><img src="' + Home + '_graphics/menubulletchosen.gif" border="0">' + MenuGroupName[i] + '</a></p>';
                     for  (var j=0; j < MenuSubName.length; j++)
                          {if   (ThisPageFolderName == MenuSubFolder[j])
  						        {ThisPageName = MenuSubPageTitle[j];
			                     MenuCode += '<p class="XLineSub"><a href="' + Home + MenuSubFolder[j] + MenuSubLink[j] + '" class="XSubLinkThis">' + MenuSubName[j] + '</a></p>';}
  					       else {MenuCode += '<p class="XLineSub"><a href="' + Home + MenuSubFolder[j] + MenuSubLink[j] + '" class="XSubLink">' + MenuSubName[j] + '</a></p>';}}}
  			   else {MenuCode += '<p class="XLineGroup"><a href="' + Home + MenuGroupFolder[i] + MenuGroupLink[i] + '" class="XLink"><img src="' + Home + '_graphics/menubullet.gif" border="0">' + MenuGroupName[i] + '</a></p>';}
	          }
       }
// end of loop
}
  
  
  
document.write ('<div style="margin-right:auto;margin-left:auto;margin-top:10px;width:900px;">');
document.write ('<table width="900" border="0" cellspacing="0" cellpadding="0" style="margin:0px; padding:0px;">');
document.write ('<tr>');
document.write ('<td width="900" height="130" colspan="2" style="border-top:1px solid #000000;border-left:1px solid #000000;border-right:1px solid #000000;background-color:#F0F0E2;margin:0px; padding:0px;">');
document.write ('<table><tr><td width="150" align="center">');
document.write ('<img src="' + Home + '_graphics/logo.jpg">');
document.write ('</td><td width="730" align="center" valign="top">');
if   ((ThisPageFileString == "index.htm") || (ThisPageFileString == ""))
     {document.write('<img src="_graphics/titlelogo.jpg">');}
else {document.write ('<p style="padding: 0px 0px 0px 0px;text-align: center;margin: 0px 0px 0px 0px;"><img src="' + Home + '_graphics/titlelogosmall.jpg"></p>');
      document.write ('<p style="font-size: 20px;padding: 0px 0px 0px 0px;color: #3C003C;font-style: normal;text-decoration: none;text-align: center;margin: 5px 0px 0px 0px;">' + ThisPageName + '</p>');}
document.write ('</tr></table>');
document.write ('</td>');
document.write ('</tr>');
document.write ('<tr>');
document.write ('<td width="160" height="600" style="border-left:1px solid #000000; border-right:1px solid #CCCCCC; vertical-align:top;background-color:#F0F0E2;">');	
document.write (MenuCode);
document.write('<p class="XLineSingle"><span class="XLink">&nbsp;</span></p>');
document.write ('</td>');
document.write ('<td width="740" valign="top" style="border-right:1px solid #000000;border-top:1px solid #CCCCCC;padding:5px 5px 5px 5px;margin:0px 0px 0px 0px;text-align:center;background-color:#F0F0E2;">');




function PageEnd(Footer) {
Footer ='&copy; The William Heath Robinson Trust';
document.write ('</div></td>');
document.write ('</tr>');
document.write ('<tr>');
var months = new Array ( );
months[months.length] = "January";
months[months.length] = "February";
months[months.length] = "March";
months[months.length] = "April";
months[months.length] = "May";
months[months.length] = "June";
months[months.length] = "July";
months[months.length] = "August";
months[months.length] = "September";
months[months.length] = "October";
months[months.length] = "November";
months[months.length] = "December";
DMstring = document.lastModified;
DMdate = new Date(DMstring);
var YEAR = DMdate.getYear();
if  (YEAR < 2000)
    {YEAR += 1900;}
document.write ('<td width="900" colspan="2" height="25" style="border:1px solid #000000;border-top:1px solid #CCCCCC;font-size:11px;color:#000080;background-color:#F0F0E2;">Page updated: ' + DMdate.getDate() + ' ' + months[DMdate.getMonth()] + ' ' + YEAR + '&nbsp;&nbsp;-&nbsp;&nbsp;' + Footer +' </td>');
document.write ('</tr>');
document.write ('<tr>');
document.write ('<td width="900" colspan="2" height="250" style="border:0px 0px 0px 0px;font-family:Arial, Helvetica, sans-serif;background-color:#666666;background-image: url(http://louisa.netweaver.co.uk/~heathrob/_graphics/grain.gif);">&nbsp;</td>');
document.write ('</tr>');
document.write ('</table></div>');
}


