<!--

var katalog_start = '/';

function l(strona) {
    window.location.href = strona;
}

function l2(strona) {
    parent.kalkulacja.location.href = strona;
}

function l3(strona) {
    parent.content2.location.href = strona;
}

function get(id) {
        if (document.getElementById(id)) {
            return document.getElementById(id);
        }
    return false;
}

function checkMail(id) {
    email = get(id).value;
	var filter  = /([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (filter.test(email)) {
        return true;
    }
    return false;
}

function checkInput(id, min) {
    input = get(id).value;
    if (input.length >= min) {
        return true;
    }
    return false;
}

function maks200(obj) {
    var maksD=200;
    if (obj.getAttribute && obj.value.length>maksD)
    obj.value=obj.value.substring(0,maksD)
}

function pokazPorownanie() {
    get('tr_porownanie').style.display='block';
    get('tr_koszyk').style.display='none';
}

function pokazKoszyk() {
    get('tr_koszyk').style.display='block';
    get('tr_porownanie').style.display='none';
}

function zmienTop() {
    if (get('top1').style.display == 'none') {
        get('top1').style.display = 'block';
        get('top2').innerHTML = 'zwiń TOP x';
    }
    else {
        get('top1').style.display = 'none';
        get('top2').innerHTML = 'rozwiń TOP ';
    }
    if (parseInt(get('content2').style.height) == 0) {
        if (get('top1').style.display == 'none') {
            get('nav').style.height = parseInt(get('nav').style.height)+140;
            get('content').style.height = parseInt(get('content').style.height)+140;
        }
        else {
            get('nav').style.height = parseInt(get('nav').style.height)-140;
            get('content').style.height = parseInt(get('content').style.height)-140;
        }
    }
    else {
        if (get('top1').style.display == 'none') {
            get('content2').style.height = parseInt(get('content2').style.height)+140;
        }
        else {
            get('content2').style.height = parseInt(get('content2').style.height)-140;
        }
    }
}

function zmienProporcje(c1,c2) {
   if (get('top1').style.display == 'block') {
       get('nav').style.height = c1;
       get('content').style.height = c1;
       get('content2').style.height = c2;
   }
   else {
       if (c2 == 0) {
           get('nav').style.height = parseInt(c1)+140;
           get('content').style.height = parseInt(c1)+140;
           get('content2').style.height = parseInt(c2);
       }
       else {
           get('nav').style.height = parseInt(c1);
           get('content').style.height = parseInt(c1);
           get('content2').style.height = parseInt(c2)+140;
       }
   }
}

function zapalTr(id) {
    i = 1;
    while(get('tr'+i)) {
        if (i == id) {
            if (get('tr'+i).bgColor != '#cccccc') {
                get('tr'+i).bgColor="#EAEAEA";
            }
        }
        else {
            if (get('tr'+i).bgColor != '#cccccc') {
                get('tr'+i).bgColor="#FFFFFF";
            }
        }
        i++;
    }
}
function zapalTr1(id) {
    var start = 1;
    var stop = parseInt(id)+1;
    if (id > 1) { start = parseInt(id)-1; }
    
    for(i=start; i<=stop; i++) {
        if (get('tr'+i)) {
            if (i == id) {
                if (get('tr'+i).bgColor != '#cccccc') {
                    get('tr'+i).bgColor="#EAEAEA";
                }
            }
            else {
                if (get('tr'+i).bgColor != '#cccccc') {
                    get('tr'+i).bgColor="#FFFFFF";
                }
            }
        }
    }
}

function zgasTr(id) {
    i = 1;
    while(get('tr'+i)) {
        if (i == id) {
            if (get('tr'+i).bgColor != '#cccccc') {
                get('tr'+i).bgColor="#FFFFFF";
            }
        }
        i++;
    }
}

function zgasTr1(id) {
   
    if (get('tr'+id).bgColor != '#cccccc') {
        get('tr'+id).bgColor="#FFFFFF";
    }
}

function zaznaczTr(id) {
    i = 1;
    while(get('tr'+i)) {
        if (i == id) {
            get('tr'+i).bgColor="#CCCCCC";
        }
        else {
            get('tr'+i).bgColor="#FFFFFF";
        }
        i++;
    }
}

function numbersonly(element, e, dec) {
    var key;
    var keychar;
    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.which;
    else
        return true;
    keychar = String.fromCharCode(key);
    if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) {
        return true;
    }
    // float
    if (dec == true) {
        if ((("0123456789\.").indexOf(keychar) > -1) && (keychar != '.' || element.value.indexOf('.') <= -1)) {
            return true;
        }
    }
    else if ((("0123456789").indexOf(keychar) > -1)) {
        return true;
    }
    return false;
}

function li(page1,page2) {
    if (page1.length >0) {
        parent.content.location.href=page1;
    }
    if (page2.length >0) {
        parent.content2.location.href=page2;
    }
}

function loopSelected(from, to) {
    var selectedArray = new Array();
    var i = 0;
    var count = 0;
    for (i=0; i<from.options.length; i++) {
        selectedArray[count] = from.options[i].value;
        count++;
    }
    to.value = selectedArray;
}

function loopSelected2(from, to) {
    var selectedArray = new Array();
    var i = 0;
    var count = 0;
    for (i=0; i<from.options.length; i++) {
        if (from.options[i].selected) {
            selectedArray[count] = from.options[i].value;
            count++;
        }
    }
    to.value = selectedArray;
}

function zmienZdjecie(zdjecie) {
    var zid = get('zid').value;
    get(zid).src = ''+zdjecie+'';
    if (get('n1')) { get('n1').className = 'z1'; }
    if (get('n2')) { get('n2').className = 'z1'; }
    if (get('n3')) { get('n3').className = 'z1'; }
    if (get('n4')) { get('n4').className = 'z1'; }
    if (get('n5')) { get('n5').className = 'z1'; }
    if (get('n'+get('zn').value)) { get('n'+get('zn').value).className = 'z2'; }
}

function checkLength(id, idc) {
    var max = 300;
    if (get(id).value.length > max) {
        get(id).value = get(id).value.substring(0, max);
    }
    get(idc).innerHTML = max-get(id).value.length;
}
function sprawdzKomentarz() {
    var wynik=true;
    if (!checkInput('identyfikator_pole', 1)) { get("identyfikator_pole").className="error"; wynik=false; } else { get("identyfikator_pole").className="pole"; }
    if (get('ocena_pole').selectedIndex == 0) { get("ocena_pole").className="error"; wynik=false; } else { get("ocena_pole").className="pole"; }
    if (!checkInput('komentarz_pole', 1)) { get("komentarz_pole").className="error"; wynik=false; } else { get("komentarz_pole").className="pole"; }
    if (wynik==false){ alert(kt['pp']); }
    return wynik;
}
function sprawdzPolec() {
    var wynik=true;
    if (!checkMail('polec_od')) { get("polec_od").className="error"; wynik=false; } else { get("polec_od").className="pole"; }
    if (!checkMail('polec_do')) { get("polec_do").className="error"; wynik=false; } else { get("polec_do").className="pole"; }
    if (!checkInput('polec_podpis', 1)) { get('polec_podpis').className = 'error'; wynik=false; } else { get('polec_podpis').className = 'pole'; }
        if (wynik==false){ alert(kt['pp']); }
    return wynik;
}

function pokazPolecTytul() {
    get('polec_tytul').value = get('polec_podpis').value+' '+get('tytul2').value+' '+get('tytul1').value;
}
function k(id, o) {
    if (o == 'change') { ustawienia.location.href = katalog_start+'ustawienia.php?id='+id+'&o='+o+'&liczba='+get('ilosc'+id).options[get('ilosc'+id).selectedIndex].value; }
    else { ustawienia.location.href = katalog_start+'ustawienia.php?id='+id+'&o='+o; }
}
function k_kon(id, o) {
    var podstawa = get('podstawa').value;
    var ramie = get('ramie').value;
    var uchwyt = get('uchwyt').value;
    ustawienia.location.href = katalog_start+'ustawienia.php?id='+id+'&o='+o+'&podstawa='+podstawa+'&ramie='+ramie+'&uchwyt='+uchwyt;
}
function k_konf() {
    ustawienia.location.href = katalog_start+'ustawienia.php?k_konf=1';
}
function p(id, o) {
    ustawienia.location.href = katalog_start+'ustawienia.php?id='+id+'&p='+o;
}
function pp() {
    parent.window.open('/porownanie.php', 'PlayExtreme', 'status=yes,scrollbars=yes,width=1005,height=500,left=0,top=0');
}
function rz(id) {
    parent.window.open('/raty.php?id='+id, 'PlayExtreme', 'status=yes,scrollbars=yes,width=420,height=400,left=50,top=50');
}

function zmien_transport() {
    var id_transportu = get('transport').options[get('transport').selectedIndex].value;
    var cena_zakupu_brutto = get('produkty_kwota').value;
    for(z=0;z<transporty.length;z++) {
        var transport = transporty[z];
        if (id_transportu == transport[0]) {
            get('transport_kwota').innerHTML = number_format(transport[2], 2, ',', ' ');
            get('zamowienie_kwota').innerHTML = number_format(parseFloat(cena_zakupu_brutto)+parseFloat(transport[2]), 2, ',', ' ');
        }
    }
    zmien_raty();
}

function zmienPolaJakWyzej1() {
    if (get('jakwyzej1').checked) {
        get('firma_adres_wysylka').readOnly = true;
        get('firma_kod_wysylka').readOnly = true;
        get('firma_miasto_wysylka').readOnly = true;
        get('firma_adres_wysylka_text').className='txt-disabled';
        get('firma_kod_wysylka_text').className='txt-disabled';
        get('firma_miasto_wysylka_text').className='txt-disabled';
        get('firma_adres_wysylka').value = '';
        get('firma_kod_wysylka').value = '';
        get('firma_miasto_wysylka').value = '';
        zgasWysylke();
    }
    else {
        get('firma_adres_wysylka').readOnly = false;
        get('firma_kod_wysylka').readOnly = false;
        get('firma_miasto_wysylka').readOnly = false;
        get('firma_adres_wysylka_text').className='txt';
        get('firma_kod_wysylka_text').className='txt';
        get('firma_miasto_wysylka_text').className='txt';
        zapalWysylke();
    }
}

function zmienPolaJakWyzej2(numer) {
    if (numer == 2) {
        get('jakwyzej3').checked = false;
    }
    else if (numer == 3) {
        get('jakwyzej2').checked = false;
    }


    if ((get('jakwyzej2').checked) || (get('jakwyzej3').checked)) {
        get('firma_adres').readOnly = true;
        get('firma_kod').readOnly = true;
        get('firma_miasto').readOnly = true;

        get('firma_adres_text').className='txt-disabled';
        get('firma_kod_text').className='txt-disabled';
        get('firma_miasto_text').className='txt-disabled';

        get('firma_adres').value = '';
        get('firma_kod').value = '';
        get('firma_miasto').value = '';

        if (get('jakwyzej2').checked) {
            get('zgodny_z_rejestracja').className='txt';
            get('zgodny_z_faktura').className='txt-disabled';
       }
       else {
            get('zgodny_z_rejestracja').className='txt-disabled';
            get('zgodny_z_faktura').className='txt';
       }
       zgasFirma();
    }
    else {
        get('firma_adres').readOnly = false;
        get('firma_kod').readOnly = false;
        get('firma_miasto').readOnly = false;

        get('firma_adres_text').className='txt';
        get('firma_kod_text').className='txt';
        get('firma_miasto_text').className='txt';

        get('zgodny_z_rejestracja').className='txt-disabled';
        get('zgodny_z_faktura').className='txt-disabled';
        zapalFirma();
    }
}
function zgasFirma() {
     get('firma_adres').className = 'pole-disabled';
     get('firma_kod').className = 'pole-disabled';
     get('firma_miasto').className = 'pole-disabled';
}

function zapalFirma() {
     get('firma_adres').className = 'pole';
     get('firma_kod').className = 'pole';
     get('firma_miasto').className = 'pole';
}

function zgasWysylke() {
     get('jakwyzej1_txt').className='txt';
     get('firma_adres_wysylka').className = 'pole-disabled';
     get('firma_kod_wysylka').className = 'pole-disabled';
     get('firma_miasto_wysylka').className = 'pole-disabled';
}

function zapalWysylke() {
    get('jakwyzej1_txt').className='txt-disabled';
     get('firma_adres_wysylka').className = 'pole';
     get('firma_kod_wysylka').className = 'pole';
     get('firma_miasto_wysylka').className = 'pole';
}

function sprawdzAkceptacja() {
    wynik = false;
    if (get('akceptacja').checked) { wynik = true; }
    else { alert(kt['pa']); }
    return wynik;
}

function sprawdzPlatnosc(){
    wynik = false;
    var platnosc = get('platnosc_select').options[get('platnosc_select').selectedIndex].value;
    if (platnosc) { wynik = true; }
    else { alert(kt['wp']); }
    return wynik;
}

function sprawdzRejestracja() {
    var wynik = true;
    if (!checkInput('imie', 1)) { get('imie').className = 'error'; wynik=false; } else { get('imie').className ="pole"; }
    if (!checkInput('nazwisko', 1)) { get('nazwisko').className = 'error'; wynik=false; } else { get('nazwisko').className ="pole"; }
    if (!checkMail('email')) { get("email").className="error"; wynik=false; } else { get("email").className="pole"; }
    if (!checkInput('telefon', 1)) { get('telefon').className = 'error'; wynik=false; } else { get('telefon').className ="pole"; }
    if (get('jakwyzej1').checked == false) {
        if (!checkInput('firma_adres_wysylka', 1)) { get('firma_adres_wysylka').className = 'error'; wynik=false; } else { get('firma_adres_wysylka').className = 'pole'; }
        if (!checkInput('firma_miasto_wysylka', 1)) { get('firma_miasto_wysylka').className = 'error'; wynik=false; } else { get('firma_miasto_wysylka').className = 'pole'; }
        if (!checkInput('firma_kod_wysylka', 1)) { get('firma_kod_wysylka').className = 'error'; wynik=false; } else { get('firma_kod_wysylka').className = 'pole'; }
    }
    if (get('jakwyzej2').checked == false && get('jakwyzej3').checked == false) {
        // if (!checkInput('firma_nazwa', 1)) { get('firma_nazwa').className = 'error'; wynik=false; } else { get('firma_nazwa').className = 'pole'; }
        if (!checkInput('firma_adres', 1)) { get('firma_adres').className = 'error'; wynik=false; } else { get('firma_adres').className = 'pole'; }
        if (!checkInput('firma_miasto', 1)) { get('firma_miasto').className = 'error'; wynik=false; } else { get('firma_miasto').className = 'pole'; }
        if (!checkInput('firma_kod', 1)) { get('firma_kod').className = 'error'; wynik=false; } else { get('firma_kod').className = 'pole'; }
    }
    if (wynik==false){ alert(kt['pp']); }
    return wynik;
}
function r(link) {
    document.location.href = link;
}
function zmien_platnosc() {
    var platnosc = get('platnosc_select').options[get('platnosc_select').selectedIndex].value;
    removeAllOptions(get('transport'));
    if (platnosc == 'w kasie Device Polska') {
        addOption(get('transport'), "0", transporty[0][1]);
        zmien_transport();
    }
    else {
        for(i=1;i<transporty.length;i++) {
            addOption(get('transport'), transporty[i][0], transporty[i][1]);
        }
        if (platnosc != 'za pobraniem') {
            addOption(get('transport'), "0", transporty[0][1]);
        }
    }
    zmien_transport();
    zmien_raty();
}

function zmien_raty() {
    if (ln == 'pl') {
        var platnosc = get('platnosc_select').options[get('platnosc_select').selectedIndex].value;
        if (platnosc == 'raty') {
            iraty.location.href = katalog_start+'_blank.php';
            var id_transportu = get('transport').options[get('transport').selectedIndex].value;
            iraty.location.href = katalog_start+'raty.php?id_transportu='+id_transportu;
            if (ln == 'pl') { get('draty').style.display = 'block'; }
        }
        else {
            get('draty').style.display = 'none';
        }
    }
}


function number_format(a, b, c, d) {
    a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
    e = a + '';
    f = e.split('.');
    if (!f[0]) { f[0] = '0'; }
    if (!f[1]) { f[1] = ''; }
    if (f[1].length < b) { g = f[1]; for (i=f[1].length + 1; i <= b; i++) { g += '0'; } f[1] = g; }
    if(d != '' && f[0].length > 3) { h = f[0]; f[0] = ''; for(j = 3; j < h.length; j+=3) { i = h.slice(h.length - j, h.length - j + 3); f[0] = d + i +  f[0] + ''; } j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3)); f[0] = j + f[0]; }
    c = (b <= 0) ? '' : c;
    return f[0] + c + f[1];
}

