// JavaScript Document

var fotki = new Array(17);

//create a multidimensional array
for(var i = 0; i < fotki.length; i++){
fotki[i] = new Array(2);
}


fotki[0][0] = "images/produkt_1_tn.jpg";
fotki[0][1] = "images/produkt_1.jpg";
fotki[0][2] = "Skarpety dwukolorowe frotte";
fotki[0][3] = "mix wzorów i kolorów";
fotki[0][4] = "bawełna 70%, poliester 25%";
fotki[0][5] = "25-26,27-28,29-30";

fotki[1][0] = "images/produkt_2_tn.jpg";
fotki[1][1] = "images/produkt_2.jpg";
fotki[1][2] = "Skarpety dwukolorowe gładkie";
fotki[1][3] = "mix wzorów i kolorów";
fotki[1][4] = "bawełna 70%, poliester 25%";
fotki[1][5] = "25-26,27-28,29-30";

fotki[2][0] = "images/produkt_3_tn.jpg";
fotki[2][1] = "images/produkt_3.jpg";
fotki[2][2] = "Skarpety dwukolorowe stopki";
fotki[2][3] = "mix wzorów i kolorów";
fotki[2][4] = "bawełna 70%, poliester 25%";
fotki[2][5] = "23-24,25-26,27-28,29-30";

fotki[3][0] = "images/produkt_4_tn.jpg";
fotki[3][1] = "images/produkt_4.jpg";
fotki[3][2] = "Skarpety garninaturowe - płaski szew";
fotki[3][3] = "mix kolorów, ściągacz nieuciskający";
fotki[3][4] = "bawełna czesankowa 75%,elastan 23%";
fotki[3][5] = "25-26,27-28,29-30";

fotki[4][0] = "images/produkt_5_tn.jpg";
fotki[4][1] = "images/produkt_5.jpg";
fotki[4][2] = "Skarpety garninaturowe";
fotki[4][3] = "100% bawełny, mix kolorów";
fotki[4][4] = "bawełna 70%, poliester 25%";
fotki[4][5] = "25-26,27-28,29-30";

fotki[5][0] = "images/produkt_6_tn.jpg";
fotki[5][1] = "images/produkt_6.jpg";
fotki[5][2] = "Skarpety garninaturowe";
fotki[5][3] = "mix kolorów";
fotki[5][4] = "bawełna 70%, poliamid 25%";
fotki[5][5] = "23-24,25-26,27-28,29-30";

fotki[6][0] = "images/produkt_7_tn.jpg";
fotki[6][1] = "images/produkt_7.jpg";
fotki[6][2] = "Skarpety damskie";
fotki[6][3] = "mix wzorów i kolorów";
fotki[6][4] = "bawełna 70%, poliester 25%";
fotki[6][5] = "23-24,25-26,27-28";

fotki[7][0] = "images/produkt_8_tn.jpg";
fotki[7][1] = "images/produkt_8.jpg";
fotki[7][2] = "Skarpety męskie i chłopięce sportowe";
fotki[7][3] = "100% bawełny, mix wzorów i kolorów";
fotki[7][4] = "bawełna 70%, poliester 25%";
fotki[7][5] = "23-24,25-26,27-28,29-30";

fotki[8][0] = "images/produkt_9_tn.jpg";
fotki[8][1] = "images/produkt_9.jpg";
fotki[8][2] = "Skarpety frotte - ściągacz nieuciskający";
fotki[8][3] = "mix kolorów";
fotki[8][4] = "akryl 95%";
fotki[8][5] = "25-26,27-28,29-30";

fotki[9][0] = "images/produkt_10_tn.jpg";
fotki[9][1] = "images/produkt_10.jpg";
fotki[9][2] = "Podkolanówki frotte - ściągacz nieuciskający";
fotki[9][3] = "mix kolorów";
fotki[9][4] = "akryl 95%";
fotki[9][5] = "25-26,27-28,29-30";

fotki[10][0] = "images/produkt_11_tn.jpg";
fotki[10][1] = "images/produkt_11.jpg";
fotki[10][2] = "Skarpety sportowe - frotte";
fotki[10][3] = "pełna gama kolorystyczna";
fotki[10][4] = "bawełna 75%, poliester 25%";
fotki[10][5] = "19-20,21-22,23-24\n25-26,27-28,29-30";

fotki[11][0] = "images/produkt_12_tn.jpg";
fotki[11][1] = "images/produkt_12.jpg";
fotki[11][2] = "Rajstopy damskie 20 dtx";
fotki[11][3] = "pełna gama kolorystyczna";
fotki[11][4] = "poliamid 98%";
fotki[11][5] = "M,L,XL,XXL";

fotki[12][0] = "images/produkt_13_tn.jpg";
fotki[12][1] = "images/produkt_13.jpg";
fotki[12][2] = "Rajstopy damskie 72 dtx";
fotki[12][3] = "pełna gama kolorystyczna";
fotki[12][4] = "poliamid 98%";
fotki[12][5] = "M,L,XL,XXL";

