<script>
	function addRowToTable()
	{
	//alert(i);
	 var tbl = document.getElementById('quote_items');
	  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);
	  // first cell
	  var cell0 = row.insertCell(0);
	  var el1 = document.createElement('input');
	  el1.type = 'checkbox';
	  el1.name = 'chk';
	  el1.id =  'chk';  
	  cell0.appendChild(el1);
	
	  // qualification cell
	  var cell1 = row.insertCell(1);
	  var el = document.createElement('select');
	  el.name = 'items' + iteration;
	  el.id = 'items' + iteration;
		alert(document.getElementById('itemName').options[0]);
	  el.options[0]=new Option("Value 2",2);
	  el.options[1]=new Option("Value 2",3);
	  el.options[2]=new Option("Value 2",4);
	  cell1.appendChild(el);
	
	  var cell2 = row.insertCell(2);
	  var el = document.createElement('input');
	  el.name = 'quantity' + iteration;
  	  el.readOnly = 'readonly';
	  el.id = 'quantity' + iteration;
	  el.size = '8';
	  cell2.appendChild(el);
	 // id
	  var cell3 = row.insertCell(3);
	  var el = document.createElement('input');
	  el.name = 'rate' + iteration;
   	  el.readOnly = 'readonly';
	  el.id = 'rate' + iteration;
	  el.size = '8';
	  cell3.appendChild(el);
	
	  var cell4 = row.insertCell(4);
	  var el = document.createElement('input');
	  el.name = 'exise_rate' + iteration;
	  el.id = 'exise_rate' + iteration;
	  el.size = '8';
	  cell4.appendChild(el);
	  
	  var cell5 = row.insertCell(4);
	  var el = document.createElement('input');
	  el.name = 'sales_tax' + iteration;
	  el.id = 'sales_tax' + iteration;
	  el.size = '8';
	  cell5.appendChild(el);
	
	  var cell6 = row.insertCell(5);
	  var el = document.createElement('input');
	  el.name = 'freight' + iteration;
	  el.id = 'freight' + iteration;
	  el.size = '8';
	  cell6.appendChild(el);
	  
	  var cell7 = row.insertCell(5);
	  var el = document.createElement('input');
	  el.name = 'remarks' + iteration;
	  el.id = 'remarks' + iteration;
	  el.size = '8';
	  cell7.appendChild(el);
	   
	}



	function removeRowFromTable()
	{

		var tbl = document.getElementById('ans_options');
		var lastRow = tbl.rows.length;
		if(lastRow==2)
		{
			tbl.rows[1].style.display="none";
			document.getElementById("action1").value = 'Delete';
		}
		else
		{
		  var howmany = document.f1.chk.length;
		  for( var count = 0; count < howmany; count++)
		  {
			 if(document.f1.chk[count].checked==true)
			 {		
					tbl.rows[count+1].style.display="none";
					var act = "action"+(count+1);
					document.getElementById(act).value = 'Delete';
			}
		  }
		}		
	}

</script>