	var x = 0
	var mainpic = new Array();

mainpic[0] = new Image();
mainpic[0].src = 'gfxabout/main1.jpg';

mainpic[1] = new Image();
mainpic[1].src = 'gfxabout/main2.jpg';

mainpic[2] = new Image();
mainpic[2].src = 'gfxabout/main3.jpg';

mainpic[3] = new Image();
mainpic[3].src = 'gfxabout/main4.jpg';

mainpic[4] = new Image();
mainpic[4].src = 'gfxabout/main5.jpg';

mainpic[5] = new Image();
mainpic[5].src = 'gfxabout/main6.jpg';

mainpic[6] = new Image();
mainpic[6].src = 'gfxabout/main7.jpg';

	function setImageDisplay()
	{
		var picBeingShown = document.getElementById("mainDisplay");
		picBeingShown.src = mainpic[x].src;
	}

	function setFirstGrey()
	{
		var firstButtonGreyed = document.getElementById("firstButton");
		firstButtonGreyed.style.color="#999999";
		firstButtonGreyed.style.cursor="default";
	}

	function setFirstUngrey()
	{
		var firstButtonUngreyed = document.getElementById("firstButton");
		firstButtonUngreyed.style.color="#669999";
		firstButtonUngreyed.style.cursor="pointer";
	}

	function setPreviousGrey()
	{
		var previousButtonGreyed = document.getElementById("previousButton");
		previousButtonGreyed.style.color="#999999";
		previousButtonGreyed.style.cursor="default";
	}

	function setPreviousUngrey()
	{
		var previousButtonUngreyed = document.getElementById("previousButton");
		previousButtonUngreyed.style.color="#669999";
		previousButtonUngreyed.style.cursor="pointer";
	}

	function setNextGrey()
	{
		var nextButtonGreyed = document.getElementById("nextButton");
		nextButtonGreyed.style.color="#999999";
		nextButtonGreyed.style.cursor="default";
	}

	function setNextUngrey()
	{
		var nextButtonUngreyed = document.getElementById("nextButton");
		nextButtonUngreyed.style.color="#669999";
		nextButtonUngreyed.style.cursor="pointer";
	}

	function setLastGrey()
	{
		var lastButtonGreyed = document.getElementById("lastButton");
		lastButtonGreyed.style.color="#999999";
		lastButtonGreyed.style.cursor="default";
	}

	function setLastUngrey()
	{
		var lastButtonUngreyed = document.getElementById("lastButton");
		lastButtonUngreyed.style.color="#669999";
		lastButtonUngreyed.style.cursor="pointer";
	}

	function setPicNumber()
	{
		var picNumber = x+1;
		document.getElementById("picNo").innerHTML=" "+picNumber+" of 7";
	}

	function setCaption()
	{
		if (x==0)
			{
			document.getElementById("picturecaption").innerHTML="The Thames sailing barge was the workhorse of coastal transport until well&nbsp;into the 20th Century. The design and rig evolved in a very specific way to suit&nbsp;the locations, conditions and requirements of her trade";
			document.getElementById("pictureCredit").innerHTML="Photograph: Lynne Tait";
			}
		else if (x==1)
			{
			document.getElementById("picturecaption").innerHTML="The barge&rsquo;s box-like hull maximised her load-carrying capacity, while the flat&nbsp;bottom not only gave her a shallow draught, but also meant she could take the ground at low water";
			document.getElementById("pictureCredit").innerHTML="&nbsp;";
			}
		else if (x==2)
			{
			document.getElementById("picturecaption").innerHTML="The lifting leeboards on either side, instead of a fixed keel, gave windward&nbsp;sailing performance while maintaining the barge&rsquo;s shallow draught, which enabled her to trade in the shallowest of waters";
			document.getElementById("pictureCredit").innerHTML="Photograph: Bob Ratcliffe";
			}
		else if (x==3)
			{
			document.getElementById("picturecaption").innerHTML="The mizzen sail is sheeted onto the outer end of the rudder, so that when&nbsp;the&nbsp;wheel is turned to tack the barge, the mizzen is forced up into the wind, helping to turn the stern";
			document.getElementById("pictureCredit").innerHTML="&nbsp;";
			}
		else if (x==4)
			{
			document.getElementById("picturecaption").innerHTML="The high mainmast and tall topsail &mdash; its peak is about 100 feet above the waterline &mdash; can catch the wind above the trees in a land-locked creek, or above warehouses around a sheltered harbour";
			document.getElementById("pictureCredit").innerHTML="&nbsp;";
			}
		else if (x==5)
			{
			document.getElementById("picturecaption").innerHTML="Repertor&rsquo;s bow plating was extensively rebuilt in late 2008, giving the opportunity to repaint the hull according to the original Horlocks livery (see photo 6 in the History gallery)";
			document.getElementById("pictureCredit").innerHTML="Photograph: Neil Hammersley";
			} 
		else if (x==6)
			{
			document.getElementById("picturecaption").innerHTML="Repertor&rsquo;s topmast broke too late in 2009 to be replaced, so we re-rigged our bowsprit and sailed as a &lsquo;stumpy&rsquo; for the rest of the season: this rig is typical of barges before topmasts became widely used in the 19th Century";
			document.getElementById("pictureCredit").innerHTML="Photograph: Neil Hammersley";
			}
	}

	function firstImage()
	{
		x = 0
		setImageDisplay();
		setFirstGrey();
		setPreviousGrey();
		setNextUngrey();
		setLastUngrey();
		setPicNumber();
		setCaption()
	}
	
	
	function previousImage()
	{
		x--
		if (x<0)
			{
			x = 0
			}
		else if (x==0)
			{
			setFirstGrey();
			setPreviousGrey();
			}
		else if (x==5)
			{
			setNextUngrey();
			setLastUngrey();
			}
		setImageDisplay();
		setPicNumber();
		setCaption()
	}
	
	
	function nextImage()
	{
		x++
		if (x>6)
			{
			x = 6
			}
		else if (x==6)
			{
			setNextGrey();
			setLastGrey();
			}
		else if (x==1)
			{
			setFirstUngrey();
			setPreviousUngrey();
			}
		setImageDisplay();
		setPicNumber();
		setCaption()
	}
	
	
	function lastImage()
	{
		x = 6
		setImageDisplay();
		setFirstUngrey();
		setPreviousUngrey();
		setNextGrey();
		setLastGrey();
		setPicNumber();
		setCaption()
	}
