function add_entry() {
	var tr = document.createElement("tr");
	
	// ID
	var td = document.createElement("td");
	var input = document.createElement("input");
	input.name = "ID[]";
	input.className = "readonly";
	input.setAttribute("value", document.form.id.value);
	input.setAttribute("type", "text");
	input.setAttribute("size", "1");
	td.appendChild(input);
	tr.appendChild(td);
	
	// Modifikator
	var td = document.createElement("td");
	var input = document.createElement("input");
	input.name = "Modifikator[]";
	input.setAttribute("value", document.form.mod.value);
	input.setAttribute("type", "text");
	input.setAttribute("size", "1");
	td.appendChild(input);
	tr.appendChild(td);
	
	// Name
	var td = document.createElement("td");
	var input = document.createElement("input");
	input.name = "Name[]";
	input.setAttribute("value", document.form.name.value);
	input.setAttribute("type", "text");
	input.setAttribute("size", "40");
	td.appendChild(input);
	tr.appendChild(td);
	
	// URL
	var td = document.createElement("td");
	var input = document.createElement("input");
	input.name = "URL[]";
	input.setAttribute("value", document.form.url.value);
	input.setAttribute("type", "text");
	input.setAttribute("size", "40");
	td.appendChild(input);
	tr.appendChild(td);
	
	// STEUERSYMBOLE
	var td = document.createElement("td");
	td.innerHTML = '<a href="#" onclick="move_entry_up(this); return false"><img src="images/button_up.gif" width="12" height="12" alt="Eintrag nach oben verschieben"></a><a href="#" onclick="move_entry_down(this); return false"><img src="images/button_down.gif" width="12" height="12" alt="Eintrag nach unten verschieben"></a><a href="#" onclick="delete_entry(this); return false"><img src="images/button_delete.gif" width="12" height="12" alt="Eintrag löschen"></a>';
	tr.appendChild(td);
	
	document.getElementById("tbody").appendChild(tr);
}

function delete_entry(a) {
	a.setAttribute("href", "");
	a.style.cursor = "pointer";
	var obj = a.parentNode.parentNode.getElementsByTagName("input");
	
	for (var i = 0; i < obj.length; i++) {
		if (i != 0) obj[i].setAttribute("value", "del");
	}
}

function move_entry_up(a) {
	a.setAttribute("href", "");
	a.style.cursor = "pointer";
	var obj = a.parentNode.parentNode;
	var rows = document.getElementById("tbody").getElementsByTagName("tr");
	
	for (var i = 0; i < rows.length; i++) {
		if (rows[i] == obj) break;
	}
	
	if (i > 0) document.getElementById("tbody").insertBefore(obj, rows[i-1]);
}

function move_entry_down(a) {
	a.setAttribute("href", "");
	a.style.cursor = "pointer";
	var obj = a.parentNode.parentNode;
	var rows = document.getElementById("tbody").getElementsByTagName("tr");
	
	for (var i = 0; i < rows.length; i++) {
		if (rows[i] == obj) break;
	}
	
	if (i < (rows.length - 2)) {
		document.getElementById("tbody").removeChild(obj);
		document.getElementById("tbody").insertBefore(obj, rows[i+1]);
	} else {
		document.getElementById("tbody").removeChild(obj);
		document.getElementById("tbody").appendChild(obj);
	}
}
