// Initialise page
function initialise(boolRssDisplay, boolMailerDisplay, strFolder, strFile) {
	buildMenus();
	metaDataCentre(boolRssDisplay, boolMailerDisplay, strFolder, strFile);
	currentMenu(strFolder, strFile);
	copyright();
}


// Initialise home page
function initialiseHomePage() {
	buildMenus();
	copyright();
	quotes();
	mailerLink();
}


// Initialise error page
function initialiseErrorPage() {
	buildMenus();
	copyright();
}


// Build menus
function buildMenus() {
	var strHTML;

	// Menu 'about_tubewalking'
	strHTML  = '<li><a title="An Introduction to tubewalking" id="about_tubewalking_index" href="../about_tubewalking/index.html">An Introduction to Tubewalking</a></li>\n';
	strHTML += '<li><a title="The rules of tubewalking" id="about_tubewalking_rules_of_tubewalking" href="../about_tubewalking/rules_of_tubewalking.html">The Rules of Tubewalking</a></li>\n';
	strHTML += '<li><a title="Frequently asked questions about tubewalking" id="about_tubewalking_faq" href="../about_tubewalking/faq.html">Frequently Asked Questions</a></li>\n';
	addSubmenu('about_tubewalking', strHTML);

	// Menu 'highlights'
	strHTML  = '<li><a title="My favourite tubewalks" id="highlights_favourite_tubewalks" href="../highlights/favourite_tubewalks.html">My Favourite Tubewalks</a></li>\n';
	strHTML += '<li><a title="My favourite Tube stations" id="highlights_favourite_tube_stations" href="../highlights/favourite_tube_stations.html">My Favourite Tube Stations</a></li>\n';
	strHTML += '<li><a title="The most interesting points of interest on my tubewalk" id="highlights_points_of_interest" href="../highlights/points_of_interest.html">Points of Interest</a></li>\n';
	strHTML += '<li><a title="How I planned my route to walk through Tube history" id="highlights_walking_tube_history" href="../highlights/walking_tube_history.html">Walking Through Tube History</a></li>\n';
	addSubmenu('highlights', strHTML);

	// Menu 'walking_tips'
	strHTML  = '<li><a title="General tips on planning a tubewalk" id="walking_tips_planning_a_tubewalk" href="../walking_tips/planning_a_tubewalk.html">Planning a Tubewalk</a></li>\n';
	strHTML += '<li><a title="A selection of useful books for tubewalkers" id="walking_tips_books" href="../walking_tips/books.html">Useful Books</a></li>\n';
	strHTML += '<li><a title="A list of what to take on a tubewalk" id="walking_tips_what_to_take" href="../walking_tips/what_to_take.html">What to Take</a></li>\n';
	strHTML += '<li><a title="The typical cost of walking the Tube" id="walking_tips_costs" href="../walking_tips/costs.html">Costs</a></li>\n';
	strHTML += '<li><a title="The maps you\'ll need to walk the Tube" id="walking_tips_maps" href="../walking_tips/maps.html">Maps</a></li>\n';
	strHTML += '<li><a title="The weather I enjoyed on my tubewalk" id="walking_tips_weather" href="../walking_tips/weather.html">Weather</a></li>\n';
	//strHTML += '<li><a title="Interesting statistics from my tubewalk" id="walking_tips_walking_statistics" href="../walking_tips/walking_statistics.html">Interesting Statistics</a></li>\n';
	strHTML += '<li><a title="Some useful links for those planning their own tubewalk" id="walking_tips_links" href="../walking_tips/links.html">Useful Links</a></li>\n';
	addSubmenu('walking_tips', strHTML);

	// Menu 'route'
	strHTML  = '<li><a title="A suggested tubewalking route covering the whole network" id="route_index" href="../route/index.html">Overview of the Route</a></li>\n';
	strHTML += '<li><a title="Explore my tubewalk in an interactive map" id="route_google_maps" href="../route/google_maps.html">2D Route in Google Maps</a></li>\n';
	strHTML += '<li><a title="Use Google Earth to view my tubewalk in three dimensions" id="route_google_earth" href="../route/google_earth.html">3D Route in Google Earth</a></li>\n';
	strHTML += '<li><a title="Plan your own tubewalk with my tubewalk planner" id="route_tubewalk_planner" href="../route/tubewalk_planner.php">Tubewalk Planner</a></li>\n';
	addSubmenu('route', strHTML);

	// Menu 'photo_library'
	strHTML  = '<li><a title="A searchable index of all the photographs on my website" id="photo_library_index" href="../photo_library/index.php">Photo Library</a></li>\n';
	strHTML += '<li><a title="A range of free images that you can use as desktop wallpaper" id="photo_library_desktop_wallpaper" href="../photo_library/desktop_wallpaper.html">Desktop Wallpaper</a></li>\n';
	strHTML += '<li><a title="How you can use my images as your Windows or Mac OS screen saver" id="photo_library_screen_saver" href="../photo_library/screen_saver.html">Screen Saver</a></li>\n';
	addSubmenu('photo_library', strHTML);

	// Menu 'iphone'
	strHTML  = '<li><a title="Information on the Tubewalker iPhone application" id="iphone_index" href="../iphone/index.html">Tubewalker iPhone Application</a></li>\n';
	strHTML += '<li><a title="Support information for the Tubewalker iPhone application" id="iphone_support" href="../iphone/support.html">iPhone Support</a></li>\n';
	addSubmenu('iphone', strHTML);

	// Menu 'bakerloo'
	strHTML  = '<li><a title="A map of the Bakerloo line section of my tubewalk" id="bakerloo_index" href="../bakerloo/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Bakerloo line" id="bakerloo_history" href="../bakerloo/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Elephant &amp; Castle to Willesden Junction" id="bakerloo_elephant_and_castle_to_willesden_junction" href="../bakerloo/elephant_and_castle_to_willesden_junction.html">Elephant &amp; Castle to Willesden Junction</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Willesden Junction to Harrow &amp; Wealdstone" id="bakerloo_willesden_junction_to_harrow_and_wealdstone" href="../bakerloo/willesden_junction_to_harrow_and_wealdstone.html">Willesden Junction to Harrow &amp; Wealdstone</a></li>\n';
	addSubmenu('bakerloo', strHTML);


	// Menu 'central'
	strHTML  = '<li><a title="A map of the Central line section of my tubewalk" id="central_index" href="../central/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Central line" id="central_history" href="../central/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from West Ruislip to Perivale" id="central_west_ruislip_to_perivale" href="../central/west_ruislip_to_perivale.html">West Ruislip to Perivale</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Perivale and Ealing Broadway to Shepherd\'s Bush" id="central_perivale_and_ealing_broadway_to_shepherds_bush" href="../central/perivale_and_ealing_broadway_to_shepherds_bush.html">Perivale and Ealing Broadway to Shepherd\'s Bush</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Shepherd\'s Bush to Liverpool Street" id="central_shepherds_bush_to_liverpool_street" href="../central/shepherds_bush_to_liverpool_street.html">Shepherd\'s Bush to Liverpool Street</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Liverpool Street to Leytonstone" id="central_liverpool_street_to_leytonstone" href="../central/liverpool_street_to_leytonstone.html">Liverpool Street to Leytonstone</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Leytonstone to Debden" id="central_leytonstone_to_debden" href="../central/leytonstone_to_debden.html">Leytonstone to Debden</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Debden to Epping" id="central_debden_to_epping" href="../central/debden_to_epping.html">Debden to Epping</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Leytonstone to Barkingside" id="central_leytonstone_to_barkingside" href="../central/leytonstone_to_barkingside.html">Leytonstone to Barkingside</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Barkingside to Woodford" id="central_barkingside_to_woodford" href="../central/barkingside_to_woodford.html">Barkingside to Woodford</a></li>\n';
	addSubmenu('central', strHTML);


	// Menu 'circle'
	strHTML  = '<li><a title="A map of the Circle line section of my tubewalk" id="circle_index" href="../circle/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Circle line" id="circle_history" href="../circle/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Aldgate to Tower Hill and Gloucester Road to High Street Kensington" id="circle_aldgate_to_tower_hill_and_gloucester_road_to_high_street_kensington" href="../circle/aldgate_to_tower_hill_and_gloucester_road_to_high_street_kensington.html">Aldgate to Tower Hill and Gloucester Road to High Street Kensington</a></li>\n';
	addSubmenu('circle', strHTML);



	// Menu 'district'
	strHTML  = '<li><a title="A map of the District line section of my tubewalk" id="district_index" href="../district/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the District line" id="district_history" href="../district/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Richmond to Ealing Broadway" id="district_richmond_to_ealing_broadway" href="../district/richmond_to_ealing_broadway.html">Richmond to Ealing Broadway</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Turnham Green and Kensington (Olympia) to Victoria" id="district_turnham_green_and_kensington_olympia_to_victoria" href="../district/turnham_green_and_kensington_olympia_to_victoria.html">Turnham Green and Kensington (Olympia) to Victoria</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Victoria to Bow Road" id="district_victoria_to_bow_road" href="../district/victoria_to_bow_road.html">Victoria to Bow Road</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Bow Road to Becontree" id="district_bow_road_to_becontree" href="../district/bow_road_to_becontree.html">Bow Road to Becontree</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Becontree to Upminster" id="district_becontree_to_upminster" href="../district/becontree_to_upminster.html">Becontree to Upminster</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Wimbledon to Edgware Road" id="district_wimbledon_to_edgware_road" href="../district/wimbledon_to_edgware_road.html">Wimbledon to Edgware Road</a></li>\n';
	addSubmenu('district', strHTML);


	// Menu 'east_london'

	strHTML  = '<li><a title="A map of the East London line section of my tubewalk" id="east_london_index" href="../east_london/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Hammersmith &amp; City line" id="east_london_history" href="../east_london/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Shoreditch to New Cross and New Cross Gate" id="east_london_shoreditch_to_new_cross_and_new_cross_gate" href="../east_london/shoreditch_to_new_cross_and_new_cross_gate.html">Shoreditch to New Cross and New Cross Gate</a></li>\n';
	addSubmenu('east_london', strHTML);


	// Menu 'hammersmith_and_city'

	strHTML  = '<li><a title="A map of the Hammersmith &amp; City line section of my tubewalk" id="hammersmith_and_city_index" href="../hammersmith_and_city/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Hammersmith &amp; City line" id="hammersmith_and_city_history" href="../hammersmith_and_city/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Hammersmith to Barking" id="hammersmith_and_city_hammersmith_to_barking" href="../hammersmith_and_city/hammersmith_to_barking.html">Hammersmith to Barking</a></li>\n';
	addSubmenu('hammersmith_and_city', strHTML);


	// Menu 'jubilee'
	strHTML  = '<li><a title="A map of the Jubilee line section of my tubewalk" id="jubilee_index" href="../jubilee/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Jubilee line" id="jubilee_history" href="../jubilee/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Stanmore to Dollis Hill" id="jubilee_stanmore_to_dollis_hill" href="../jubilee/stanmore_to_dollis_hill.html">Stanmore to Dollis Hill</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Dollis Hill to Green Park" id="jubilee_dollis_hill_to_green_park" href="../jubilee/dollis_hill_to_green_park.html">Dollis Hill to Green Park</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Green Park to Canada Water" id="jubilee_green_park_to_canada_water" href="../jubilee/green_park_to_canada_water.html">Green Park to Canada Water</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Canada Water to North Greenwich" id="jubilee_canada_water_to_north_greenwich" href="../jubilee/canada_water_to_north_greenwich.html">Canada Water to North Greenwich</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from North Greenwich to Stratford" id="jubilee_north_greenwich_to_stratford" href="../jubilee/north_greenwich_to_stratford.html">North Greenwich to Stratford</a></li>\n';
	addSubmenu('jubilee', strHTML);


	// Menu 'metropolitan'
	strHTML  = '<li><a title="A map of the Metropolitan line section of my tubewalk" id="metropolitan_index" href="../metropolitan/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Metropolitan line" id="metropolitan_history" href="../metropolitan/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Aldgate to Finchley Road" id="metropolitan_aldgate_to_finchley_road" href="../metropolitan/aldgate_to_finchley_road.html">Aldgate to Finchley Road</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Finchley Road to Wembley Park" id="metropolitan_finchley_road_to_wembley_park" href="../metropolitan/finchley_road_to_wembley_park.html">Finchley Road to Wembley Park</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Wembley Park to North Harrow" id="metropolitan_wembley_park_to_north_harrow" href="../metropolitan/wembley_park_to_north_harrow.html">Wembley Park to North Harrow</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from North Harrow to Watford" id="metropolitan_north_harrow_to_watford" href="../metropolitan/north_harrow_to_watford.html">North Harrow to Watford</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Moor Park to Chorleywood" id="metropolitan_moor_park_to_chorleywood" href="../metropolitan/moor_park_to_chorleywood.html">Moor Park to Chorleywood</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Chorleywood to Amersham and Chesham" id="metropolitan_chorleywood_to_amersham_and_chesham" href="../metropolitan/chorleywood_to_amersham_and_chesham.html">Chorleywood to Amersham and Chesham</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Harrow-on-the-Hill to Uxbridge" id="metropolitan_harrow-on-the-hill_to_uxbridge" href="../metropolitan/harrow-on-the-hill_to_uxbridge.html">Harrow-on-the-Hill to Uxbridge</a></li>\n';
	addSubmenu('metropolitan', strHTML);


	// Menu 'northern'
	strHTML  = '<li><a title="A map of the Northern line section of my tubewalk" id="northern_index" href="../northern/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Northern line" id="northern_history" href="../northern/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Morden to Kennington" id="northern_morden_to_kennington" href="../northern/morden_to_kennington.html">Morden to Kennington</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Kennington to Euston to Kennington" id="northern_kennington_to_euston_to_kennington" href="../northern/kennington_to_euston_to_kennington.html">Kennington to Euston to Kennington</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Euston to East Finchley" id="northern_euston_to_east_finchley" href="../northern/euston_to_east_finchley.html">Euston to East Finchley</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from East Finchley to Mill Hill East and High Barnet" id="northern_east_finchley_to_mill_hill_east_and_high_barnet" href="../northern/east_finchley_to_mill_hill_east_and_high_barnet.html">East Finchley to Mill Hill East and High Barnet</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Camden Town to Edgware" id="northern_camden_town_to_edgware" href="../northern/camden_town_to_edgware.html">Camden Town to Edgware</a></li>\n';
	addSubmenu('northern', strHTML);


	// Menu 'piccadilly'
	strHTML  = '<li><a title="A map of the Piccadilly line section of my tubewalk" id="piccadilly_index" href="../piccadilly/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Piccadilly line" id="piccadilly_history" href="../piccadilly/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk around Heathrow Airport" id="piccadilly_heathrow_airport" href="../piccadilly/heathrow_airport.html">Heathrow Airport</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Hatton Cross to Boston Manor" id="piccadilly_hatton_cross_to_boston_manor" href="../piccadilly/hatton_cross_to_boston_manor.html">Hatton Cross to Boston Manor</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Boston Manor to Hammersmith" id="piccadilly_boston_manor_to_hammersmith" href="../piccadilly/boston_manor_to_hammersmith.html">Boston Manor to Hammersmith</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Hammersmith to King\'s Cross St Pancras" id="piccadilly_hammersmith_to_kings_cross_st_pancras" href="../piccadilly/hammersmith_to_kings_cross_st_pancras.html">Hammersmith to King\'s Cross St Pancras</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from King\'s Cross St Pancras to Bounds Green" id="piccadilly_kings_cross_st_pancras_to_bounds_green" href="../piccadilly/kings_cross_st_pancras_to_bounds_green.html">King\'s Cross St Pancras to Bounds Green</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Bounds Green to Cockfosters" id="piccadilly_bounds_green_to_cockfosters" href="../piccadilly/bounds_green_to_cockfosters.html">Bounds Green to Cockfosters</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Uxbridge to Acton Town" id="piccadilly_uxbridge_to_acton_town" href="../piccadilly/uxbridge_to_acton_town.html">Uxbridge to Acton Town</a></li>\n';
	addSubmenu('piccadilly', strHTML);


	// Menu 'victoria'
	strHTML  = '<li><a title="A map of the Victoria line section of my tubewalk" id="victoria_index" href="../victoria/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Victoria line" id="victoria_history" href="../victoria/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Brixton to King\'s Cross St Pancras" id="victoria_brixton_to_kings_cross_st_pancras" href="../victoria/brixton_to_kings_cross_st_pancras.html">Brixton to King\'s Cross St Pancras</a></li>\n';
	strHTML += '<li><a title="The story of my tubewalk from King\'s Cross St Pancras to Walthamstow Central" id="victoria_kings_cross_st_pancras_to_walthamstow_central" href="../victoria/kings_cross_st_pancras_to_walthamstow_central.html">King\'s Cross St Pancras to Walthamstow Central</a></li>\n';
	addSubmenu('victoria', strHTML);


	// Menu 'waterloo_and_city'
	strHTML  = '<li><a title="A map of the Waterloo &amp; City line section of my tubewalk" id="waterloo_and_city_index" href="../waterloo_and_city/index.html">Map of the Line as a Tubewalk</a></li>\n';
	//strHTML += '<li><a title="A brief history of the Waterloo &amp; City line" id="waterloo_and_city_history" href="../waterloo_and_city/history.html">Brief History of the Line</a></li>\n';
	strHTML += '<li class="menuItemHeader">The Walk</li>\n';
	strHTML += '<li><a title="The story of my tubewalk from Waterloo to Bank" id="waterloo_and_city_waterloo_to_bank" href="../waterloo_and_city/waterloo_to_bank.html">Waterloo to Bank</a></li>\n';
	addSubmenu('waterloo_and_city', strHTML);

	// Menu 'about_me'
	strHTML  = '<li><a title="Some general information about me" id="about_me_index" href="../about_me/index.html">About Me</a></li>\n';
	strHTML += '<li><a title="Details of my various walks" id="about_me_my_walks" href="../about_me/my_walks.html">My Walks</a></li>\n';
	strHTML += '<li><a title="A not terribly serious look at why I walk" id="about_me_why_i_walk" href="../about_me/why_i_walk.html">Why I Walk</a></li>\n';
	addSubmenu('about_me', strHTML);

	// Menu 'about_site'
	strHTML  = '<li><a title="Who did what on this site, and with which pieces of software" id="about_site_site_credits" href="../about_site/site_credits.html">Site Credits</a></li>\n';
	strHTML += '<li><a title="How I created the maps on this site" id="about_site_creating_walking_maps" href="../about_site/creating_walking_maps.html">How I Created My Walking Maps</a></li>\n';
	strHTML += '<li><a title="For those who want to use my content on their own websites" id="about_site_using_my_content" href="../about_site/using_my_content.html">Using My Content on Your Site</a></li>\n';
	strHTML += '<li><a title="Some helpful tips on using this site" id="about_site_using_this_site" href="../about_site/using_this_site.html">Using this Site</a></li>\n';
	strHTML += '<li><a title="An accessibility statement for this site" id="about_site_accessibility" href="../about_site/accessibility.html">Accessibility Statement</a></li>\n';
	addSubmenu('about_site', strHTML);

	// Menu 'guestbook'
	strHTML  = '<li><a title="Feel free to view my Guestbook" id="guestbook_index" href="../guestbook/viewforum.php?f=1" accesskey="9">View My Guestbook</a></li>\n';
	strHTML += '<li><a title="If you\'d like to sign my Guestbook, I\'d be delighted!" id="guestbook_sign" href="../guestbook/posting.php?mode=newtopic&f=1">Sign My Guestbook</a></li>\n';
	strHTML += '<li><a title="You can send me a private message, if you would prefer" id="guestbook_private" href="../guestbook/posting.php?mode=newtopic&f=2">Send Me a Private Message</a></li>\n';
	strHTML += '<li><a title="Some nice (and nasty) comments taken from my Guestbook" id="guestbook_site_testimonials" href="../guestbook/site_testimonials.html">Site Testimonials</a></li>\n';
	addSubmenu('guestbook', strHTML);

	// Menu 'search'
	strHTML  = '<li><a title="An advanced search engine, so you can find exactly what you\'re after" id="search_index" href="../cgi-bin/search.cgi">Search</a></li>\n';
	strHTML += '<li><a title="An index of every single page on this site" id="search_site_map" href="../search/site_map.html">Site Map</a></li>\n';
	strHTML += '<li><a title="A chronological index of my tubewalk" id="search_tales_chronological_order" href="../search/tales_chronological_order.html">Tales in Chronological Order</a></li>\n';
	addSubmenu('search', strHTML);

	// Insert placeholder text
	hideField('searchTerms', 'Enter terms');
	$('#searchTerms').focus(function() { showField('searchTerms', 'Enter terms'); });
	$('#searchTerms').blur(function() { hideField('searchTerms', 'Enter terms'); });

	hideField('searchTerms2', 'Enter terms');
	$('#searchTerms2').focus(function() { showField('searchTerms2', 'Enter terms'); });
	$('#searchTerms2').blur(function() { hideField('searchTerms2', 'Enter terms'); });

	hideField('captionSearch', 'Enter terms');
	$('#captionSearch').focus(function() { showField('captionSearch', 'Enter terms'); });
	$('#captionSearch').blur(function() { hideField('captionSearch', 'Enter terms'); });

	// Prevent empty searches
	$('#mainSearch').submit(function() {
		return (($('#searchTerms').val().length > 0) && ($('#searchTerms').val() != 'Enter terms'));
	});

	// Move access keys to correct menu items
	$('#about_site > a').removeAttr('accesskey');
	$('#guestbook > a').removeAttr('accesskey');
}


