/*

 * Author: Justin Harrison

 * Company: TekLinks, Inc.

 * Date: 5.18.2009

 * Credits: mredkj.com

 * 

 * 

 */

function addRowToTableTube()

{	

  var tbl = document.getElementById('tblTube');

  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);

  

  // Part Number cell

  var cellPartNo = row.insertCell(0);
  cellPartNo.setAttribute("align","center");

  var inputPartNo = document.createElement("input");
  inputPartNo.setAttribute("type", "text");
  inputPartNo.setAttribute("name", "tubePartNo"+iteration);
  inputPartNo.setAttribute("size","12");
  cellPartNo.appendChild(inputPartNo);

  // Shape cell

  var cellShape = row.insertCell(1);
  cellShape.setAttribute("align","center");

  var inputShape = document.createElement("input");
  inputShape.setAttribute("type", "text");
  inputShape.setAttribute("name", "tubeShape"+iteration);
  inputShape.setAttribute("size","10");
  cellShape.appendChild(inputShape);

  //Dimension 1 cell

  var cellDim1 = row.insertCell(2);
  cellDim1.setAttribute("align","center");

  var inputDim1 = document.createElement("input");
  inputDim1.setAttribute("type", "text");
  inputDim1.setAttribute("name", "tubeDimOne"+iteration);
  inputDim1.setAttribute("size","8");
  cellDim1.appendChild(inputDim1);

  //Dimension 2 cell

  var cellDim2 = row.insertCell(3);
  cellDim2.setAttribute("align","center");

  var inputDim2 = document.createElement("input");
  inputDim2.setAttribute("type", "text");
  inputDim2.setAttribute("name", "tubeDimTwo"+iteration);
  inputDim2.setAttribute("size","8");
  cellDim2.appendChild(inputDim2);

  //Nominal Wall cell

  var cellNomWall = row.insertCell(4);
  cellNomWall.setAttribute("align","center");

  var inputNomWall = document.createElement("input");
  inputNomWall.setAttribute("type", "text");
  inputNomWall.setAttribute("name", "tubeNomWall"+iteration);
  inputNomWall.setAttribute("size","10");
  cellNomWall.appendChild(inputNomWall);

  //Material cell

  var cellMat = row.insertCell(5);
  cellNomWall.setAttribute("align","center");

  var inputMat = document.createElement("input");
  inputMat.setAttribute("type", "text");
  inputMat.setAttribute("name", "tubeMat"+iteration);
  inputMat.setAttribute("size","10");
  cellMat.appendChild(inputMat);  

  //Standards or Specs cell

  var cellStand = row.insertCell(6);
  cellStand.setAttribute("align","center");

  var inputStand = document.createElement("input");
  inputStand.setAttribute("type", "text");
  inputStand.setAttribute("name", "tubeStand"+iteration);
  inputStand.setAttribute("size","10");
  cellStand.appendChild(inputStand);  

  //Length cell

  var cellLength = row.insertCell(7);
  cellLength.setAttribute("align","center");

  var inputLength = document.createElement("input");
  inputLength.setAttribute("type", "text");
  inputLength.setAttribute("name", "tubeLength"+iteration);
  inputLength.setAttribute("size","8");
  cellLength.appendChild(inputLength);  

  //Length Tolerance cell

  var cellLengthT = row.insertCell(8);
  cellLengthT.setAttribute("align","center");

  var inputLengthT = document.createElement("input");
  inputLengthT.setAttribute("type", "text");
  inputLengthT.setAttribute("name", "tubeLengthT"+iteration);
  inputLengthT.setAttribute("size","8");
  cellLengthT.appendChild(inputLengthT);  

  //Standard Release cell

  var cellStandR = row.insertCell(9);
  cellStandR.setAttribute("align","center");

  var inputStandR = document.createElement("input");
  inputStandR.setAttribute("type", "text");
  inputStandR.setAttribute("name", "tubeStandR"+iteration);
  inputStandR.setAttribute("size","10");
  cellStandR.appendChild(inputStandR);  

  //Special Considerations cell
  
  var lastRow2 = tbl.rows.length;	

  var row2 = tbl.insertRow(lastRow2);

  var cellSpecCon = row2.insertCell(0);
  cellSpecCon.setAttribute("align","center");

  var inputSpecCon = document.createTextNode("Special Considerations:");
  cellSpecCon.appendChild(inputSpecCon); 
  
  var cellSpecCon = row2.insertCell(1);
  cellSpecCon.setAttribute("align","left");
  cellSpecCon.colSpan = 9;

  var inputSpecCon = document.createElement("input");
  inputSpecCon.setAttribute("type", "text");
  inputSpecCon.setAttribute("name", "tubeSpecCon"+iteration);
  inputSpecCon.setAttribute("size","100");
  cellSpecCon.appendChild(inputSpecCon); 
  
  inputPartNo.focus();

}

