window.onload = initAll;

var currImg = 0;
var captionText = new Array(
	"Fred Barter, VC, MC, France 1915.<p>Born in Cardiff, Fred Barter gained his VC whilst a Company Sergeant Major serving with the 1st Bn Royal Welsh Fusiliers. 'For most conspicuous bravery and marked ability at Festubert on 16th May, 1915. When in the first line of German trenches, Company Sergeant Major Barter called for volunteers to enable him to extend our line and with eight men who responded he attacked the German position with bombs, capturing three German officers and 102 men and 500 yards of their trenches. He subsequently found and cut eleven of the enemy's mine leads, situated about twenty yards apart.' Commissioned, he was later seconded for service with the Indian Army and gained a Military Cross whilst with the 2/3rd Queen Alexandra's Gurkha Rifles in Palestine in 1918.</p>",
	"John Williams, VC, DCM, MM & Bar, Medaille Militaire.<p>Born Nantyglo, Monmouthshire, Jack Williams was the most decorated Welsh soldier of the Great War. He was awarded the Victoria Cross for his action at Villers Outreaux, France on 7/8th October 1918. 'For most conspicuous bravery, initiative and devotion to duty on the night of the 7th/8th October, 1918, during the attack on Villers Outreaux, when, observing that his company was suffering heavy casualties from an enemy machine gun, he ordered a Lewis gun to engage it, and went forward under heavy fire to the flank of the enemy post, which he rushed singlehanded, capturing fifteen of the enemy. These prisoners, realising that Williams was alone turned on him and one of them gripped his rifle. He succeeded in breaking away and bayonetting five enemy, whereupon the remainder again surrendered. By this gallant action and total disregard of personal danger he was the means of enabling not only his own company but also those on the flanks to advance. He had already been awarded the Military medal and Bar and the Distinguished Conduct Medal 'For conspicuous gallantry in action. He handled his men in the attack with great courage and skill. He has performed constant good work throughout' for his action during the ill-fated assault on Mametz Wood during the Battle of the Somme.</p>",
	"William Williams, VC, DSM & Bar, Medaille Militaire, 1917.<p>Born Amlwch, Anglesey.</p>",
	"Lewis Pugh Evans, VC, DSO & Bar, CB, CMG, Belgium 1917",
	"Arthur Lascelles, VC, MC, France 1917",
	"Sir Hughie Edwards, VC, KCMG, CB, DSO, OBE, Germany, 1941",
	"Rt. Hon. Sir Tasker Watkins, VC, KGBE, Kt SJ, Kt, Normandy, 1944",
	"David Lord, VC, DFC, Arnhem, 1944",
	"H Jones, VC, OBE, MBE, Falklands, 1982"
)

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 = "http://bridgebooks.co.uk/images/galleryVC/slideImg" + currImg + ".jpg";
	document.getElementById("imgText").innerHTML = captionText[currImg];
}

						
