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

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

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

  // right cell
  var cellRight = row.insertCell(2);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'textfield1_'+ iteration;
  el.id = 'textfield1_'+ iteration;
  el.size = 10;

  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);

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

  // right cell
    var cellRight = row.insertCell(4);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'textfield3_'+ iteration;
  el.id = 'textfield3_'+ iteration;
  el.size = 10;

  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);

    // select cell
  var cellRightSel = row.insertCell(5);
  var sel = document.createElement('select');
  sel.name = 'textfield4_'+ iteration;
  sel.name ='textfield4_'+ iteration;
  sel.options[0] = new Option(HeatSelectOptionPercentc[0], '1');
  sel.options[1] = new Option(HeatSelectOptionPercentc[1], '2');
  cellRightSel.appendChild(sel);

    var cellRight = row.insertCell(6);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'textfield5_'+ iteration;
  el.id = 'textfield5_'+ iteration;
  el.size = 10;

  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);

    var cellRight = row.insertCell(7);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'textfield6_'+ iteration;
  el.id = 'textfield6_'+ iteration;
  el.size = 10;

  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);

    var cellRight = row.insertCell(8);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'textfield7_'+ iteration;
  el.id = 'textfield7_'+ iteration;
  el.size = 10;

  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);

      var cellRight = row.insertCell(9);
  var el = document.createElement('input');
  el.type = 'hidden';
  el.name = 'kt_pk_heatsteps_'+ iteration;
  el.size = 10;

  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);

      var cellRight = row.insertCell(10);
  var el = document.createElement('input');
  el.type = 'hidden';
  el.name = 'form_id_'+ iteration;
  el.size = 10;

  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);

}
function keyPressTest(e, obj)
{
  var validateChkb = document.getElementById('chkValidateOnKeyPress');
  if (validateChkb.checked) {
    var displayObj = document.getElementById('spanOutput');
    var key;
    if(window.event) {
      key = window.event.keyCode;
    }
    else if(e.which) {
      key = e.which;
    }
    var objId;
    if (obj != null) {
      objId = obj.id;
    } else {
      objId = this.id;
    }
    displayObj.innerHTML = objId + ' : ' + String.fromCharCode(key);
  }
}
function removeRowFromTable3()
{
  var tbl = document.getElementById('tblheat');
  var lastRow = tbl.rows.length;
  if (lastRow > 6) 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";
     }
   }
 }
}