function generateRow(objTBody,objTRow,objForm,iPntQID,arrIDs, counterfld)
{		
	//Alter the TR ID and STYLE attributes to create a unique ID and change the display properties...
	objTRow.setAttribute('id',iPntQID + '_' + objTBody.rows.length);
	objTRow.removeAttribute('style');
	objTRow.setAttribute('style','DISPLAY: block');

	// update counter field
	(document.getElementById(counterfld).value)++;

//	alert(objTBody.rows.length);
//	alert(document.getElementById(counterfld).value);

	//Create our global variables...
	var objTCell = objTRow.getElementsByTagName('TD');
	var strOrgFldNme = new String();
	var strNewFldNme = new String();
	var strNewVal = new String();
		
	//Go and loop through our TD elements and get the INPUT elements...
	for (var iCell = 0; iCell<objTCell.length; iCell++)	{		
		//Go and loop through our input elements adding the ROWID to generate a unique field...
		var objFld = objTCell[iCell].childNodes;
		for (var iFld = 0; iFld<objFld.length; iFld++)	{
			switch(objTRow.childNodes[iCell].childNodes[iFld].nodeName)
			{
				case 'INPUT' :
					strOrgFldNme = objFld[iFld].getAttribute('id')
					strNewVal = eval(objFld[iFld]).value;
//					strNewFldNme = strOrgFldNme.substring(0,(strOrgFldNme.length - 3)) + new String(objTBody.rows.length - 1);
					strNewFldNme = strOrgFldNme.substring(0,(strOrgFldNme.length - 3)) + new String(document.getElementById(counterfld).value);

					objTRow.childNodes[iCell].childNodes[iFld].setAttribute('id',strNewFldNme);
					objTRow.childNodes[iCell].childNodes[iFld].setAttribute('name',strNewFldNme);
					objTRow.childNodes[iCell].childNodes[iFld].setAttribute('value',strNewVal);
					//alert(strNewFldNme + ' = ' + strNewVal);
					break;
				case 'SELECT' :
					strOrgFldNme = objFld[iFld].getAttribute('id')
//					strNewFldNme = strOrgFldNme.substring(0,(strOrgFldNme.length - 3)) + new String(objTBody.rows.length - 1);
					strNewFldNme = strOrgFldNme.substring(0,(strOrgFldNme.length - 3)) + new String(document.getElementById(counterfld).value);
					objTRow.childNodes[iCell].childNodes[iFld].setAttribute('id',strNewFldNme);
					objTRow.childNodes[iCell].childNodes[iFld].setAttribute('name',strNewFldNme);
					//alert(strNewFldNme);
					break;
				case '#text' :
					//Do Nothing
					break;
			}
		}
	}
		
	//Add our Modifed Row to the output...
	objTBody.appendChild(objTRow);
		
	//Now update our hidden fields...
	//for (var i=0; i < arrIDs.length; i++)
	//{
	//	eval('objForm._QUES_ROWS_' + arrIDs[i] + '.value = objTBody.rows.length - 1;');
	//}
	return;
}

function deleteRow(objTRow,iRowNum,arrDELs)	{
	//We don't delete the row we just hide it from the user so the auto increment still works...
	objTRow.style.display = 'none';
	//We then need to flag the row as deleted so when we submit to the server we don't add it to the DB...
	for (var i=0; i < arrDELs.length; i++)
	{
		document.getElementById('_QUES_DELETE_' + arrDELs[i] + '_' + iRowNum).value = 'Y';
	}
	return;
}