$([green][i]'.addnew'[/i][/green]).live([green][i]'click'[/i][/green], [b]function[/b] () {
[b]var[/b] thisRow = $([b]this[/b]).parent().parent();
[b]var[/b] img_ins = $([green][i]'.image_insert'[/i][/green]),
i = img_ins.length + 1;
[b]var[/b] rowCnt = $([green][i]'#realtable tbody>tr'[/i][/green]).length;
newRow = thisRow.clone([b]true[/b]);
[highlight #fcc]newRow.find([green][i]'*'[/i][/green]).unbind();[/highlight]
newRow.insertAfter(thisRow);
[gray]//$(row).appendTo('#realtable');[/gray]
newRow.find([green][i]"select"[/i][/green]).first().attr([green][i]'id'[/i][/green], [green][i]'mark'[/i][/green] + rowCnt);
newRow.find([green][i]"select"[/i][/green]).last().attr([green][i]'id'[/i][/green], [green][i]'series'[/i][/green] + rowCnt);
newRow.find([green][i]"input"[/i][/green]).last().attr([green][i]'id'[/i][/green], [green][i]'stepvalue'[/i][/green] + rowCnt);
[highlight #cfc]$([green][i]'#series'[/i][/green] + rowCnt).chained([green][i]'#mark'[/i][/green] + rowCnt);
[/highlight]
[gray]//start renumber on insert[/gray]
[b]var[/b] x = 0;
$([green][i]'#realtable tr'[/i][/green]).each([b]function[/b] () {
$(this).find([green][i]"th:first"[/i][/green]).text(x);
newRow.find([green][i]'input.increment'[/i][/green]).val(parseInt(thisRow.find([green][i]'input.increment'[/i][/green]).text()) + x);
x++;
}); [gray]//end renumber on insert[/gray]
});