
var currentRowCount = 0;
var content = new Array("","","","","","","","","","","","","","","","","","","","","");

function count_existing_inputs(){
	var i = 0;
	while(document.getElementById("js_input_"+i) != null){
		i++;
		currentRowCount = i;	
	}
	return i;
}

function insertInput(row,count){
	for(var i=count;i>=1;i--){
		var tr = document.getElementById("formtable").insertRow(row);
		var td1 = document.createElement("td");
		var td2 = document.createElement("td");
		
		td1.appendChild(document.createTextNode("Abholadresse "+i));
	
		var input = document.createElement("input");
		input.setAttribute("type","text");
		input.id = "js_input_"+(i-1);
		input.name = "js_input_"+(i-1);
		input.value = content[i-1];
		td2.appendChild(input);

		tr.appendChild(td1);
		tr.appendChild(td2);
	}

	currentRowCount = count;
	
}

function deleteRow(row){
	count_existing_inputs();
	for(var i=currentRowCount;i>=1;i--){
		content[currentRowCount-i] = document.getElementById("js_input_"+(currentRowCount-i)).value;
		document.getElementById("formtable").deleteRow(row);
	}
	
}
