function pobierz_info ( typ, limit, url )
{
    $.ajax({
        url: 'ajaxdb.php',
        type: 'GET',
        dataType: 'xml',
        timeout: 2000,
        data: 'action=getArtykuly&typ='+typ+'&limit='+limit,
        success: function(xml)
        {
              d = document.getElementById("dataTable");
        
              for (i = d.rows.length-1; i >= 0; i--)
                  d.deleteRow(i);
              
              $("/response/boxval", xml).each(function()
              {
                  rysuj_boxy ( $(this).text(), typ, url );
              });
              
              $("/response/record", xml).each(function()
              {
                  tr = document.createElement("tr");
                  td = document.createElement("td");
                  td.innerHTML = '<a href="/'+url+'/'+$('id',this).text()+'">'+$('title', this).text()+ '</a>';
                  tr.appendChild(td);
                  td = document.createElement("td");
                  td.innerHTML = $('data_dodania',this).text();
                  tr.appendChild(td);                       
                  d.appendChild(tr);    
              });
        }
    });
}

function rysuj_boxy( val, typ, url ) {
    thbox = document.getElementById("boxy");
    buffer = ''; 
    i = 1;
    
    for ( i = 1; i <= val; i++ )
    {
        buffer += '<a href="javascript:pobierz_info(\''+typ+'\', \''+(i-1)+'\', \''+url+'\')">'+i+'</a>';
    }

    thbox.innerHTML = '<br />' + buffer;
}
