window.onload = initAll;

var currImg = 0;


var captionText = new Array(
	"From this Whitby Inn,the White Horse and Griffin in Church Street, stage coaches went to York.Dickens was one of its visitors. For many years it was used as a fishermens store and so retained its character. 	It is now once again an hotel and restaurant",
	"A medieval merchants house. This is the oldest known house in Whitby. It's timber date to at least the 15th century. Before the dissolution of the monastery most of Whitby would be buildings like this or humbler equivalents. In the Middle Ages wood was cheaper than stone but as wood became scarce, stone and brick became relatively cheaper and consequently people stopped building in this style. This type of house can also be seen in the New Market Square and on the other side of the Old Quaker Meeting House.",
	"Whitby's Railway Station, built by George T Andrews, a prominent builder of railway and church buildings. The station is built on the site of old shipyards. Whitby was one of the pioneers in railway building with its first railway planned by George Stevenson but due to the difficulty that early engines had with severe gradients it had to be powered by a horse with a machine house at Goathland to pull the railway carriage and horse up the slope. To take steam trains a deviation was necessary but, shortly after the deviation was made, a steam engine made for a railway in South America was tried out there and succeeded in using the old line . The Stevenson family kept their interest in Whitby and his son became MP for Whitby. George Hudson, the Railway King who brought steam to Whitby also fell in love with Whitby and started to make Whitby into a fashionable seaside resort.Unfortunately his business affairs got into difficulties and Whitby building had to end abruptly and the result can be seen in Royal Crescent where just over half the Crescent was built.",
	"The cartoonist Phil May stayed at this Whitby hotel, the George Hotel in Baxtergate",
	"A gifted family of artists,the Wetherills, lived here.",
	"Bagdale Old Hall was the residence of Captain Browne Bushell,who changed sides more often than most other men in the English Civil War and was eventually executed by the order of Parliament.",
	"The residence of Captain William Scoresby,a very successful Whitby whaling captain and scientist, who brought his ship further north than anyone else of his period.",
	"Mrs Gaskell stayed here when she wrote her story of Whitby -Sylvia's Lovers.",
	"Sutcliffe,an award winning photographer, made many photographs which preserve Whitby's history. This was his studio and it has changed very little apart from its colour.",
	"Another view of where Mrs Gaskell stayed."
)




function initAll() {
	document.getElementById("imgText").innerHTML = captionText[0];
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
}



function processPrevious()
 {
	newSlide(-1);
}

function processNext() {
	newSlide(1);
}

function newSlide(direction) {
	var imgCt = captionText.length;

	currImg = currImg + direction;
	
if (currImg < 0) 
{
		
currImg = imgCt-1;
	}

	
if (currImg == imgCt) 
{
		currImg = 0;
	
}

	
document.getElementById("slideshow").src = "slideImg" + currImg + ".JPG"
	document.getElementById("imgText").innerHTML = captionText[currImg]
}

