sendik,
function next() {
index++;
index = limit(index);
show()
}
function prev() {
index--;
index = limit(index);
show()
}
function setIndex(x) {
index = x;
index = limit(index);
show();
}
function addIndex(x) {
index += x;
index = limit(index);
show();
}
function limit(num) {
if (num >= imgMassive.length) {
num %= imgMassive.length ;
}
if (num < 0) {
num = imgMassive.length - (-num % imgMassive.length) ;
}
return num
}
function show()
{
prev1.src = imgMassive[limit(index-2)];
prev2.src = imgMassive[limit(index-1)];
prev3.src = imgMassive[index];
prev4.src = imgMassive[limit(index+1)];
prev5.src = imgMassive[limit(index+2)];
modal.style.display = 'block';
}