window.onload = initAll;

var currImg = 0;
var captionText = new Array(
	"A stunning creation of gold silk panels used to cover a feature bar.",
	"A stunning creation of gold silk panels used to cover a feature bar.",
	"Contemporary lanterns constructed with aluminium rings and white lycra, illuminated for best effect."

)

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