// Add a submenu to the left-hand navigation
function addSubmenu(strMenuId, strHTML) {
	// Create submenu
	$('#' + strMenuId).append('<ul id="submenu_' + strMenuId + '">' + strHTML + '</ul>');

	// Hide submenu in a way that doesn't break in Safari
	$('#submenu_' + strMenuId).css('display','none')

	// Add arrow to menu item
	$('#' + strMenuId).css('background', "url('../images/common/down_arrow.gif') 183px top no-repeat");

	// Add open/close event
	$('#' + strMenuId + ' > a').toggle(openMenu, closeMenu);
}


// Open a submenu
function openMenu(objEvent) {
	var strId = $(this).parent().attr('id');

	// Open menu
	$('#submenu_' + strId).slideDown('slow');

	// Change arrow
	$('#' + strId).css('background-image', "url('../images/common/up_arrow.gif')");

	// Stop default action
	return false;
}


// Close a submenu
function closeMenu(objEvent) {
	var strId = $(this).parent().attr('id');

	// Close menu
	$('#submenu_' + strId).slideUp('slow');

	// Change arrow
	$('#' + strId).css('background-image', "url('../images/common/down_arrow.gif')");

	// Stop default action
	return false;
}


// Open the current menu
function currentMenu(strMenuId, strMenuItem) {
	// Open current submenu
	$('#submenu_' + strMenuId).show();

	// Add open/close event, but other way round
	$('#' + strMenuId + ' > a').unbind('click');
	$('#' + strMenuId + ' > a').toggle(closeMenu, openMenu);

	// Change arrow
	$('#' + strMenuId).css('background-image', "url('../images/common/up_arrow.gif')");

	// Highlight current page and remove link
	strLinkText = $('#' + strMenuId + '_' + strMenuItem).text();
	$('#' + strMenuId + '_' + strMenuItem).parent().text(strLinkText).css('color', '#f00');
}


