// Date : 23 September, 2008

function appendRowMemberAffiliation(tblStr)
{
  var tbl = document.getElementById(tblStr);
  var row = tbl.insertRow(tbl.rows.length);
  
  // Cell 1: input text [position]
  var cellInputText = row.insertCell(0);
  var el = document.createElement('textarea');
  el.setAttribute('name', 'affiliation_organization[]');
  el.setAttribute('cols', '60');
  el.setAttribute('rows', '4');
  el.style.setAttribute('overflow', 'hidden');
  el.className = 'input_dtbl_ta';
  cellInputText.appendChild(el);

  // Cell 2: input text [organization]
  var cellInputText = row.insertCell(1);
  var el = document.createElement('textarea');
  el.setAttribute('name', 'affiliation_status[]');
  el.setAttribute('cols', '50');
  el.setAttribute('rows', '4');
  el.className = 'input_dtbl_ta';
  el.style.setAttribute('overflow', 'hidden');
  cellInputText.appendChild(el);
  
  // Cell 3: input Button [delete]
  var cellInputText = row.insertCell(2);
  var el = document.createElement('input');
  el.setAttribute('type', 'button');
  el.setAttribute('name', 'delete');
  el.setAttribute('value', 'del');
  el.className = 'input_btn';
  el.onclick = function () {removeRowAffiliation(this);};
  cellInputText.appendChild(el);
  
}

// deletes the specified row from the table
function removeRowAffiliation(src)
{
	/* src refers to the input button that was clicked.	
	   to get a reference to the containing <tr> element,
	   get the parent of the parent (in this case case <tr>)
	*/			
	var oRow = src.parentElement.parentElement;		
	
	//once the row reference is obtained, delete it passing in its rowIndex			
	document.all("tblAffiliation").deleteRow(oRow.rowIndex);		
}

