// JavaScript Document

window.onload = initAll;


var currImg = 0;



var captionText = new Array(
	"Attire your team with company gear. Great for production team uniforms or a consistent sales force look. Contact Kelmscott for help with your company clothing needs.",
	"Placing your company logo on a product makes a great gift for both customers and employees."
	
)
var captionTitle = new Array(
	"Employee Clothing",
	"Promotional Products"
	
)

//JY----------------------

function initAll(myIndex) {
	if (myIndex != null)
	window.location.href="work_promo.php?pid=" + myIndex + "#slideshow";
	if (myIndex == "" || myIndex == null || myIndex < 0)
		myIndex = 0;
		
	document.getElementById("slideshow").src = "images/galleryPromo/promoImg" + myIndex + ".jpg";
	document.getElementById("imgTitle").innerHTML = captionTitle[myIndex];
	document.getElementById("imgText").innerHTML = captionText[myIndex];
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
	if (myIndex != currImg)
	currImg = myIndex;
}


//------------------------





//function initAll() {
//	document.getElementById("imgTitle").innerHTML = captionTitle[0];
//	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 = "images/galleryPromo/promoImg" + currImg + ".jpg";
	document.getElementById("imgText").innerHTML = captionText[currImg];
	document.getElementById("imgTitle").innerHTML = captionTitle[currImg];
}
