var numRows = 2;
var maxRows = 7;


function addRow() {

	if(numRows < maxRows) {
		var tbody = document.getElementById("tbody");
		row = document.createElement("tr");
		td1 = document.createElement("td");
		td2 = document.createElement("td");
		td3 = document.createElement("td");
		td4 = document.createElement("td");

		td1.innerHTML = "<input type=\"text\" id=\"code"+numRows+"\" size=\"6\">";
		td2.innerHTML = "<input type=\"text\" id=\"course"+numRows+"\" size=\"40\">";
		td3.innerHTML = "$<input type=\"text\" id=\"fee"+numRows+"\" size=\"4\">";

		if(numRows < (maxRows - 1)) {
			td4.innerHTML = "<a href=\"javascript:addRow();\">add another row</a>";
		} else {
			td4.innerHTML = "&nbsp;";
		}

		row.appendChild(td1);
		row.appendChild(td2);
		row.appendChild(td3);
		row.appendChild(td4);
		tbody.appendChild(row);

		//delete the add another row cell
		rightmostCol = tbody.rows[numRows].childNodes.length - 1;
		tbody.rows[numRows].deleteCell(rightmostCol);

		numRows = numRows + 1;
	}

}

function showCardDetails() {
	document.getElementById("card-details").style.display = "block";
}

function hideCardDetails() {
	document.getElementById("card-details").style.display = "none";
}

function setup() {
	document.enrolForm.paymentmethod[0].checked = false;
	document.enrolForm.paymentmethod[1].checked = false;
}