﻿window.onload = initAll;

var currImg = 0;

var titleText= new Array(
	"iCooking Apps for your iPhone",
	"Choose your Recipe",
	"Scroll the Contents",
	"Photo",
	"Ingredients",
	"Prepare",
	"E-mail",
	"Add Your Own!"
)
var captionText = new Array(
	"Now at your fingertips, a collection of iCookbooks.",
	"Choose recipes by category, favorites, or scan them all with just a single touch.",
	"The list of recipes appears. You can easily go through it with one touch!",
	"Each recipe is illustrated with a mouthwatering picture.",
	"Click on the ingredients tab to bring up an easy to read list of what is needed to complete your dish.",
	"The preparation tab will give you your step-by-step directions on how to cook your dish.",
	"With the options tab you can send a recipe to a friend.",
	"You can type, or use the copy/paste function to add your own recipes to your cookbook. When you make the dish, don’t forget to take a picture :)"
)

function initAll() {
	document.getElementById("topText").innerHTML = titleText[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 = "lang_img/slideImg" + currImg + ".jpg";
	document.getElementById("imgText").innerHTML = captionText[currImg];
	document.getElementById("topText").innerHTML = titleText[currImg];
}

