﻿function Pager(fileNames, spanId, imgId, itemUid) {
    this.currentPage = 0;
    this.fileNames = fileNames;
    this.max = fileNames.length - 1;
    this.span = document.getElementById(spanId);
    this.img = document.getElementById(imgId);
    this.itemUid = itemUid;
    this.update = function() {
        this.span.innerHTML = (this.currentPage + 1) + " / " + (this.max + 1);
        this.img.src = "Priloha.aspx?id=" + this.itemUid + "&atn=" + this.fileNames[this.currentPage];
    }
    this.pageAdd = function(offset)
    {
        this.currentPage += offset;
        if (this.currentPage < 0) this.currentPage = 0;
        if (this.currentPage > this.max) this.currentPage = this.max;
        this.update();
    }
    this.update();
}

