<script type="text/javascript">
  //tutaj definicje danych
  function generujPola(id)
  {
    var div = document.getElementById(id);
    if(!div || !dane1) return;
    var str = "<fieldset><legend>Wybierz kategorię<\/legend>";
    for(var i = 0; i < dane1.length; i++){
      str += "<input type='radio' name='kategoria' value='" + i +"' ";
      str += "onclick='pokażKsiążki(" + i + ")'>";
      str += dane1[i] + "<br \>";
    }
    str += "<\/fieldset>";
    div.innerHTML = str;
  }
  function pokażKsiążki(index)
  {
    var div = document.getElementById('daneDiv');
    if(!div || !dane2 || index < 0 || index >= dane2.length) return;

    var str = "";
    for(var i = 0; i < dane2[index].length; i++){
      str += "<a href='" + baseURL + dane2[index][i].u + "'>";
      str += dane2[index][i].t + "<\/a><br \/>";
    }
    div.innerHTML = str;
  }
</script>