	var SectionName;
	var preloadFlag = true;  // For GoLive rollovers

/* ---------------------- Scrolling menu -------------------------------- */

/* This code does two things:
1. Scroll MovingSection as the user scrolls
2. Change the position of MovingSection if the user resizes the window. For
   this website, MovingSection (the section link graphics) should always be
   at the bottom of the screen, so the top position will vary.
*/   
	
	var OriginalTopPos;
	var OriginalWinHeight;
	var ScrollAmount;
	

	function InitMenuFollow()
	// 1. Get the initial vertical position of the MovingSection object.
	// 2. Set a timer to run the ScrollMonitor procedure
	{
	  // NB You can only get the position of an element if it has been set
	  // previously via CSS or JavaScript.
	  OriginalTopPos = document.getElementById("MovingSection").style.top;
	  
	  // Set the inital height of the window. This must be done now, rather than
	  // when the global variable was declared, otherwise Firefox reports 0
	  // height presumably because the page hasn't yet loaded.
	  OriginalWinHeight = GetWinHeight();
	
	  // Run ScrollMonitor every second
	  // setInterval syntax is (function to run, frequency to run it (in ms), function parameters).
	  // function to run can be FunctionName or "FunctionName()" in most browsers - but only
	  // the latter in Mac IE5.
    window.setInterval ("ScrollMonitor()", 500);
	}
	
	function ScrollMonitor()
	// Makes sure the layer called "MovingSection" is always "OriginalTopPos" 
	// down from the top of the window
	// Bugs: Makes the page infinitely scrollable - the layer shouldn't move if it's 
	// at the bottom of the web page
	{
	  // Find out how far the user has scrolled (method varies...)
	  if (document.documentElement && document.documentElement.scrollTop)
	    // PC IE6 strict, Mac IE 5, Mac Firefox strict
	    ScrollAmount = document.documentElement.scrollTop;
	  else if (document.body && document.body.scrollTop)
	    // Safari, PC IE6 trans, Mac Firefox trans
	    ScrollAmount = document.body.scrollTop;
		  else if (window.scrollY) 
		  	// Mozilla browsers (incl. Firefox and Safari) understand this one,
		  	// though they've probably already got the value.
		  	ScrollAmount = window.scrollY;
	  		else 
	  			ScrollAmount = 0;

	  // Move box down by the scroll amount. OriginalTopPos may be false rather
	  // than a number if GetWinHeight could not detect the value. Assume a
	  // figure to prevent errors.
    if(!OriginalTopPos)OriginalTopPos=200;
	  document.getElementById("MovingSection").style.top = parseInt(OriginalTopPos) + parseInt(ScrollAmount) + "px";
	} 
	
	function WindowResize()
	{
		// Set new 'original' defaults
		OriginalTopPos = parseInt(OriginalTopPos) + (GetWinHeight()-OriginalWinHeight);
		OriginalWinHeight = GetWinHeight();
		document.getElementById("MovingSection").style.top = OriginalTopPos + "px";  
	}
	
	window.onresize = WindowResize;

	function GetWinHeight()
	{
		// Return the height of the visible area.
		// Assumes the document is HTML strict.
		var appVersion = navigator.appVersion;
		
		// Get platform
		var Platform;
		var PlatformPattern1 = /mac/i;
		var PlatformPattern2 = /windows/i;			
		if(appVersion.match(PlatformPattern1))Platform="mac";
		else if(appVersion.match(PlatformPattern2))Platform="windows";
		else Platform="unknown";
		
		// Get browser make
		var userAgent = navigator.userAgent;
		var Browser="";
		var BrowserPattern = /(msie)|(safari)|(firefox)/i;
		Browser = userAgent.match(BrowserPattern)[0].toLowerCase();
		if(Browser=="")Browser="mozilla";
		
		if((Platform=="windows"&&Browser=="msie")||(Browser=="firefox")) return document.documentElement.clientHeight;
		else if(Platform=="mac"&&Browser=="msie")	return document.body.clientHeight;
 	    else if(Browser=="safari") return document.clientHeight;
 	      else return false;
 	      
	}
		
		
	function ShowMainTop (PageTitle)	
		{
		// Set up main table to hold content, plus any rows, graphics etc. before actual body text
		document.write("<div id='MovingSection' style='position:absolute;left:10px;top:"+(GetWinHeight()-110)+"px;'></div>");	
		var PageTitleGraphic;
		switch (PageTitle)
		{
			case ("Home"): 
				PageTitleGraphic = "home-title.gif";
				break;
			case ("Design"): 
				PageTitleGraphic = "design-title.gif";
				break;
			case ("CV"): 
				PageTitleGraphic = "cv-title.gif";
				break;		
			default:
				PageTitleGraphic = "blank.gif";									
		}	
			document.write('<table id="MainTable"><tbody><tr style="vertical-align:top; height:60px;"><td style="width:179px;vertical-align:top;"><a href="index.html" title="Back to homepage"><img src="images/jamietshaw.gif" alt="" style="height:58px; width:161px;"></a><td rowspan="2" style="width:50px;vertical-align:top;"><td rowspan="2" style="width:450px;vertical-align:top;"><p><img src="images/' + PageTitleGraphic + '" alt="" id="Titles">');
		}     // End of function ShowMainTop

		
		function ShowMainBottom(PageTitle)
		{
			var OutputText, HomeCode, HomeCodeOver, DesignCode, DesignCodeOver, CVcode, CVcodeOver;
			
			OutputText = "";
			HomeCode = '<img src="images/nav-home-selected.gif" width="65" height="101">'
			HomeCodeOver = '<a title="Link to Homepage" onmouseover="changeImages(\'home\',\'images/nav-home-over.gif\');return true" onmouseout="changeImages(\'home\',\'images/nav-home.gif\');return true" href="index.html"><img src="images/nav-home.gif" alt="Link to Homepage" name="home" width="65" height="101" style="border:0px;padding:0px;margin:0px;"></a>';
			
			DesignCode = '<img src="images/nav-design-selected.gif" width="72" height="101">';
			DesignCodeOver = '<a title="Link to Design section" onmouseover="changeImages(\'design\',\'images/nav-design-over.gif\');return true" onmouseout="changeImages(\'design\',\'images/nav-design.gif\');return true" href="design.html"><img src="images/nav-design.gif" alt="Link to Design section" name="design" width="72" height="101" style="border:0px;padding:0px;margin:0px;"></a>';
			
			CVcode = '<img src="images/nav-cv-selected.gif" width="37" height="101">';
			CVcodeOver = '<a title="Link to CV section" onmouseover="changeImages(\'cv\',\'images/nav-cv-over.gif\');return true" onmouseout="changeImages(\'cv\',\'images/nav-cv.gif\');return true" href="cv.html"><img src="images/nav-cv.gif" alt="Link to CV section" name="cv" width="37" height="101" style="border:0px;padding:0px;margin:0px;"></a>';
			
			switch (PageTitle)
			{
				case ("Home"): 
					OutputText = OutputText + HomeCode + DesignCodeOver + CVcodeOver;
					break;
				case ("Design"): 
					OutputText = OutputText + HomeCodeOver + DesignCode + CVcodeOver;
					break;
				case ("CV"): 
					OutputText = OutputText + HomeCodeOver + DesignCodeOver + CVcode;
					break;										
				default:
						OutputText = OutputText + HomeCodeOver + DesignCodeOver + CVcodeOver;
		  			break;
			}	
			
			document.getElementById("MovingSection").innerHTML = OutputText;
			document.write("</td><tr style='vertical-align:bottom;'><td style='width:179px;vertical-align:bottom;'></td></tr><tr style='height:20px;'><td colspan='3'>");				
			ShowFooter();
			document.write('</td></tr></tbody></table>');
		}  // End of function ShowMainBottom
		
