  function bip_big(plik, szer, wys){
    url = "bip_big.php?id="+plik+"&wys="+wys+"&szer="+szer;
	specs = "toolbar=no,directories=no,menubar=no,scrollbars=yes,width="+szer+",height="+wys;
    open(url, "", specs);
  }
  
  function big(plik, szer, wys){
    url = "big.php?id="+plik+"&wys="+wys+"&szer="+szer;
	specs = "toolbar=no,directories=no,menubar=no,scrollbars=yes,width="+szer+",height="+wys;
    open(url, "", specs);
  }
  
  function big_opis(plik, szer, wys, opis){
    url = "big.php?id="+plik+"&wys="+wys+"&szer="+szer+"&opis="+opis;
	specs = "toolbar=no,directories=no,menubar=no,scrollbars=yes,width="+szer+",height="+(wys+40);
    open(url, "", specs);
  }

  function search(){
    f = document.forms['search_form'];
    f.q.value = trim(f.q.value);
    if(f.q.value.length == 0){
      alert('Proszę podać słowa do wyszukania');
    } else {
      // f.kryt.value = 1;
      f.action = 'index.php';
      f.submit();
    }
  } // search

  function trim(t){
    while(t.charAt(t.length-1) == ' '){
      t = t.substr(0, t.length-1);
    }
    while(t.charAt(0) == ' '){
      t = t.substr(1, t.length);
    }
    return t;
  }
  
  function instrukcja(){
    url     = 'instrukcja/petent.php';
    opcje   = "toolbar=no,directories=no,menubar=no,scrollbars=yes,width=600,height=400";
    window.open(url, '', opcje);
  }

  function druk(id, kat){
    url     = 'druk_bip.php?cid='+id+'&kat='+kat+'&print=1';
    opcje   = "toolbar=no,directories=no,menubar=yes,scrollbars=yes,width=600,height=400";
    window.open(url, '', opcje);
  }

  function generuj_pdf(id){
    url     = 'generuj_pdf.php?cid='+id;
    //opcje   = "toolbar=no,directories=no,menubar=yes,scrollbars=yes";
    open(url);//, '', opcje);
  }  

  function zapisz(id, kat){
    url     = 'druk_bip.php?cid='+id+'&kat='+kat+'&save=1';
    opcje   = "toolbar=no,directories=no,menubar=yes,scrollbars=yes,width=600,height=400";
    window.open(url, '', opcje);
  }

  function sprawdz_kontakt()
	{
	if(!spr_mail("mailfrom")) return false;

	var wiadomosc = document.getElementById("wiadomosc");
	if(wiadomosc.value.length==0)
		{
		alert("Podaj treść wiadomości");
		wiadomosc.focus();
		return false;
		}

	return confirm("Czy wszystkie dane są poprawne?");	
	}
 
function spr_mail(mail)
	{
	mail=document.getElementById(mail);

	if((mail.value.length==0) || (!mail.value.match(/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/)))
		{
		alert("Podaj prawidłowy adres e-mail\n(dozwolone małe litery, cyfry oraz znaki _.-)");
		mail.focus();
		return false;
		}

	return true;
	}
