window.onload = initAll;

var currImg = 0;
var captionText = new Array(
	"Clever use of white Lycra is used to construct an elliptical design, creating maximum effect making a strong sense of show identity.",
	"Clever use of white Lycra is used to construct an elliptical design, creating maximum effect making a strong sense of show identity.",
	"A wave of white voile is used to create a curtain effect. (Design by J Southgate Designs)."

)

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/interbuild_nec/slideImg" + currImg + ".jpg";
	document.getElementById("imgText").innerHTML = captionText[currImg];
}


