function addRowToTable()
{
  var tbl = document.getElementById('tbl_form1');
  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);
  
  // 1st col
  var cell_col1 = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cell_col1.appendChild(textNode);
  
  // 2nd Col
  var cell_col2 = row.insertCell(1);
  cell_col2.align ="center";
  
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'txt_col2' + iteration;
  el.id = 'txt_col2' + iteration;
  el.size = 30;
  cell_col2.appendChild(el);
  
  
  // 3rd Col
  var cell_col3 = row.insertCell(2);
  cell_col3.align ="center";
  
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'txt_col3' + iteration;
  el.id = 'txt_col3' + iteration;
  el.size = 82;
  cell_col3.appendChild(el);
  
  
  

  
  }


function validateRow(frm)
{
  var chkb = document.getElementById('chkValidate');
  if (chkb.checked) {
    var tbl = document.getElementById('tblSample');
    var lastRow = tbl.rows.length - 1;
    var i;
    for (i=1; i<=lastRow; i++) {
      var aRow = document.getElementById('txtRow' + i);
      if (aRow.value.length <= 0) {
        alert('Row ' + i + ' is empty');
        return;
      }
    }
  }
  openInNewWindow(frm);
}



