var imgList=new Array();
var currentIndex=0;

function changeImg(id,img,idTxt,descr){
	document.getElementById(id).src=img;
	document.getElementById(idTxt).innerHTML=descr;
}

function showPrev(id,imgPath,idTxt){
	if(currentIndex)
		currentIndex--;
	else currentIndex=imgList.length-1;
	
	changeImg(id,imgPath+imgList[currentIndex][0]+'.jpg',idTxt,imgList[currentIndex][1]);
}

function showNext(id,imgPath,idTxt){
	if(currentIndex!=imgList.length-1)
		currentIndex++;
	else currentIndex=0;
	
	changeImg(id,imgPath+imgList[currentIndex][0]+'.jpg',idTxt,imgList[currentIndex][1]);
}
