// JavaScript Document
function addImg(tblId, count){
	var tblBody = document.getElementById(tblId).tBodies[0];
	var newRow = tblBody.insertRow(count);

	//New input
	var newCell = newRow.insertCell(0);
	var newInput = document.createElement('input');
	newInput.type = 'file';
	newInput.name = 'images[]';
	newInput.className = '';
	newCell.appendChild(newInput);

	//New input
/*	var newCell = newRow.insertCell(1);
	var newInput = document.createElement('input');
	newInput.type = 'text';
	newInput.name = 'notes[]';
	newInput.className = 'notes';
	newCell.appendChild(newInput);
*/	
	var newCell = newRow.insertCell(1);
	var newInput = document.createElement('textarea');
	//newInput.type = 'text';
	newInput.name = 'notes[]';
	newInput.className = 'notes';
	newCell.appendChild(newInput);
	
	// Change link
	document.getElementById('addUpload').innerHTML = "<input type=\"button\" name=\"addRow\" value=\"New Image\" onClick=\"addImg('upload_tbl', "+(count+1)+")\" />";
}

function addPdf(tblId, count){
	var tblBody = document.getElementById(tblId).tBodies[0];
	var newRow = tblBody.insertRow(count);

	//New input
	var newCell = newRow.insertCell(0);
	var newInput = document.createElement('input');
	newInput.type = 'file';
	newInput.name = 'pdfs[]';
	newInput.className = '';
	newCell.appendChild(newInput);
	
	// Change link
	document.getElementById('addUpload').innerHTML = "<input type=\"button\" name=\"addRow\" value=\"New Image\" onClick=\"addImg('upload_tbl', "+(count+1)+")\" />";
}

function addQuestion(tblId, count){
	var tblBody = document.getElementById(tblId).tBodies[0];
	var newRow = tblBody.insertRow(count);

	//New input
	var newCell = newRow.insertCell(0);
	var newInput = document.createElement('input');
	newInput.type = 'text';
	newInput.name = 'form_new[]';
	newInput.className = '';
	newCell.appendChild(newInput);
	
	// Change link
	document.getElementById('questionLink').innerHTML = "<input type=\"button\" name=\"addRow\" value=\"New Question\" onClick=\"addQuestion('form_tbl', "+(count+1)+")\" />";
}