// JavaScript Document

function nextPrev(direction) {
	
	if (direction == "next"){
		
		if(imageId == imageArray.length - 1){
		
			imageId = 0;
			location.href=nextProj;
		
		}else{
		
			imageId++;
			changePic(imageId);
		
		}
		
		
		
	}else{
		
		if(imageId == 0){
		
			imageId = imageArray.length - 1;
			location.href=prevProj;
		
		}else{
		
			imageId--;
			changePic(imageId);
		
		}
		
	
	}
	
}
	

function changePic(id){
	
	var chosenPic = imageArray[id];
	var desc = descArray[id];
	var aspect = aspectArray[id];
	
	imageId = id;
	
	var obj = document.getElementById("picHolder");
	
	obj.innerHTML='<img src="' + chosenPic + '" />'
	obj.innerHTML+='<div class="caption">'
	
	if (aspect == "portrait"){
		
		obj.innerHTML+='<p style="margin: 10px 25px 0px 72px;">' + desc + '</p>'
		
	}else{
		
		obj.innerHTML+='<p style="margin: 10px 25px 0px 0px;">' + desc + '</p>'
	
	}
	
	obj.innerHTML+='</div>'
	
}
