<!--

function get(id) {
        if (document.getElementById(id)) {
            return document.getElementById(id);
        }
    return false;
}

function zoom(strona, width, height) {
   window.open(strona,'ba','width='+width+',height='+height+',top=50,left=50');
}

function zoom2(strona) {
   window.open(strona,'ba','width=595,height=400,top=50,left=50');
}

function wydruk(id) {
   window.open('wydruk.php?id='+id,'ba','scrollbars=1,width=500,height=500,top=50,left=50');
}

function zgasDzialy() {
    var i = 1;
    while(get('dzial'+i)) {
        get('dzial'+i).checked = false;
        i++;
    }
}

function zgasTypy() {
    var i = 1;
    while(get('typ'+i)) {
        get('typ'+i).checked = false;
        i++;
    }
}

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 checkCheckbox(id) {
    checkbox = get(id);
    if (checkbox) {
        if (checkbox.checked == true) {
	    return true;
        }
    }
    return false;
}


function checkRejestracja(form, submit, pokaz) {
    wynik = true;
    var info = new Array();
    var i = 0;
    
    if (!checkInput('imie', 1)) { wynik = false; if (pokaz == true) { info[i++] = '- imię'; } }
    if (!checkInput('nazwisko', 1)) { wynik = false; if (pokaz == true) { info[i++] = '- nazwisko'; } }
    if (!checkInput('adres', 1)) { wynik = false; if (pokaz == true) { info[i++] = '- adres'; } }
    if (!checkInput('kod', 1)) { wynik = false; if (pokaz == true) { info[i++] = '- kod'; } }
    if (!checkInput('miejscowosc', 1)) { wynik = false; if (pokaz == true) { info[i++] = '- miasto'; } }
    if (!checkInput('telefon', 1)) { wynik = false; if (pokaz == true) { info[i++] = '- telefon'; } }
    if (!checkInput('email', 1)) { wynik = false; if (pokaz == true) { info[i++] = '- e-mail'; } }
    if ((!checkCheckbox('czasopismo'))&&(!checkCheckbox('telewizja'))&&(!checkCheckbox('radio'))&&(!checkCheckbox('fotografia'))&&(!checkCheckbox('internet'))) { wynik = false; if (pokaz == true) { info[i++] = '- medium'; } }
    if (!checkCheckbox('regulamin')) { wynik = false; if (pokaz == true) { info[i++] = '- zgoda'; } }

    if (wynik == false && info.length > 0 && pokaz == true) {
        var napis = "Proszę poprawnie uzupełnić następujące pola: \n"+info.join("\n");
        alert(napis);
    }
    return wynik;
}

function checkPrzypomnienie(form, submit, pokaz) {
    wynik = true;
    var info = new Array();
    var i = 0;

    if (!checkInput('email', 1)) { wynik = false; if (pokaz == true) { info[i++] = '- e-mail'; } }

    if (wynik == false && info.length > 0 && pokaz == true) {
        var napis = "Proszę poprawnie uzupełnić następujące pola: \n"+info.join("\n");
        alert(napis);
    }
    return wynik;
}

function p(id) {
    ustawienia.location.href = 'pobierz.php?id='+id;
}

function d(id, numer) {
    ustawienia.location.href = 'koszyk.php?opcja=dodaj&id='+id+'&numer='+numer;
}
function u(id, numer) {
    ustawienia.location.href = 'koszyk.php?opcja=usun&id='+id+'&numer='+numer;
}
function checkSubmit(form, e) {
    var keycode;
    if (window.event) 
	keycode = window.event.keyCode;
    else if (e) 
        keycode = e.which;
    if (keycode==13) {
        form.submit();
    }
}					    
//-->

