window.onload = initAll;

var currImg = 0;
var captionText = new Array(
	"Clever and innovative use of Lycra is used to create funnel effect shapes.",
	"Use of a giant inflatable orb to create a feature lampshade in a bold statement.",
	"Giant presents suspended from the ceiling make a superb backdrop for this show.",
	"Giant presents suspended from the ceiling make a superb backdrop for this show.",
	"Rainbow coloured strips of casement are used to give a fresh and funky feel to separate show areas.",
	"Rainbow coloured strips of casement are used to give a fresh and funky feel to separate show areas.",
	"A colour changing lantern positioned above drinks bar to give a cool and contemporary edge to the show.",
	"A colour changing lantern positioned above drinks bar to give a cool and contemporary edge to the show.",
	"A colour changing lantern positioned above drinks bar to give a cool and contemporary edge to the show.",
	"Vibrant entrance area dressed in casement and colour co-ordinating carpet.",
	"Vibrant entrance area dressed in casement and colour co-ordinating carpet.",
	"Vibrant entrance area dressed in casement and colour co-ordinating carpet.",
	"Printed design fabric created especially for a unique selling point to entice and surprise the consumer.",
	"Inflatable balloon's used to create a feature area.",
	"Entrance area dressed in casement and treviera fabric with a button effect ceiling to delight the spectator.",
	"Illuminated lanterns within the Pandora catwalk bar area are a lighting feature of this area.",
	"Rainbow coloured strips of casement are used to give a fresh and funky feel to separate show areas."
)

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


