var stepID = 0;

var stepImage = new Array(
			"f01_big.jpg",
			"f02_big.jpg",
			"f03_big.jpg",
			"f04_big.jpg",
			"f05_big.jpg",
			"f06_big.jpg",
			"f07_big.jpg",
			"f08_big.jpg" );
			
var stepName = new Array(
			"Crystal Sawing",
			"Crystal Blank Capping",
			"Crystal Rolling",
			"Plating",
			"Frequency Adjustment",
			"Assembling with the Base and Cap",
			"Laser Marking",
			"Final Testing" );

function nextProcess() {
	if (stepID < (stepImage.length-1)) {
			stepID +=1;
			document.imgProcess.src = "imgFactory/" + stepImage[stepID];
			divStepName.innerText = stepName[stepID];
	}
	checkStepID();
}

function backProcess() {
	if (stepID > 0) {
			stepID -=1;
			document.imgProcess.src = "imgFactory/" + stepImage[stepID];
			divStepName.innerText = stepName[stepID];
	}
	checkStepID();
}

function checkStepID() {
	document.imgNext.width = 71;
	document.imgNext.height = 13;
	document.imgBack.width = 71;
	document.imgBack.height = 13;	

	if (stepID == (stepImage.length-1)) {
		document.imgNext.width = 1;
		document.imgNext.height = 1;
	}
	if (stepID == 0) {
		document.imgBack.width = 1;
		document.imgBack.height = 1;
	}
}

function loadStep() {
	var strNum = "" + window.location;
	var nNum = strNum.substring(strNum.length-2, strNum.length);
	//window.status = nNum.valueOf();
	stepID = nNum.valueOf() - 1;
	if (stepID < 0 ) stepID = 0;
	document.imgProcess.src = "imgFactory/" + stepImage[stepID];
	divStepName.innerText = stepName[stepID];
	checkStepID();
}
