function genericHandlerWorkPatTable(THnd) {
	
	this.gTblHnd = THnd;
	
	_initialize = function() {
	
		console.log("@@@ genericHandlerWorkPatTable:: init called");
	};
	
	this.doOnLoad = function(xxtablepara, xxtablecaption) {
		try {
			console.log("@@@ DEBUG:: genericHandlerWorkPatTable::doOnLoad called.");

			document.getElementById("xxtablepara").innerHTML = xxtablepara; //"This is the table instructions.";
			document.getElementById("xxtablecaption").innerHTML = xxtablecaption; //"This is the table caption.";
			
			this.gTblHnd.onClearRowData(); // ensure the table is clear
			
			//
			// isNewRecord is returning null for a new record and false otherwise
			// will use the false state to detemine a saved record.
			//
			if (g_form.isNewRecord()==false) {
				// if any of the four summary variables are populated
				// populate the table row with the information.
				// This will only happen following submission of the form with data.
				//console.log("@@@ DEBUG:: genericHandlerWorkPatTable:: NOT a new record");
				var wps1 = g_form.getValue("WpatSummaryRow1");
				//console.log("@@@ DEBUG:: genericHandlerWorkPatTable:: HR_WorkPatternTable_onLoad WPS1= {" + wps1 + "}");
				if(wps1!="") {
					this.gTblHnd.setRowData(1, wps1);
				}
				var wps2 = g_form.getValue("WpatSummaryRow2");
				if(wps2!="") {
					this.gTblHnd.setRowData(2, wps2);
				}
				var wps3 = g_form.getValue("WpatSummaryRow3");
				if(wps3!="") {
					this.gTblHnd.setRowData(3, wps3);
				}
				var wps4 = g_form.getValue("WpatSummaryRow4");
				if(wps4!="") {
					this.gTblHnd.setRowData(4, wps4);
				}
				console.log("@@@ DEBUG:: genericHandlerWorkPatTable:: HR_WorkPatternTable_onLoad WPS2= {" + wps2 + "}");
				console.log("@@@ DEBUG:: genericHandlerWorkPatTable:: HR_WorkPatternTable_onLoad WPS3= {" + wps3 + "}");
				console.log("@@@ DEBUG:: genericHandlerWorkPatTable:: HR_WorkPatternTable_onLoad WPS4= {" + wps4 + "}");
				
				// now the table is populated make it read-only (disabled)
				this.gTblHnd.setDisabledState(true);
			}
		} catch (err)
		{
			console.log("@@@ An error occurred in genericHandlerWorkPatTable::doOnLand, message="+err.message);
		}
		return;
	};
	
	this.doOnSubmit = function() {
		try {
			var errRep = "on the Work hours and work pattern table";
			var row;
			var error = false; // be positive.
			for(row=1; row<5; ++row)
				{
				if(this.gTblHnd.isRowValid(row)!=true)
					{
					// add to error report
					if(row==4) errRep += " and ";
						else  errRep += ", ";
						errRep += "Row "+row;
					error = true; // error found
				}
			}
			errRep += " has errors. Incorrect forms can not be submitted.\n";
			
			if(error) // found validation error(s) on the table alert the user and return false
				{
				alert(errRep);
				console.log("@@@ table reports errors.");
				return false;
			}
			else // row 1 is the only row that must have data.
				{
				// if the table is visible then it needs at least row one completed
				var tbl = g_form.getControl("TblName");
				//if (tbl.attributes.visability==)
				//	{
					// empty rows are valid so we need to check row 1 is not empty
					if(this.gTblHnd.isEmptyRow(1)==true) {
						// report row one needs completing
						alert("Row 1 on the Work hours and work pattern table, must contain a valid date, hours and work pattern, before the form can be submitted.");
						jslog("@@@ table reports errors.");
						return false;
					}
					// row one has data and it is valid
					
					//
					//console.log("@@@ TBL:row1={" + this.gTblHnd.getRowData(1) + "}");
					//console.log("@@@ TBL:row2={" + this.gTblHnd.getRowData(2) + "}");
					//console.log("@@@ TBL:row3={" + this.gTblHnd.getRowData(3) + "}");
					//console.log("@@@ TBL:row4={" + this.gTblHnd.getRowData(4) + "}");
					
					// write the packed data to the summary variables for each row that contains data.
					g_form.setValue("WpatSummaryRow1", this.gTblHnd.getRowData(1)); // required
					if (this.gTblHnd.isEmptyRow(2)!=true) g_form.setValue("WpatSummaryRow2", this.gTblHnd.getRowData(2));
						if (this.gTblHnd.isEmptyRow(3)!=true) g_form.setValue("WpatSummaryRow3", this.gTblHnd.getRowData(3));
						if (this.gTblHnd.isEmptyRow(4)!=true) g_form.setValue("WpatSummaryRow4", this.gTblHnd.getRowData(4));
						
					//console.log("@@@ WpatSummaryRow1="  + g_form.getValue("WpatSummaryRow1"));
					//console.log("@@@ WpatSummaryRow2="  + g_form.getValue("WpatSummaryRow2"));
					//console.log("@@@ WpatSummaryRow3="  + g_form.getValue("WpatSummaryRow3"));
					//console.log("@@@ WpatSummaryRow4="  + g_form.getValue("WpatSummaryRow4"));
					//} // endif isvisible
				}
				
				return true; // valid form
			} catch (err)
			{
				console.log("@@@ An error occurred in genericHandlerWorkPatTable::doOnSubmit, message="+err.message);
			}
			return;
		};
	
		this.type = 'genericHandlerWorkPatTable';
		_initialize();
	}