function AddRow(gridId, fieldNames)
{
	var table = document.getElementById(gridId);
	var row_counter = document.getElementById('row_counter_' + gridId);
	
	var lastRow = parseInt(row_counter.value)-1;
	
	//get upper row style
	
	var row = table.insertRow(table.rows.length-2);
	row.id = "row_" + lastRow;
	row.setAttribute("class", "default_grid_row");
	var i=0;
	for(i=0;i<fieldNames.length;i++)
	{
		//hiddeni ekle
		var inp = document.getElementById(fieldNames[i]);
		
		var input = document.createElement("input");
		input.setAttribute("type", "hidden");
		input.setAttribute("name", "row_" + lastRow + "_" + fieldNames[i]);
		input.setAttribute("value", inp.value);
		row.appendChild(input);
		
		//hücreyi ekle
		var cell = row.insertCell(i);
		cell.innerHTML = inp.value;
		
		inp.value = '';
	}
	
	var cell = row.insertCell(i);
	
		var input = document.createElement("input");
		input.setAttribute("type", "button");
		input.setAttribute("name", "sil_" + lastRow);
		input.setAttribute("class", "window_field");
		input.setAttribute("value","-");
		input.setAttribute("onclick","DeleteRow('" + gridId + "', '" + lastRow + "')");
		cell.appendChild(input);	
		
	row_counter.value = parseInt(row_counter.value) + 1;
}

function DeleteRow(gridId, rowNo)
{
	var table = document.getElementById(gridId);
	var rowIndex = document.getElementById('row_' + rowNo).rowIndex;
	table.deleteRow(rowIndex);
}