fotki[13][0] = "images/produkt_14_tn.jpg";
fotki[13][1] = "images/produkt_14.jpg";
fotki[13][2] = "Podkolanówki, skarpetki damskie 20 dtx";
fotki[13][3] = "bezuciskowe";
fotki[13][4] = "poliamid 98%";
fotki[13][5] = "pełen zakres";

fotki[14][0] = "images/produkt_15_tn.jpg";
fotki[14][1] = "images/produkt_15.jpg";
fotki[14][2] = "Podkolanówki, skarpetki dziecięce 20 dtx";
fotki[14][3] = "pełna gama kolorów i wzorów, mix kolorów i wzorów";
fotki[14][4] = "poliamid 98%";
fotki[14][5] = "pełen zakres";

fotki[15][0] = "images/produkt_16_tn.jpg";
fotki[15][1] = "images/produkt_16.jpg";
fotki[15][2] = "Podkolanówka bezuciskowa";
fotki[15][3] = "pełna gama kolorystyczna";
fotki[15][4] = "elestan 16%, poliamid 84%";
fotki[15][5] = "pełen zakres";

fotki[16][0] = "images/produkt_17_tn.jpg";
fotki[16][1] = "images/produkt_17.jpg";
fotki[16][2] = "Rajstopa damska 20 dtx";
fotki[16][3] = "pełna gama kolorystyczna";
fotki[16][4] = "elestan 17%, poliamid 83%";
fotki[16][5] = "pełen zakres";




function update_counter(){

    var array_length = fotki.length;
    fo = document.getElementById('form_num');
    var which = fo.input_num.value;
    var b = parseInt(which)+1;
    var txt = b + "/" + array_length;
    
    counter = document.getElementById('ile');
    //alert (counter.childNodes[0].nodeValue);
    counter.childNodes[0].nodeValue = txt;

}

function next(pre){

    fotka_pre = new Image(); 
    fotka_pre.src = 'img/loading.gif'
    document.getElementById('gal_duzy').src = fotka_pre.src

    //reading and setting counter value from hidden formfield
    fo = document.getElementById('form_num');
    field = fo.input_num;
       
        if (typeof pre != 'undefined'){
        var a = pre;
        }
        else{
        var a = parseInt(field.value)+1;
        }
        
    var array_length = fotki.length; 
    
        if (a == array_length){
        a=0;
        }
    
    field.value = a;
    
    //reading from the photos array
    var imgname = fotki[a][0];
    var link_target = fotki[a][1];
    var tytul = fotki[a][2];
    var tytul_sub = fotki[a][3];
    var sklad = fotki[a][4];
    var rozmiar = fotki[a][5];
    
    //changing img+txt
    fotka = new Image(); 
    fotka.src = imgname;
    document.getElementById('gal_duzy').src = fotka.src;
    el = document.getElementById('nazwa');
    el.childNodes[0].nodeValue = tytul;
	 el = document.getElementById('duzy_link');
    el.href = link_target;
	 el = document.getElementById('nazwa_sub');
    el.childNodes[0].nodeValue = tytul_sub;
    el = document.getElementById('sklad');
    el.childNodes[0].nodeValue = sklad;
    el = document.getElementById('rozmiary');
    el.childNodes[0].nodeValue = rozmiar;
    
    //display new numbers
    update_counter();
}

function prev(){
    
    fotka_pre = new Image();
    fotka_pre.src = 'img/loading.gif'
    document.getElementById('gal_duzy').src = fotka_pre.src
    
    
    //reading and setting counter value from hidden formfield
    fo = document.getElementById('form_num');
    field = fo.input_num;
    var a = parseInt(field.value)-1;
    
    var array_length = fotki.length;
    
        if (a<0){
        a = array_length-1;
        }
    
    field.value = a;
    
     //reading from the photos array
    var imgname = fotki[a][0];
    var link_target = fotki[a][1];
    var tytul = fotki[a][2];
    var tytul_sub = fotki[a][3];
    var sklad = fotki[a][4];
    var rozmiar = fotki[a][5];
    
    //changing img+txt
    fotka = new Image();
    fotka.src = imgname;
    document.getElementById('gal_duzy').src = fotka.src
    el = document.getElementById('nazwa');
    el.childNodes[0].nodeValue = tytul;
	 el = document.getElementById('duzy_link');
    el.href = link_target;
	 el = document.getElementById('nazwa_sub');
    el.childNodes[0].nodeValue = tytul_sub;
    el = document.getElementById('sklad');
    el.childNodes[0].nodeValue = sklad;
    el = document.getElementById('rozmiary');
    el.childNodes[0].nodeValue = rozmiar;
    
    //display new numbers
    update_counter();
}