// Display emailer and/or RSS links
function metaDataCentre(boolRssDisplay, boolMailerDisplay, strFolder, strFile) {
	if (boolRssDisplay || boolMailerDisplay) $('#authorInfo').after('<ul>' + mailerHTML(boolMailerDisplay, strFolder, strFile) + rssHTML(boolRssDisplay) + '</ul>');
}


// Generate HTML for the emailer link
function mailerHTML(boolDisplay, strFolder, strFile) {
	var strHTML = '';
	if (boolDisplay) {
		var title = document.title
		if (title.indexOf(' - A Picture') > 0) title = title.substr(title.indexOf(' - A Picture') + 3);
		var hyphen = title.indexOf(' - ');
		if (hyphen) { title = title.substr(0, hyphen); }
		strHTML  = '<li><a title="Email this page to a friend" href="';
		strHTML += '../cgi-bin/mailer.cgi?url=' + location.pathname + escape_plus(location.search) + '&amp;title=' + escape(title) + '&amp;folder=' + strFolder + '&amp;file=' + strFile;
		strHTML += '">Email to a Friend</a></li>';
	}
	return strHTML;
}


// Generate HTML for the RSS link
function rssHTML(boolDisplay) {
	var strHTML = '';
	if (boolDisplay) strHTML = '<li><a href="http://feeds.moxon.net/traveldigest" rel="alternate" type="application/rss+xml">Subscribe via <abbr title="Really Simple Syndication">RSS</abbr> <img class="rss" src="../images/common/feed-icon9x9.png" width="9" height="9" alt="RSS logo" /></a></li>';
	return strHTML;
}