function removeAllOptions(selectbox) {
    var i;
    for(i=selectbox.options.length-1;i>=0;i--) {
        selectbox.remove(i);
    }
}

function addOption(selectbox, value, text ) {
    var optn = document.createElement("OPTION");
    optn.text = text;
    optn.value = value;
    selectbox.options.add(optn);
}

function pokazZoom(page1, width, height) {
    window_handle = window.open(page1,'popupWindowName1','scrollbars=yes,status=no,width='+width+',height='+height+',left=0,top=50');
}

function pokazZoom2(page1, width, height) {
    window_handle = window.open(page1,'popupWindowName1','scrollbars=yes,status=no,width='+width+',height='+height+',left=0,top=50');
}

function checkRent(form, submit, pokaz) {
    wynik = true;
    var info = new Array();
    var i = 0;
    
    if (!checkInput('imie', 1)) { get('imie').className = 'error'; wynik=false; } else { get('imie').className ="pole"; }
    if (!checkInput('nazwisko', 1)) { get('nazwisko').className = 'error'; wynik=false; } else { get('nazwisko').className ="pole"; }
    if (!checkInput('firma', 1)) { get('firma').className = 'error'; wynik=false; } else { get('firma').className ="pole"; }
    if (!checkMail('email')) { get('email').className = 'error'; wynik=false; } else { get('email').className ="pole"; }
    if (!checkInput('telefon', 1)) { get('telefon').className = 'error'; wynik=false; } else { get('telefon').className ="pole"; }

    if (wynik==false){ alert(kt['pp']); }
    return wynik;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function zoom() {
    var width = 450;
    var height = 450;
    var zn = get('zn').value;
    var zid = get('zid').value;
    var idp = get('idp').value;
    var typ = get('typ').value;
    window_handle = window.open('/zoom.php?idp='+idp+'&zdjecie='+basename(get(zid).src).replace('_d', '_xl').replace('_m', '_xl')+'&zn='+zn+'&zid='+zid+'&typ='+typ,'PlayExtreme','scrollbars=no,status=no,width='+width+',height='+height+',left=0,top=50');
}
function basename(path, suffix) {
    var b = path.replace(/.*[\/\\]/g, '');
     
    if (typeof(suffix) == 'string' && b.substr(b.length-suffix.length) == suffix) {
        b = b.substr(0, b.length-suffix.length);
    }
    return b;
}

function konf(element) {
    var i=0;
    var razem = 0;
    if (element == 'podstawa') {
	var id_podstawy = get('podstawa').options[get('podstawa').selectedIndex].value;
	for(i=0; i<podstawy.length; i++) {
	    if (podstawy[i][0] == id_podstawy) {
		get('podstawa_src').src = '/zdjecia/'+podstawy[i][2];
		get('podstawa_cena').innerHTML = podstawy[i][1]+' '+waluta;
		get('podstawa_opis').innerHTML = podstawy[i][3];
	        ustawienia.location.href = 'ustawienia.php?typ='+element+'&k='+id_podstawy;
	    }
	}
	if (id_podstawy == 0) {
		get('podstawa_src').src = '/img/p.gif';
		get('podstawa_cena').innerHTML = '';
		get('podstawa_opis').innerHTML = '';
	        ustawienia.location.href = 'ustawienia.php?typ='+element+'&k=';
	}
    }
    if (element == 'ramie') {
	var id_ramie = get('ramie').options[get('ramie').selectedIndex].value;
	for(i=0; i<ramiona.length; i++) {
	    if (ramiona[i][0] == id_ramie) {
		get('ramie_src').src = '/zdjecia/'+ramiona[i][2];
		get('ramie_cena').innerHTML = ramiona[i][1]+' '+waluta;
		get('ramie_opis').innerHTML = ramiona[i][3];
	        ustawienia.location.href = 'ustawienia.php?typ='+element+'&k='+id_ramie;
	    }
	}
	if (id_ramie == 0) {
		get('ramie_src').src = '/img/p.gif';
		get('ramie_cena').innerHTML = '';
		get('ramie_opis').innerHTML = '';
	        ustawienia.location.href = 'ustawienia.php?typ='+element+'&k=0';
	}
    }
    if (element == 'uchwyt') {
	var id_uchwytu = get('uchwyt').options[get('uchwyt').selectedIndex].value;
	for(i=0; i<uchwyty.length; i++) {
	    if (uchwyty[i][0] == id_uchwytu) {
		get('uchwyt_src').src = '/zdjecia/'+uchwyty[i][2];
		get('uchwyt_cena').innerHTML = uchwyty[i][1]+' '+waluta;
		get('uchwyt_opis').innerHTML = uchwyty[i][3];
	        ustawienia.location.href = 'ustawienia.php?typ='+element+'&k='+id_uchwytu;
	    }
	}
	if (id_uchwytu == 0) {
		get('uchwyt_src').src = '/img/p.gif';
		get('uchwyt_cena').innerHTML = '';
		get('uchwyt_opis').innerHTML = '';
	        ustawienia.location.href = 'ustawienia.php?typ='+element+'&k=';
	}
    }
    var id_podstawy = get('podstawa').options[get('podstawa').selectedIndex].value;
    for(i=0; i<podstawy.length; i++) {
        if (podstawy[i][0] == id_podstawy) {
	    razem += parseInt(podstawy[i][1]);
        }
    }
    var id_ramie = get('ramie').options[get('ramie').selectedIndex].value;
    for(i=0; i<ramiona.length; i++) {
        if (ramiona[i][0] == id_ramie) {
	    razem += parseInt(ramiona[i][1]);
	}
    }
    var id_uchwytu = get('uchwyt').options[get('uchwyt').selectedIndex].value;
    for(i=0; i<uchwyty.length; i++) {
        if (uchwyty[i][0] == id_uchwytu) {
	    razem += parseInt(uchwyty[i][1]);
        }
    }
    get('razem').innerHTML = razem+' '+waluta;

}

function konf2(opcja1, element, id) {
    ustawienia.location.href = 'ustawienia.php?opcja=konfigurator&opcja1='+opcja1+'&typ='+element+'&k='+id;
}

function k_zoom(id) {
    parent.window.open('/zzoom.php?id='+id, 'PlayExtreme', 'status=yes,scrollbars=yes,width=320,height=450,left=50,top=50');
}

function z_konf(element) {
    var i=0;
    if (element == 'podstawa') {
        var id_podstawy = get('podstawa').options[get('podstawa').selectedIndex].value;
        for(i=0; i<podstawy.length; i++) {
            if (podstawy[i][0] == id_podstawy) {
                get('podstawaInner').innerHTML = '<a href="#p" onclick="k_zoom('+id_podstawy+');"><img src="/zdjecia/'+podstawy[i][2]+'" alt=""></a>';
            }
        }
        if (id_podstawy == 0) {
            get('podstawaInner').innerHTML = '';
        }
    }
    if (element == 'ramie') {
        var id_ramie = get('ramie').options[get('ramie').selectedIndex].value;
        for(i=0; i<ramiona.length; i++) {
            if (ramiona[i][0] == id_ramie) {
                get('ramieInner').innerHTML = '<a href="#p" onclick="k_zoom('+id_ramie+');"><img src="/zdjecia/'+ramiona[i][2]+'" alt=""></a>';
            }
        }
        if (id_ramie == 0) {
            get('ramieInner').innerHTML = '';
        }
    }
    if (element == 'uchwyt') {
        var id_uchwytu = get('uchwyt').options[get('uchwyt').selectedIndex].value;
        for(i=0; i<uchwyty.length; i++) {
            if (uchwyty[i][0] == id_uchwytu) {
                get('uchwytInner').innerHTML = '<a href="#p" onclick="k_zoom('+id_uchwytu+');"><img src="/zdjecia/'+uchwyty[i][2]+'" alt=""></a>';
            }
        }
        if (id_uchwytu == 0) {
            get('uchwytInner').innerHTML = '';
        }
    }
}

function replaceAll(ciag,we,wy){
    if ((we!=wy) && (we.length>0)){
        while (ciag.indexOf(we)!=-1) {
            ciag=ciag.replace(we,wy);
        }
    }
    return ciag;
}


function checkPhone(lang , form, submit, pokaz) {
    wynik = true;
    var info = new Array();
    var i = 0;
    
    var telefon = replaceAll(get('telefon1').value, ' ', '');
    if (telefon.length <9) { wynik = false; if (pokaz == true) { info[i++] = '- telefon'; } }

    if (wynik == false && info.length > 0 && pokaz == true) {
        if (lang == 'en') {
            var napis = "Please fill in telephone number correctly.";
        }
        else {
            var napis = "Proszę wprowadzić poprawny numer telefonu.";
        }
        alert(napis);
    }
    return wynik;
}

function zmienBaner(wartosc) {
    if (wartosc >= 0) {
        get('baner_src').src = banery[wartosc][0];
        
        var i = 0;
        while(get('nb'+i)) {
            var j = i+1;
            get('nb'+i).src = '/img/'+j+'a.gif';
            i++;
        }
        
        var j = parseInt(wartosc)+1;
        get('nb'+wartosc).src = '/img/'+j+'b.gif';
        get('start').value = 0;
    }
    else {
        if (get('start').value == 1) {
            var i=0;
            var aktualny = 0;
            var nastepny = 0;
            
            while(banery[i]) {
                //alert(get('banery_src').src);
                if (basename(banery[i][0]) == basename(get('baner_src').src)) {
                    aktualny = i;
                }
                i++; 
            }
            
            i = 0;
            while(get('nb'+i)) {
                var j = i+1;
                get('nb'+i).src = '/img/'+j+'a.gif';
                i++;
            }
            
            if (aktualny == banery.length-1) {
                nastepny = 0;
            }
            else {
                nastepny = aktualny+1;
            }
            
            get('baner_src').src = banery[nastepny][0];
            get('baner_href').href = banery[nastepny][1];
            if (banery[nastepny][1]) {
                if (banery[nastepny][1].indexOf("http://") >= 0) { get('baner_href').target = "_blank"; }
                else { get('baner_href').target = "_self"; }
                get('baner_href').style.cursor = 'pointer';
            }
            else {
                get('baner_href').style.cursor = 'auto';
            }
            var j = nastepny+1;
            get('nb'+nastepny).src = '/img/'+j+'b.gif';
            setTimeout('zmienBaner(-1)', czas);
        }
    }
}

function zmienBaner2(wartosc) {
    if (wartosc >= 0) {
        get('baner2_src').src = banery2[wartosc][0];
        
        var i = 0;
        while(get('nd'+i)) {
            var j = i+1;
            get('nd'+i).src = '/img/'+j+'a.gif';
            i++;
        }
        
        var j = parseInt(wartosc)+1;
        get('nd'+wartosc).src = '/img/'+j+'b.gif';
        get('start2').value = 0;
    }
    else {
        if (get('start2').value == 1) {
            var i=0;
            var aktualny = 0;
            var nastepny = 0;
            
            while(banery2[i]) {
                //alert(get('banery_src').src);
                if (basename(banery2[i][0]) == basename(get('baner2_src').src)) {
                    aktualny = i;
                }
                i++; 
            }
            
            i = 0;
            while(get('nd'+i)) {
                var j = i+1;
                get('nd'+i).src = '/img/'+j+'a.gif';
                i++;
            }
            
            if (aktualny == banery2.length-1) {
                nastepny = 0;
            }
            else {
                nastepny = aktualny+1;
            }
            
            get('baner2_src').src = banery2[nastepny][0];
            get('baner2_href').href = banery2[nastepny][1];
            if (banery2[nastepny][1]) {
                if (banery2[nastepny][1].indexOf("http://") >= 0) { get('baner2_href').target = "_blank"; }
                else { get('baner2_href').target = "_self"; }
                get('baner2_href').style.cursor = 'pointer';
            }
            else {
                get('baner2_href').style.cursor = 'auto';
            }
            var j = nastepny+1;
            get('nd'+nastepny).src = '/img/'+j+'b.gif';
            setTimeout('zmienBaner2(-1)', czas);
        }
    }
}


//-->
