function Galeria() {}
Galeria.Lytebox = null;
Galeria.Rel = "lytebox[galeria]";
Galeria.Duze = null;
Galeria.Link = null;
Galeria.Miniaturki = null;
Galeria.Zdjecia = new Array();
Galeria.Pozycja = 0;
Galeria.dodaj = function(d, m, l)
{
    this.Zdjecia.push(new Array(d, m, l));
}
Galeria.pokaz = function()
{
    this.ustawDuze(0);
    this.pokazMiniaturki();
}
Galeria.pokazMiniaturki = function()
{
    var m = this.Miniaturki.getElementsByTagName("img");
    for (i = 0; i < m.length; i++) {
        if (this.Zdjecia[i + this.Pozycja]) {
            m[i].src = this.Zdjecia[i + this.Pozycja][1];
            eval("m[i].onclick = function() {Galeria.ustawDuze(" + (i + this.Pozycja) + ")}");
        } else {
            m[i].style.display = "none";
        }
    }
}
Galeria.ustawDuze = function(i)
{
    this.Duze.src = this.Zdjecia[i][0];
    this.Link.href = this.Zdjecia[i][2];
    // Wyłancza jedno ukryte
    var ukryte = this.Lytebox.getElementsByTagName("a");
    for (i = 0; i < ukryte.length; i++) {
        ukryte[i].rel = this.Rel;
        if (ukryte[i].href.match(new RegExp(this.Link.href))) {
            ukryte[i].rel = "";
        }
    }
}
Galeria.lewo = function()
{
    if (this.Pozycja > 0) {
        this.Pozycja--;
        this.pokazMiniaturki();
    }
}
Galeria.prawo = function()
{
    if (this.Zdjecia.length - this.Pozycja > 4) {
        this.Pozycja++;
        this.pokazMiniaturki();
    }
}