function addRowToTableFabWeld()

{	

	

  var tbl = document.getElementById('tblFabWeld');

  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);

  

  // Part Number cell

  var cellPartNo = row.insertCell(0);
  cellPartNo.setAttribute("align","center");

  var inputPartNoFab = document.createElement("input");
  inputPartNoFab.setAttribute("type", "text");
  inputPartNoFab.setAttribute("name", "fabPartNo"+iteration);
  cellPartNo.appendChild(inputPartNoFab);


  // Description cell

  var cellDesc = row.insertCell(1);
  cellDesc.setAttribute("align","center");
  
  var inputDescFab = document.createElement("input");
  inputDescFab.setAttribute("type", "text");
  inputDescFab.setAttribute("name", "fabDesc"+iteration);
  cellDesc.appendChild(inputDescFab);

  //Finish cell

  var cellFinish = row.insertCell(2);
  cellFinish.setAttribute("align","center");
  
  var inputFinishFab = document.createElement("input");
  inputFinishFab.setAttribute("type", "text");
  inputFinishFab.setAttribute("name", "fabFinish"+iteration);
  cellFinish.appendChild(inputFinishFab);

  //Standard Release cell

  var cellStandRel = row.insertCell(3);
  cellStandRel.setAttribute("align","center");

  var inputStandRelFab = document.createElement("input");
  inputStandRelFab.setAttribute("type", "text");
  inputStandRelFab.setAttribute("name", "fabStandRel"+iteration);
  cellStandRel.appendChild(inputStandRelFab);

  //Special Considerations cell
  
  var lastRow2 = tbl.rows.length;	

  var row2 = tbl.insertRow(lastRow2);

  var cellSpecCon = row2.insertCell(0);
  cellSpecCon.setAttribute("align","center");

  var inputSpecCon = document.createTextNode("Special Considerations:");
  cellSpecCon.appendChild(inputSpecCon); 
  
  var cellSpecCon = row2.insertCell(1);
  cellSpecCon.setAttribute("align","left");
  cellSpecCon.colSpan = 3;

  var inputSpecCon = document.createElement("input");
  inputSpecCon.setAttribute("type", "text");
  inputSpecCon.setAttribute("name", "fabSpecCon"+iteration);
  inputSpecCon.setAttribute("size","100");
  cellSpecCon.appendChild(inputSpecCon); 
  
  inputPartNoFab.focus();

}

function addRowToTableReusable()

{	

	

  var tbl = document.getElementById('tblReusable');

  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);

  

  // Part Number cell

  var cellPartNo = row.insertCell(0);
  cellPartNo.setAttribute("align","center");

  var inputPartNoRe = document.createElement("input");
  inputPartNoRe.setAttribute("type", "text");
  inputPartNoRe.setAttribute("name", "rePartNo"+iteration);
  cellPartNo.appendChild(inputPartNoRe);

  // Description cell

  var cellDesc = row.insertCell(1);
  cellDesc.setAttribute("align","center");
  
  var inputDescRe = document.createElement("input");
  inputDescRe.setAttribute("type", "text");
  inputDescRe.setAttribute("name", "reDesc"+iteration);
  cellDesc.appendChild(inputDescRe);

  //Finish cell

  var cellFinish = row.insertCell(2);
  cellFinish.setAttribute("align","center");

  var inputFinishRe = document.createElement("input");
  inputFinishRe.setAttribute("type", "text");
  inputFinishRe.setAttribute("name", "reFinish"+iteration);
  cellFinish.appendChild(inputFinishRe);

  //Standard Release cell

  var cellStandRel = row.insertCell(3);
  cellStandRel.setAttribute("align","center");
  
  var inputStandRelRe = document.createElement("input");
  inputStandRelRe.setAttribute("type", "text");
  inputStandRelRe.setAttribute("name", "reStandRel"+iteration);
  cellStandRel.appendChild(inputStandRelRe);
  
  //Special Considerations cell
  
  var lastRow2 = tbl.rows.length;	

  var row2 = tbl.insertRow(lastRow2);

  var cellSpecCon = row2.insertCell(0);
  cellSpecCon.setAttribute("align","center");

  var inputSpecCon = document.createTextNode("Special Considerations:");
  cellSpecCon.appendChild(inputSpecCon); 
  
  var cellSpecCon = row2.insertCell(1);
  cellSpecCon.setAttribute("align","left");
  cellSpecCon.colSpan = 3;

  var inputSpecCon = document.createElement("input");
  inputSpecCon.setAttribute("type", "text");
  inputSpecCon.setAttribute("name", "reSpecCon"+iteration);
  inputSpecCon.setAttribute("size","100");
  cellSpecCon.appendChild(inputSpecCon); 

  inputPartNoRe.focus();

}