// Insert year for copyright
function copyright() {
	var strHTML, d = new Date();
	strHTML  = '1995-';
	strHTML += d.getFullYear();
	$('#copyrightYear').html(strHTML);
}


// Display input field and clear placeholder text
function showField(strFieldId, strPlaceholderText) {
	// If field exists
	if ($('#' + strFieldId).length) {
		// Display field fully
		$('#' + strFieldId).css('color', '#000');

		// Remove placeholder text if present
		if ($('#' + strFieldId).val().replace(/(\r\n|\r|\n)/g, '\n') == strPlaceholderText.replace(/(\r\n|\r|\n)/g, '\n')) $('#' + strFieldId).val('');
	}
}


// Hide input field and insert placeholder text (if empty)
function hideField(strFieldId, strPlaceholderText) {
	// If field exists
	if ($('#' + strFieldId).length) {
		if (($('#' + strFieldId).val() == '') || ($('#' + strFieldId).val().replace(/(\r\n|\r|\n)/g, '\n') == strPlaceholderText.replace(/(\r\n|\r|\n)/g, '\n'))) {
			// Grey out terms field
			$('#' + strFieldId).css('color', '#707070');

			// Insert placeholder text
			$('#' + strFieldId).val(strPlaceholderText.replace(/(\r\n|\r|\n)/g, '\n'));
		}
	}
}


// Escape string, including + signs
function escape_plus(strURL) {
	var encoded = new String;
	encoded = escape(strURL);
	var re = /\+/g;
	encoded = encoded.replace(re, '%2B');
	return encoded;
}
