			$(document).ready(function() {
				var activeWalkOfPage = $('#activewalk');
				$('#homepage .linktowalk,#videoextras .linktowalk').hover(
					function(event){// What to do on event
						changeWalk(this);
					},
					function(){
						//What to do when event no longer applicable
						if ($('#videoextras .linktowalk').length > 0) {
							revertWalk(this,activeWalkOfPage); //What to do when event no longer applicable
							// TODO: fix for video extras page where activeWalkOfPage does not exist at first
						}
					}
				)

				$('#homepage .linktowalk,#videoextras .linktowalk').focus(
					function(event){// What to do on event
						changeWalk(this);
					},
					function(){
						//What to do when event no longer applicable
					}
				)

				$('#videoextras #videolist a,#videoextras #videolist img').hover(
					function(event){// What to do on event
						unFadeImg(this)
					},
					function(){
						//What to do when event no longer applicable
						fadeImg(this);
					}
				)

				$('#videoextras #videolist a,#videoextras #videolist img').focus(
					function(event){// What to do on event
						unFadeImg(this)
					},
					function(){
						//What to do when event no longer applicable
						fadeImg(this);
					}
				)


				$('.walkpage .linktowalk').hover(
					function(event){// What to do on event
						changeWalk(this);
					},
					function(){
						revertWalk(this,activeWalkOfPage); //What to do when event no longer applicable
						
					}
				)

				$('.walkpage .linktowalk').focus(
					function(event){// What to do on event
						changeWalk(this);
					},
					function(){
						revertWalk(this,activeWalkOfPage); //What to do when event no longer applicable
					}
				)


			});

			function fadeImg(elem)
			{
				if ($(elem).find('img').length > 0) {
					$(elem).find('img').addClass('transparency');
				} else {
					$(elem).parent().parent().find('img').addClass('transparency');
				}
			}

			function unFadeImg(elem)
			{
				if ($(elem).find('img').length > 0) {
					$(elem).find('img').removeClass('transparency');
				} else {
					$(elem).parent().parent().find('img').removeClass('transparency');
				}
			}
			

			function revertWalk(temporarilyLitNode,originalNode)
			{
				var reOn = new RegExp('(^.+)on(.+$)'); //reg exp pattern to search for the 'on' bit of the image's filename
				var reOff = new RegExp('(^.+)off(.+$)'); //reg exp pattern to search for the 'off' bit of the image's filename
				var offImagePath = $(temporarilyLitNode).find('img').attr('src').replace(reOn,'$1off$2'); // calculate the path to the required 'off' image
				if (originalNode.lebgth > 0) {
					var onImagePath = $(originalNode).find('img').attr('src').replace(reOff,'$1on$2'); // calculate the path to the required 'on' image
					$(originalNode).find('img').attr('src',onImagePath); // turn the image on for the original element
					$(originalNode).attr('id','activewalk'); // add the id 'activewalk' to the image being turned on
				}
				$(temporarilyLitNode).find('img').attr('src',offImagePath); // turn the image off for the no-longer active element
				$('#activewalk').removeAttr('id'); // remove the id 'activewalk' from the image being turned off (should correspond to temporarilyLitNode)
				
				if ($('#videolist').length > 0) {
					$('#videolist').find('img').addClass('transparency');
				}

			}
			
			
			function changeWalk(w)
			{
			    if ($(w).attr('id') == 'activewalk') {return;}
				var reOn = new RegExp('(^.+)on(.+$)'); //reg exp pattern to search for the 'on' bit of the image's filename
				var reOff = new RegExp('(^.+)off(.+$)'); //reg exp pattern to search for the 'off' bit of the image's filename
				var reWalkNumber = new RegExp('^.+([0-9]).+$'); //reg exp pattern to search for digit within the image's filename
				var walkNumber = $(w).attr('href').replace(reWalkNumber,'$1');
				var offImagePath;
				if ($('#activewalk').length > 0) {
				 offImagePath = $('#activewalk').find('img').attr('src').replace(reOn,'$1off$2'); // calculate the path to the required 'off' image
				}
				var onImagePath = $(w).find('img').attr('src').replace(reOff,'$1on$2'); // calculate the path to the required 'on' image
					if (offImagePath) {
					var prevWalkId = 'walk' + offImagePath.replace(reWalkNumber,'$1'); // the DOM id of the walk layer being turned off (only relavent on the home page)
				}

				var newWalkId = 'walk' + onImagePath.replace(reWalkNumber,'$1'); // the DOM id of the walk layer being turned on (only relavent on the home page)
				if ($('#video' + walkNumber).length > 0) {
					$('#video' + walkNumber).find('img').removeClass('transparency');
				}

				$(w).find('img').attr('src',onImagePath); // turn the image on for the focused element

				if ($('body#videoextras').length > 0 || $('body#homepage').length > 0) {// if we're on the home page, or the video extras page.
					$('#activewalk').find('img').attr('src',offImagePath); // turn off the previously on element
				}

				$('#activewalk').removeAttr('id'); // remove the id 'activewalk' from the image being turned off
				$(w).attr('id','activewalk'); // add the id 'activewalk' to the image being turned on


				if ($('#' + prevWalkId).length < 1 && $('#' + newWalkId).length < 1){return;} // function returns at this point, on every page except the home page
				$('#' + prevWalkId).addClass('hidden'); // hide the layer of the walk being turned off
				$('#' + newWalkId).removeClass('hidden'); // reveal the layer of the walk being turned on
			}