// JavaScript Document

function addRowToTable()
{
  var tbl = document.getElementById('lng_skils');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow;
  var row = tbl.insertRow(lastRow);

  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cellLeft.appendChild(textNode);


	    // right cell
  var cellRightSel = row.insertCell(1);
  var sel = document.createElement('select');
  sel.name = 'language_usr_'+ iteration;
  sel.id = 'language_usr_' + iteration;
  sel.options[0] = new Option(Selection_Language[0] , Selection_value[0] );
  sel.options[1] = new Option(Selection_Language[1] , Selection_value[1] );
  sel.options[2] = new Option(Selection_Language[2] , Selection_value[2] );
  sel.options[3] = new Option(Selection_Language[3] , Selection_value[3] );
  sel.options[4] = new Option(Selection_Language[4] , Selection_value[4] );
  sel.options[5] = new Option(Selection_Language[5] , Selection_value[5] );
  sel.options[6] = new Option(Selection_Language[6] , Selection_value[6] );
  sel.options[7] = new Option(Selection_Language[7] , Selection_value[7] );
  sel.options[8] = new Option(Selection_Language[8] , Selection_value[8] );
  sel.options[9] = new Option(Selection_Language[9] , Selection_value[9] );
  sel.options[10] = new Option(Selection_Language[10] , Selection_value[10] );
  sel.options[11] = new Option(Selection_Language[11] , Selection_value[11] );
  sel.options[12] = new Option(Selection_Language[12] , Selection_value[12] );
  sel.options[13] = new Option(Selection_Language[13] , Selection_value[13] );
  sel.options[14] = new Option(Selection_Language[14] , Selection_value[14] );
  sel.options[15] = new Option(Selection_Language[15] , Selection_value[15] );
  sel.options[16] = new Option(Selection_Language[16] , Selection_value[16] );
  sel.options[17] = new Option(Selection_Language[17] , Selection_value[17] );
  cellRightSel.appendChild(sel);

// select cell
  var cellRightSel = row.insertCell(2);
  var sel = document.createElement('select');
  sel.name = 'language_skils_usr_'+ iteration;
  sel.id = 'language_skils_usr_' + iteration;
  sel.options[0] = new Option(skils_usr[0], '1');
  sel.options[1] = new Option(skils_usr[1], '2');
  sel.options[2] = new Option(skils_usr[2], '3');

  cellRightSel.appendChild(sel);

 // right cell
  var cellRight = row.insertCell(3);
  var el = document.createElement('input');
  el.type = 'hidden';
  el.name = 'kt_pk_language_skils_usr_' + iteration;

  cellRight.appendChild(el);

 // right cell
  var cellRight = row.insertCell(4);
  var el = document.createElement('input');
  el.type = 'hidden';
  el.name = 'userid_usr_' + iteration;
  el.id = 'userid_usr_' + iteration;

  cellRight.appendChild(el);
}
function removeRowFromTable()
{
  var tbl = document.getElementById('lng_skils');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
 // Alternating table row Colors

function alternate(id){
 if(document.getElementsByTagName){
   var table = document.getElementById(id);
   var rows = table.getElementsByTagName("tr");
   for(i = 0; i < rows.length; i++){
 //manipulate rows
     if(i % 2 == 0){
       rows[i].className = "even";
     }else{
       rows[i].className = "odd";
     }
   }
 }
}

