function infopack() {
  $('#infopack-right').click(function() {
    changePage('next', 28);
  });
  $('#infopack-left').click(function() {
    changePage('last', 28);
  });
}

function changePage(action, max) {
  var leftSrc = $('#infopack-left').attr('src').split('.');
  var rightSrc = $('#infopack-right').attr('src').split('.');

  var posInUrl = rightSrc.length - 2; // Gets the page num part of the URL

  var rightPage = Number(rightSrc[posInUrl]);
  var leftPage = Number(leftSrc[posInUrl]);

  if (action == 'next') {
    if (rightPage < max) {
      rightPage += 2;
      leftPage += 2;
    }
  }
  else {
    if (leftPage > 1) {
      rightPage -= 2;
      leftPage -= 2; 
    }
  }

  rightPage = '0' + rightPage;
  leftPage = '0' + leftPage;

  leftSrc[posInUrl] = leftPage;
  rightSrc[posInUrl] = rightPage;

  $('#infopack-left').attr('src', leftSrc.join('.'));
  $('#infopack-right').attr('src', rightSrc.join('.'));
}
