﻿function addRowToTable() {
	var tbl = document.getElementById('tblSample');
	var lastRow = tbl.rows.length;
	var row = tbl.insertRow(lastRow);
	document.form.trucks.value = lastRow;

	//cell 1
	var cell = row.insertCell(0);
	cell.setAttribute("align", "center");
	var el = document.createElement('input');
	el.type = 'text';
	el.name = 'trans' + lastRow;
	el.size = 8;
	cell.appendChild(el);

	//cell 2
	var cell = row.insertCell(1);
	cell.setAttribute("align", "center");
	var el = document.createElement('input');
	el.type = 'text';
	el.name = 'vin' + lastRow;
	el.size = 8;
	cell.appendChild(el);

	//cell 3
	var cell = row.insertCell(2);
	cell.setAttribute("align", "center");
	var el = document.createElement('input');
	el.type = 'text';
	el.name = 'unit' + lastRow;
	el.size = 8;
	cell.appendChild(el);

	//cell 4
	var cell = row.insertCell(3);
	cell.setAttribute("align", "center");
	var el = document.createElement('input');
	el.type = 'text';
	el.name = 'license' + lastRow;
	el.size = 8;
	cell.appendChild(el);

	//cell 5
	var cell = row.insertCell(4);
	cell.setAttribute("align", "center");
	var el = document.createElement('input');
	el.type = 'text';
	el.name = 'licensestate' + lastRow;
	el.size = 8;
	cell.appendChild(el);

	//cell 6
	var cell = row.insertCell(5);
	cell.setAttribute("align", "center");
	var el = document.createElement('input');
	el.type = 'text';
	el.name = 'weight' + lastRow;
	el.size = 8;
	cell.appendChild(el);

	//cell 7
	var cell = row.insertCell(6);
	cell.setAttribute("align", "center");
	var el = document.createElement('input');
	el.type = 'text';
	el.name = 'irpexp' + lastRow;
	el.size = 8;
	cell.appendChild(el);
}
function removeRowFromTable() {
	var tbl = document.getElementById('tblSample');
	var lastRow = tbl.rows.length;
	if (lastRow > 2) {
		tbl.deleteRow(lastRow - 1);
		document.form.trucks.value = document.form.trucks.value - 1;
	}
}