var count = 1;

function set_teachers(temp) {
	count = temp;
}

function add_teacher() {
	var insert_point = document.getElementById("addteacher")
	count = count + 1;
	new_row = document.createElement("tr");
	new_row.setAttribute("id", "teacher_row_"+count);
	new_cell = document.createElement("td");
	new_label = document.createElement("label");
	new_label.setAttribute("for", "teacher_"+count);
	new_text = document.createTextNode("Teacher Attending Forum (" + count + "):");
	new_label.appendChild(new_text);
	new_cell.appendChild(new_label);
	new_row.appendChild(new_cell);
	new_cell = document.createElement("td");
	new_input = document.createElement("input");
	new_input.setAttribute("name", "teacher_"+count);
	new_input.setAttribute("id", "teacher_"+count);
	new_input.setAttribute("type", "text");
	new_input.setAttribute("size", "25");
	new_cell.appendChild(new_input);
	new_row.appendChild(new_cell);
	insert_point.parentNode.insertBefore(new_row, insert_point);
	new_row = document.createElement("tr");
	new_row.setAttribute("id", "subject_row_"+count);
	new_cell = document.createElement("td");
	new_label = document.createElement("label");
	new_label.setAttribute("for", "subject_"+count);
	new_text = document.createTextNode("Teacher\'s Primary Subject (" + count + "):");
	new_label.appendChild(new_text);
	new_cell.appendChild(new_label);
	new_row.appendChild(new_cell);
	new_cell = document.createElement("td");
	new_input = document.createElement("input");
	new_input.setAttribute("name", "subject_"+count);
	new_input.setAttribute("id", "subject_"+count);
	new_input.setAttribute("type", "text");
	new_input.setAttribute("size", "25");
	new_cell.appendChild(new_input);
	new_row.appendChild(new_cell);
	insert_point.parentNode.insertBefore(new_row, insert_point);
}

function delete_teacher() {
	if(count > 1) {
		var insert_point = document.getElementById("addteacher")
		insert_point.parentNode.removeChild(document.getElementById("teacher_row_"+count));
		insert_point.parentNode.removeChild(document.getElementById("subject_row_"+count));
		count = count - 1;
	}
}
