function addrow(idtabella,dimensione,nomi)
{
var arr = nomi.split("|");
var tbl = document.getElementById(idtabella);
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
var n_elementi = tbl.cells.length / lastRow;

for (var i=0;i<n_elementi;i++)
 {
	if (i > 0)
	{
	var cellbox = row.insertCell(0);	
	cellbox.style.backgroundColor = "#F4F4F4";
	cellbox.align='center';

	var box = document.createElement('input');
	box.setAttribute('type', 'text');
	box.setAttribute('name', idtabella + '_' + arr[i-1]+ iteration);
//	box.setAttribute('id', 'txtRow_' + iteration);
	box.setAttribute('size', dimensione);
//	box.setAttribute('maxlength', '6');
//	box.setAttribute('value', idtabella + '_' + arr[i-1] + iteration);
	
	cellbox.appendChild(box);
	}
	else
	{
	var cellbox = row.insertCell(0);	
	cellbox.style.backgroundColor = "#F4F4F4";
	cellbox.align='center';
	}	
 }
}

