// JavaScript Document
function addRowToTable()
{
  var tbl = document.getElementById('tblSample');
  var lastRow = tbl.rows.length;
  var iteration =  document.getElementById('nrq').value;
  document.getElementById('nrq').value = parseInt(iteration) + 1;
  //title 
  var row = tbl.insertRow(lastRow);  
  var cellLeft = row.insertCell(0);
  cellLeft.setAttribute('align', 'left');
  cellLeft.setAttribute('height', '20');
  var textNode = document.createTextNode("Qualification "+iteration);
  cellLeft.appendChild(textNode);
  
  //Sport
  var row = tbl.insertRow(lastRow + 1);
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode("Sport: " );
  cellLeft.appendChild(textNode);
  var cellRightSel = row.insertCell(1);
  cellRightSel.setAttribute('align', 'left');
  var sel = document.createElement('select');
  sel.setAttribute('name', 'sport_' + iteration);
	sel.options[0] = new Option('Select...', 'none');
	sel.options[1] = new Option('American Football', 'American Football');
	sel.options[2] = new Option('Angling', 'Angling');
	sel.options[3] = new Option('Archery', 'Archery');
	sel.options[4] = new Option('Athletics', 'Athletics');
	sel.options[5] = new Option('Badminton', 'Badminton');
	sel.options[6] = new Option('Ballooning', 'Ballooning');
	sel.options[7] = new Option('Basketball', 'Basketball');
	sel.options[8] = new Option('Bowl', 'Bowl');
	sel.options[9] = new Option('Canoeing', 'Canoeing');
	sel.options[10] = new Option('Caving and Potholing', 'Caving and Potholing');
	sel.options[11] = new Option('Climbing', 'Climbing');
	sel.options[12] = new Option('Cricket', 'Cricket');
	sel.options[13] = new Option('Crossbow Archery', 'Crossbow Archery');
	sel.options[14] = new Option('Cycling', 'Cycling');
	sel.options[15] = new Option('Cyclo-Cross', 'Cyclo-Cross');
	sel.options[16] = new Option('Disability Sport', 'Disability Sport');
	sel.options[17] = new Option('Fencing', 'Fencing');
	sel.options[18] = new Option('Football', 'Football');
	sel.options[19] = new Option('Gaelic Games', 'Gaelic Games');
	sel.options[20] = new Option('Golf', 'Golf');
	sel.options[21] = new Option('Gymnastics', 'Gymnastics');
	sel.options[22] = new Option('Health and Fitness', 'Health and Fitness');
	sel.options[23] = new Option('Hockey', 'Hockey');
	sel.options[24] = new Option('Ice Skating', 'Ice Skating');
	sel.options[25] = new Option('Judo', 'Judo');
	sel.options[26] = new Option('Kabaddi', 'Kabaddi');
	sel.options[27] = new Option('Lacrosse', 'Lacrosse');
	sel.options[28] = new Option('Lifesaving - Swimming', 'Lifesaving - Swimming');
	sel.options[29] = new Option('Martial Arts', 'Martial Arts');
	sel.options[30] = new Option('Motor Cycling', 'Motor Cycling');
	sel.options[31] = new Option('Movement and Dance', 'Movement and Dance');
	sel.options[32] = new Option('Netball', 'Netball');
	sel.options[33] = new Option('Orienteering', 'Orienteering');
	sel.options[34] = new Option('Rowing', 'Rowing');
	sel.options[35] = new Option('Rugby Union', 'Rugby Union');
	sel.options[36] = new Option('Sailing and Sailboarding', 'Sailing and Sailboarding');
	sel.options[37] = new Option('School Sport', 'School Sport');
	sel.options[38] = new Option('Scuba Diving', 'Scuba Diving');
	sel.options[39] = new Option('Shooting (Target)', 'Shooting (Target)');
	sel.options[40] = new Option('Squash', 'Squash');
	sel.options[41] = new Option('Sub-Aqua Diving', 'Sub-Aqua Diving');
	sel.options[42] = new Option('Swimming', 'Swimming');
	sel.options[43] = new Option('Table Tennis', 'Table Tennis');
	sel.options[44] = new Option('Tennis', 'Tennis');
	sel.options[45] = new Option('Trampolining', 'Trampolining');
	sel.options[46] = new Option('Triathlon', 'Triathlon');
	sel.options[47] = new Option('Ultimate Frisbee', 'Ultimate Frisbee');
	sel.options[48] = new Option('Volleyball', 'Volleyball');
	sel.options[49] = new Option('Weightlifting', 'Weightlifting');
	sel.options[50] = new Option('Windsurfing', 'Windsurfing');
	sel.options[51] = new Option('Wrestling', 'Wrestling');
	sel.options[52] = new Option('Yoga', 'Yoga');
  cellRightSel.appendChild(sel);
  
  //Qualification
  var row = tbl.insertRow(lastRow + 2);  
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode("Your qualification level: ");
  cellLeft.appendChild(textNode);  
  var cellRight = row.insertCell(1);
  cellRight.setAttribute('align', 'left');
  var el = document.createElement('input');
  el.setAttribute('type', 'text');
  el.setAttribute('class', 'textBOX');
  el.setAttribute('name', 'qlevel_' + iteration);
  cellRight.appendChild(el);
  
  var row = tbl.insertRow(lastRow + 3);
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode("Qualification achieved date: ");
  cellLeft.appendChild(textNode);
  var cellRightSel = row.insertCell(1);
  cellRightSel.setAttribute('align', 'left');
  var sel_month = document.createElement('select');
  sel_month.setAttribute('name', 'qmonth_' + iteration);
	sel_month.options[0] = new Option('Month', 'none');
	sel_month.options[1] = new Option('January', 'January');
	sel_month.options[2] = new Option('February', 'February');
	sel_month.options[3] = new Option('March', 'March');
	sel_month.options[4] = new Option('April', 'April');
	sel_month.options[5] = new Option('May', 'May');
	sel_month.options[6] = new Option('June', 'June');
	sel_month.options[7] = new Option('July', 'July');
	sel_month.options[8] = new Option('August', 'August');
	sel_month.options[9] = new Option('September', 'September');
	sel_month.options[10] = new Option('October', 'October');
	sel_month.options[11] = new Option('November', 'November');
	sel_month.options[12] = new Option('December', 'December');
  cellRightSel.appendChild(sel_month);
  
  var sel_day = document.createElement('select');
  sel_day.setAttribute('name', 'qday_' + iteration);
	sel_day.options[0] = new Option('Day', 'none');
	sel_day.options[1] = new Option('1', '1');
	sel_day.options[2] = new Option('2', '2');
	sel_day.options[3] = new Option('3', '3');
	sel_day.options[4] = new Option('4', '4');
	sel_day.options[5] = new Option('5', '5');
	sel_day.options[6] = new Option('6', '6');
	sel_day.options[7] = new Option('7', '7');
	sel_day.options[8] = new Option('8', '8');
	sel_day.options[9] = new Option('9', '9');
	sel_day.options[10] = new Option('10', '10');
	sel_day.options[11] = new Option('11', '11');
	sel_day.options[12] = new Option('12', '12');
	sel_day.options[13] = new Option('13', '13');
	sel_day.options[14] = new Option('14', '14');
	sel_day.options[15] = new Option('15', '15');
	sel_day.options[16] = new Option('16', '16');
	sel_day.options[17] = new Option('17', '17');
	sel_day.options[18] = new Option('18', '18');
	sel_day.options[19] = new Option('19', '19');
	sel_day.options[20] = new Option('20', '20');
	sel_day.options[21] = new Option('21', '21');
	sel_day.options[22] = new Option('22', '22');
	sel_day.options[23] = new Option('23', '23');
	sel_day.options[24] = new Option('24', '24');
	sel_day.options[25] = new Option('25', '25');
	sel_day.options[26] = new Option('26', '26');
	sel_day.options[27] = new Option('27', '27');
	sel_day.options[28] = new Option('28', '28');
	sel_day.options[29] = new Option('29', '29');
	sel_day.options[30] = new Option('30', '30');
	sel_day.options[31] = new Option('31', '31');
  cellRightSel.appendChild(sel_day);
  var ach_year = document.createElement('input');
  ach_year.setAttribute('type', 'text');
  ach_year.setAttribute('width', '100');
  ach_year.setAttribute('name', 'qyear_' + iteration);
  cellRightSel.appendChild(ach_year);


  var row = tbl.insertRow(lastRow + 4);
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode("Qualification expiry date: ");
  cellLeft.appendChild(textNode);
  var cellRightSel = row.insertCell(1);
  cellRightSel.setAttribute('align', 'left');
  var sel_month = document.createElement('select');
  sel_month.setAttribute('name', 'amonth_' + iteration);
	sel_month.options[0] = new Option('Month', 'none');
	sel_month.options[1] = new Option('January', 'January');
	sel_month.options[2] = new Option('February', 'February');
	sel_month.options[3] = new Option('March', 'March');
	sel_month.options[4] = new Option('April', 'April');
	sel_month.options[5] = new Option('May', 'May');
	sel_month.options[6] = new Option('June', 'June');
	sel_month.options[7] = new Option('July', 'July');
	sel_month.options[8] = new Option('August', 'August');
	sel_month.options[9] = new Option('September', 'September');
	sel_month.options[10] = new Option('October', 'October');
	sel_month.options[11] = new Option('November', 'November');
	sel_month.options[12] = new Option('December', 'December');
  cellRightSel.appendChild(sel_month);
  
  var sel_day = document.createElement('select');
  sel_day.setAttribute('name', 'aday_' + iteration);
	sel_day.options[0] = new Option('Day', 'none');
	sel_day.options[1] = new Option('1', '1');
	sel_day.options[2] = new Option('2', '2');
	sel_day.options[3] = new Option('3', '3');
	sel_day.options[4] = new Option('4', '4');
	sel_day.options[5] = new Option('5', '5');
	sel_day.options[6] = new Option('6', '6');
	sel_day.options[7] = new Option('7', '7');
	sel_day.options[8] = new Option('8', '8');
	sel_day.options[9] = new Option('9', '9');
	sel_day.options[10] = new Option('10', '10');
	sel_day.options[11] = new Option('11', '11');
	sel_day.options[12] = new Option('12', '12');
	sel_day.options[13] = new Option('13', '13');
	sel_day.options[14] = new Option('14', '14');
	sel_day.options[15] = new Option('15', '15');
	sel_day.options[16] = new Option('16', '16');
	sel_day.options[17] = new Option('17', '17');
	sel_day.options[18] = new Option('18', '18');
	sel_day.options[19] = new Option('19', '19');
	sel_day.options[20] = new Option('20', '20');
	sel_day.options[21] = new Option('21', '21');
	sel_day.options[22] = new Option('22', '22');
	sel_day.options[23] = new Option('23', '23');
	sel_day.options[24] = new Option('24', '24');
	sel_day.options[25] = new Option('25', '25');
	sel_day.options[26] = new Option('26', '26');
	sel_day.options[27] = new Option('27', '27');
	sel_day.options[28] = new Option('28', '28');
	sel_day.options[29] = new Option('29', '29');
	sel_day.options[30] = new Option('30', '30');
	sel_day.options[31] = new Option('31', '31');
  cellRightSel.appendChild(sel_day);
  var ach_year = document.createElement('input');
  ach_year.setAttribute('type', 'text');
  ach_year.setAttribute('width', '100');
  ach_year.setAttribute('name', 'ayear_' + iteration);
  cellRightSel.appendChild(ach_year);
}
