function ead_piecznavformat(page_nr,per_page_count,url) {
    var main_tr = document.getElementById('ead_piecz_tr');
    if(main_tr !== null && main_tr !== undefined) {
	//rysujemy wybrane pieczecie
	var first_idx = 0 + page_nr * per_page_count;
	var last_idx = first_idx + per_page_count - 1;

	var tables = main_tr.getElementsByTagName('table');
	
	var counter = 0;
	for(var i=0;i<tables.length;i++) {
	    if(tables[i].className !== undefined && tables[i].className !== null && tables[i].className == 'table_c04') {
		if(counter < first_idx) {
		    tables[i].style.display = 'none';
		} else {
		    if(counter > last_idx) {
			tables[i].style.display = 'none';
		    } else {
			tables[i].style.display = 'table';
		    }
		}		
		
		counter++;
	    }
	}
	
	if(counter > per_page_count) {
	    //stronicowanie
	    var nav_tr_innerhtml = "";
	    var page_numbers = Math.ceil(counter/per_page_count);
	    var td_empty = document.createElement("td");
	    var td_nav = document.createElement("td");
	    
	    for(var j=1;j<=page_numbers;j++) {
		if(j-1==page_nr) {
		    var current_page = document.createElement("span");
		    current_page.appendChild(document.createTextNode(""+j));
		    td_nav.appendChild(current_page);
		} else {
		    var nav_page = document.createElement("a");
		    //nav_page.href = "javascript: void(0);";
		    //eval("function call_ead_piecznavformat_"+j+"() {ead_piecznavformat("+(j-1)+","+per_page_count+");alignColumns();}");
		    //eval("nav_page.onclick = call_ead_piecznavformat_"+j+";");
		    nav_page.href = url.replace("\.htm",",spage,"+(j-1)+".htm");
		    nav_page.appendChild(document.createTextNode(""+j));
		    td_nav.appendChild(nav_page);
		}
	    }

	    var ead_nav_tr = document.getElementById('ead_piecz_nav');
	    if(ead_nav_tr === null || ead_nav_tr === undefined) {
		var parent_main = main_tr.parentNode;
		nav_tr = document.createElement("tr");
		nav_tr.id = "ead_piecz_nav";
		nav_tr.appendChild(td_empty);
		nav_tr.appendChild(td_nav);
		parent_main.insertBefore(nav_tr,main_tr);
		parent_main.insertBefore(main_tr,nav_tr);
	    } else {
		if(ead_nav_tr.hasChildNodes()) {
		    while(ead_nav_tr.childNodes.length >= 1) {
			ead_nav_tr.removeChild(ead_nav_tr.firstChild);
		    }
		}

		ead_nav_tr.appendChild(td_empty);
		ead_nav_tr.appendChild(td_nav);

	    }
	}
    }
}
        