function doThisOnLoad() {
     tboxArray = new Array();  // <------------------------------- this needs to be here so it's established (once) when the page loads
     // now we have to add the first row to the array (the one that already exists when the page loads)
	 //alert(document.purchasereq.Quantity_1);
    //addToArray(document.purchasereq.Quantity_1, document.purchasereq.ItemNo_1, document.purchasereq.Description_1, document.purchasereq.Price_1);
}


function doThisAfterLoad(tempEmployee_NameHold,tempEmployee_YearsHold) {
	// alert(tempEmployee_NameHold + " - " + tempEmployee_YearsHold);
    // tboxArray = new Array(); 
    //   for(i=1;i<=NoOfItems;i++) {
	//   	tempQtyHold =  document.purchasereq.Quantity_ + i;
	//   	tempItmHold = "document.purchasereq.ItemNo_" + i;
	//   	tempDesHold = "document.purchasereq.Description_" + i;
	//   	tempPriHold = "document.purchasereq.Price_" + i;    
      	addToArray(tempEmployee_NameHold, tempEmployee_YearsHold);
	//   	addToArray(document.purchasereq.Quantity_1, document.purchasereq.ItemNo_1, document.purchasereq.Description_1, document.purchasereq.Price_1);
	//   	//addToArray(document.purchasereq.Quantity_+i, tempItmHold, tempDesHold, tempPriHold);
    // }
}

function addToArray(Emp_NameField, Emp_YearsField) {
	 // alert(IngField);
     tmpObject = new Object();
     tmpObject.Employee_NameField = Emp_NameField;
	 tmpObject.Employee_YearsField = Emp_YearsField;
     tboxArray[tboxArray.length] = tmpObject;
	 // alert(tboxArray.length);
}

// Include the function to add a row
function addCode()
{
     var tbody = document.getElementById('PlayersData').getElementsByTagName("TBODY")[0];
     var row = document.createElement("TR"); // create a new table row
     var td = new Array(3); // counting the table we made there are 4 cells per table row
     var tempSelect;
     var tempInput;
     var rownum = tbody.rows.length + 15; // not +1 because we have a header row
 	
	// Create Daily hour inputs
     td[0] = document.createElement("TD"); // create a table cell
     tempDispInput = document.createElement("INPUT"); //  create an input <----Renamed tempInput to tempQtyInput because we're going to need all three inputs at the same time
     tempDispInput.name = "DisplayNumber_" + rownum; // name the input
     tempDispInput.id = "DisplayNumber_" + rownum; // give an id to the input
	 tempDispInput.value = rownum;
	 tempDispInput.disabled = true;
     tempDispInput.size = 1; // set the size of the input
     // tempQtyInput.attachEvent(document.PurchaseReqItems.tempInput.name.focus(););
     td[0].appendChild(tempDispInput); // add the input to the table cell
	 
    // Create Daily hour inputs
     td[1] = document.createElement("TD"); // create a table cell
	 tempQtyInput = document.createElement('div')
     tempQtyInput = tempQtyInput.setAttribute('align', 'center')
     tempQtyInput = document.createElement("INPUT"); //  create an input <----Renamed tempInput to tempQtyInput because we're going to need all three inputs at the same time
     tempQtyInput.name = "Employee_Name_" + rownum; // name the input
     tempQtyInput.id = "Employee_Name_" + rownum; // give an id to the input
     tempQtyInput.size = 40; // set the size of the input
     // tempQtyInput.attachEvent(document.PurchaseReqItems.tempInput.name.focus(););
     td[1].appendChild(tempQtyInput); // add the input to the table cell
     
     td[2] = document.createElement("TD");
     tempItemInput = document.createElement("INPUT");
     tempItemInput.name = "Employee_" + rownum + "_Years";
     tempItemInput.id = "Employee_" + rownum + "_Years";
     tempItemInput.size = 14;
     td[2].appendChild(tempItemInput);

           
     addToArray(tempQtyInput, tempItemInput)   //  <-------------------- Notice we're sending the field itself, not its value or name.
               
     // Append each cell to  the row we created row
     for(i=0; i<3; i++)
          row.appendChild(td[i]);
     // Append row to table so that it appears on screen
     tbody.appendChild(row);
     // Increment the number of Code rows
     document.TeamOrderForm.NumberItems.value = parseInt(document.TeamOrderForm.NumberItems.value) + 1;
	 // Set curser in first field of the row.
	 tempQtyInput.focus();
}