// Date : 23 September, 2008

function appendRowMemberCareer(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', 'career_organization[]');
  el.setAttribute('cols', '25');
  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', 'career_duration[]');
  el.setAttribute('cols', '10');
  el.setAttribute('rows', '4');
  el.className = 'input_dtbl_ta';
  el.style.setAttribute('overflow', 'hidden');
  cellInputText.appendChild(el);
  
  // Cell 3: input text [start_date]
  var cellInputText = row.insertCell(2);
  var el = document.createElement('textarea');
  el.setAttribute('name', 'career_designation[]');
  el.setAttribute('cols', '25');
  el.setAttribute('rows', '4');
  el.style.setAttribute('overflow', 'hidden');
  el.className = 'input_dtbl_ta';
  cellInputText.appendChild(el);
    
  // Cell 4: input text [end_date]
  var cellInputText = row.insertCell(3);
  var el = document.createElement('textarea');
  el.setAttribute('name', 'career_responsibility[]');
  el.setAttribute('cols', '50');
  el.setAttribute('rows', '4');
  el.style.setAttribute('overflow', 'hidden');
  el.className = 'input_dtbl_ta';
  cellInputText.appendChild(el);
  
  // Cell 5: input Button [delete]
  var cellInputText = row.insertCell(4);
  var el = document.createElement('input');
  el.setAttribute('type', 'button');
  el.setAttribute('name', 'delete');
  el.setAttribute('value', 'del');
  el.className = 'input_btn';
  el.onclick = function () {removeRowCareer(this);};
  cellInputText.appendChild(el);
  
}

// deletes the specified row from the table
function removeRowCareer(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("tblCareer").deleteRow(oRow.rowIndex);		
}

