// GraybarProductPage.js

// requires GraybarCommon.js

//var UNABLE_TO_VALIDATE_FORM_VALUE = -1;

function productpage_isValidPage(aProductPageTableMgr) {
//	invalidCellsArray = new Array();
	if (empty(aProductPageTableMgr)) {
		alert("error, unable to validate form data.");
	/*	invalidCellsArray.push(UNABLE_TO_VALIDATE_FORM_VALUE);
		return invalidCellsArray;*/
		
		return false;
	}
		
	formVals = aProductPageTableMgr.getAllFormData();
	if (notDefined(formVals)) {
		alert("error, unable to validate form data");
/*		invalidCellsArray.push(UNABLE_TO_VALIDATE_FORM_VALUE);
		return invalidCellsArray;	*/
		
		return false;	
	}
	
	catEntryIds = formVals["catEntryId"];
	qtys = formVals["quantity"];        
	qtyMultiples = formVals["qtyMultiple"];        
//	compareIds = formVals["compareId"];	

//  catEntryIds = aProductPageTableMgr.getFormDataFor("catEntryId");
//	qtys = aProductPageTableMgr.getFormDataFor("quantity");        
//  compareIds = aProductPageTableMgr.getFormDataFor("compareId");	
    
	var errorMsgsArray = validateFormData(catEntryIds, qtys, qtyMultiples);
	productpage_updateErrorCells(aProductPageTableMgr, errorMsgsArray)

	var numCellsWithErrors = errorMsgsArray[0];
    if (numCellsWithErrors > 0)  {
    	return false;
    }    
    
	return true;
}

function productpage_updateErrorCells(aProductPageTableMgr, anErrorMsgsArray) {
	if (notEmpty(aProductPageTableMgr) && notEmpty(anErrorMsgsArray)) {
		aProductPageTableMgr.updateErrorCells(anErrorMsgsArray);
	}
}

function productpage_compareItems(aProductPageTableMgr, resultSetIndex, compareCgiParam) {
	if (empty(aProductPageTableMgr)) return false;

	var isValidPage = productpage_isValidPage(aProductPageTableMgr);

	var compareValues = productpage_getValuesToCompare(aProductPageTableMgr);
	var isValidComparison = isValidCompareValues(compareValues);
 
 	// NOTE: the 2 validations are done before the if statement so that they BOTH execute;
 	// if they were only 
	if (isValidPage && isValidComparison) {
		return onCompareBtnClick(
   			wcds, 
			compareValues,
			resultSetIndex,
			compareCgiParam
		);
	}
	return false;
}

function productpage_checkPA(aForm, aProductPageTableMgr) {
    var doCheckPA = false;
    if (!busy){
        busy = true;

		try {
			if (productpage_isValidPage(aProductPageTableMgr)) {      
		        catEntryIds = aProductPageTableMgr.getDataFor("catEntryId");
		        qtys = aProductPageTableMgr.getDataFor("quantity");
				//checkedBoxes = aProductPageTableMgr.getDataFor("compareId");					
						   	
	    	   	if (isPreparedForPA(aForm, catEntryIds, qtys) && validateShipping(document.PnASnippetForm)) {
		    	   	wcds.saveQueryState(0);		    	   	
		    	   	appendHiddenField('renderingForm', 'pageType', 'ProductPage');	    	   			    	   	
		    	   	submitCheckPandA();
		    	}
    	   	}
    	   	
		} catch (e) {
			doCheckPA = false;
		}

		// in case checkPA fails, unlock the page so another action is possible
		busy = false;
		return doCheckPA;
	}
}

function productpage_updateShipToWillCall(aForm, aProductPageTableMgr) {
    var updateShipToWillCall = false;
    if (!busy){
        busy = true;

		try {
			if (productpage_isValidPage(aProductPageTableMgr)) {      
		        catEntryIds = aProductPageTableMgr.getDataFor("catEntryId");               
		        qtys = aProductPageTableMgr.getDataFor("quantity");   
						   	
	    	   	if (isPreparedForUpdate(aForm, catEntryIds, qtys) && validateShipping(document.PnASnippetForm)) {
		    	   	wcds.saveQueryState(0);		    	   	
		    	   	appendHiddenField('renderingForm', 'pageType', 'ProductPage');	    	   			    	   	
		    	   	submitCheckPandA();
		    	}
    	   	}
    	   	
		} catch (e) {
			updateShipToWillCall = false;
		}

		// in case update fails, unlock the page so another action is possible
		busy = false;
		return updateShipToWillCall;
	}
}

function productpage_add2favs(/*favsURL, */favFormObject, aProductPageTableMgr/*, isNewFavsList*/) { 
    if (!busy){
        busy = true;

		try {
		
			if (!productpage_isValidPage(aProductPageTableMgr)) {
				busy = false;
				return false;
			}        

	        catEntryIds = aProductPageTableMgr.getDataFor("catEntryId");               
	        qtys = aProductPageTableMgr.getDataFor("quantity");
			checkedBoxes = aProductPageTableMgr.getDataFor("compareId");
	   
			catEntryIdsToAdd = new Array();
			qtysToAdd = new Array();
			copyIndex = 0;

			for (i = 0; i < catEntryIds.length; i++) {
				//		if (qtys[i] > 0) {
				if (isValidComparisonValue(checkedBoxes[i])) {
					catEntryIdsToAdd[copyIndex] = catEntryIds[i];
					qtysToAdd[copyIndex] = qtys[i];
					++copyIndex;
				}
			}

    	   	// add2favs(favsURL, catEntryIdsToAdd/*, qtysToAdd*/, isNewFavsList);
			addToFavoritesList(favFormObject, catEntryIdsToAdd, qtysToAdd);
		} catch (e) {
			// for now, do nothing except unlock UI and return false as below
		}

		// in case add2favs fails, unlock the page so another action is possible
		busy = false;
		return false;
	}
}

function productpage_add2rfq(rfqFormObject, aProductPageTableMgr) { 
    if (!busy){
        busy = true;

		try {
		
			if (!productpage_isValidPage(aProductPageTableMgr)) {
				busy = false;
				return false;
			}        

	        catEntryIds = aProductPageTableMgr.getDataFor("catEntryId");               
	        qtys = aProductPageTableMgr.getDataFor("quantity");             
			checkedBoxes = aProductPageTableMgr.getDataFor("compareId");
	   
			catEntryIdsToAdd = new Array();
			qtysToAdd = new Array();
			copyIndex = 0;

			for (i = 0; i < catEntryIds.length; i++) {
				//		if (qtys[i] > 0) {
				if (isValidComparisonValue(checkedBoxes[i])) {
					catEntryIdsToAdd[copyIndex] = catEntryIds[i];
					qtysToAdd[copyIndex] = qtys[i];
					++copyIndex;
				}
			}

			addToRFQList(rfqFormObject, catEntryIdsToAdd, qtysToAdd);
		} catch (e) {
			// for now, do nothing except unlock UI and return false as below
		}

		// in case add2rfq fails, unlock the page so another action is possible
		busy = false;
		return false;
	}
}

function productpage_add2cart(orderForm, aProductPageTableMgr) { 
    if (!busy){
        busy = true;

		try {
			if (!productpage_isValidPage(aProductPageTableMgr)) {
        		busy = false;
	        	return;
    	    }
        
	        catEntryIds = aProductPageTableMgr.getDataFor("catEntryId");               
    	    qtys = aProductPageTableMgr.getDataFor("quantity");
	   
			catEntryIdsToAdd = new Array();
			qtysToAdd = new Array();
			copyIndex = 0;

			for (i = 0; i < catEntryIds.length; i++) {
				if (qtys[i] > 0) {
					catEntryIdsToAdd[copyIndex] = catEntryIds[i];
					qtysToAdd[copyIndex] = qtys[i];
					++copyIndex;
				}
			}

			if (!add2cart(orderForm, catEntryIdsToAdd, qtysToAdd)){
				busy=false;
			}
			else{
				showClock();
			}
		} catch (e) {
			// for now, do nothing except unlock UI and return false as below
		}

		// in case add2cart fails, unlock the page so another action is possible       	
       	//busy = false;
	}
}

	function productpage_getValuesToCompare(aProductPageTableMgr) {

		validCompareIds = new Array();

		if (empty(aProductPageTableMgr)) {
			alert("error, unable to get items to compare");
			return validCompareIds;
		}
		
		compareIds = aProductPageTableMgr.getDataFor('compareId');
		
		if (notDefined(compareIds)) {
			alert("error, unable to get items to compare");
			return validCompareIds;			
		}
		
		// not validating the form data here, just making sure to only send
		// valid compare ids for comparison - the responsibility for checking
		// for valid data is on other functions
		for (i = 0; i < compareIds.length; ++i) {
			if (isValidComparisonValue(compareIds[i])) {
				validCompareIds[validCompareIds.length] = compareIds[i];
			}
		}
		
		return validCompareIds;
	}

	function f_productPageTableMgr() {
		currentProductTableViewPref = "";
		this.activeForm = "";
		
		valueDelim = ",";
	
		keyVarName = "";
		//excludedKeyVals = "";
		
		loadedVars = new Array();		
		
		//loadedKeyVals = new Array();
		loadedVals = new Array();		
		
		listCheckBoxMgr = null;
		gridCheckBoxMgr = null;
		
		listFormMgr = null;
		gridFormMgr = null;
		
		formToCheckMgrMap = new Array();
		formToFormMgrMap = new Array();
		
		//errorRows = new Array();

		this.getActiveCheckMgr = function() {
			return formToCheckMgrMap[this.activeForm];
		}

		this.getActiveFormMgr = function() {
			return formToFormMgrMap[this.activeForm];
		}
			
		this.init = function (aMaxIndex) {
			this.initCheckBoxes();
			this.initFormMgrs(aMaxIndex);
		}
		
		this.initFormMgrs = function (aMaxIndex) {
			listFormMgr = new f_formManager();
			listFormMgr.init("listFormMgr", "_list", aMaxIndex);
			formToFormMgrMap["SelectBoxFormList"] = listFormMgr;
			
			gridFormMgr = new f_formManager();
			gridFormMgr.init("gridFormMgr", "_grid", aMaxIndex);
			formToFormMgrMap["SelectBoxFormGrid"] = gridFormMgr;			
		}
	
		this.initCheckBoxes = function() {
			listCheckBoxMgr = new checkBoxManager();
//			listCheckBoxMgr.init("listCheckBoxMgr", document.getElementById(formMap["<%= listViewTableTypeValue %>"]));
			listCheckBoxMgr.init("listCheckBoxMgr", document.getElementById(formMap["list"]));
			listCheckBoxMgr.addListener(this);
	//		listCheckBoxMgr.addVarToSave("catEntryId", "gb_tempCatEntryId");
	//		listCheckBoxMgr.addVarToSave("quantity", "gb_tempQty");
//			formToCheckMgrMap["<%= listFormID %>"] = listCheckBoxMgr;
			formToCheckMgrMap["SelectBoxFormList"] = listCheckBoxMgr;
			
			gridCheckBoxMgr = new checkBoxManager();
//			gridCheckBoxMgr.init("gridCheckBoxMgr", document.getElementById(formMap["<%= gridViewTableTypeValue %>"]));
			gridCheckBoxMgr.init("gridCheckBoxMgr", document.getElementById(formMap["grid"]));
			gridCheckBoxMgr.addListener(this);
	//		gridCheckBoxMgr.addVarToSave("catEntryId", "gb_tempCatEntryId");
		//	gridCheckBoxMgr.addVarToSave("quantity", "gb_tempQty");
//			formToCheckMgrMap["<%= gridFormID %>"] = gridCheckBoxMgr;		
			formToCheckMgrMap["SelectBoxFormGrid"] = gridCheckBoxMgr;		
		}
		
		this.onClicked = function(aManagerId, aCheckbox) {
			
			if (empty(aManagerId) || empty(aCheckbox)) {
				alert("onClicked called	with invalid arguments - aborting...");
				return;
			}

	//		alert("onClicked called by manager:"+aManagerId+" for checkbox {id="+aCheckbox.id+", name="+aCheckbox.name+", value="+aCheckbox.value);
			
			if (aManagerId == "listCheckBoxMgr") {
				checkboxToUpdate = gridCheckBoxMgr.getCheckBoxById(aCheckbox.id);
			}
			else if (aManagerId == "gridCheckBoxMgr") {
				checkboxToUpdate = listCheckBoxMgr.getCheckBoxById(aCheckbox.id);			
			}
			
			if (notEmpty(checkboxToUpdate)) {
				checkboxToUpdate.checked = aCheckbox.checked;
			}
		}
		
		this.selectAll = function() {
	//		listCheckBoxMgr.selectAll();
	//		gridCheckBoxMgr.selectAll();
	
			activeCheckMgr = this.getActiveCheckMgr();
			if (notEmpty(activeCheckMgr)) {
				activeCheckMgr.selectAll();
			}
		}
		
		this.deselectAll = function() {
	//		listCheckBoxMgr.deselectAll();
	//		gridCheckBoxMgr.deselectAll();
	
			activeCheckMgr = this.getActiveCheckMgr();
			if (notEmpty(activeCheckMgr)) {
				activeCheckMgr.deselectAll();
			}
	
		}
		
		this.onsubmit = function() {
//			alert("[productTableMgr] on submit called");
			return this.saveTempData();
		}
		
		this.addVarToSave = function(aVarName, aFormElementId) {
			listCheckBoxMgr.addVarToSave(aVarName, aFormElementId);
			gridCheckBoxMgr.addVarToSave(aVarName, aFormElementId);
			
			loadedVars[aVarName] = aFormElementId;
		}

		this.loadTempData = function(aKeyVarName, aKeyVarLocation, anExcludedKeyVals) {

			if (empty(aKeyVarName)) {
				alert("No key variable name specified.  No data will be loaded.");
				return;
			}

			if (empty(aKeyVarLocation)) {
				alert("No key variable location specified.  No data will be loaded.");
				return;
			}

			keyVarName = aKeyVarName;
			if (empty(loadedVars[keyVarName]) || loadedVars[keyVarName] != aKeyVarLocation) {
				this.addVarToSave(keyVarName, aKeyVarLocation);
//				loadedVars[keyVarName] = aKeyVarLocation;
			}						

			keyVarStringVal = document.getElementsByName(aKeyVarLocation);
			if (empty(keyVarStringVal)) {
				alert("no temp data loaded since no key has a value (aKeyVarLocation="+aKeyVarLocation+")");
				return;				
			}
			
			// should be only one <input> with name attribute equal to key specified
			keyVarStringVal = keyVarStringVal[0];
			keyValues = keyVarStringVal.value;
			
			if (empty(keyValues)) {
				// alert("no data to load; no key values found");
				return;
			}
			
			keyValues = keyValues.split(valueDelim);			

			tempVals = new Array();
						
			for (varName in loadedVars) {
				//tempVals[varName] = new Array();
				
				valuesObj = document.getElementsByName(loadedVars[varName]);
				if (notEmpty(valuesObj)) {
					// should be only one <input> with name attribute equal to variable specified
					valuesObj = valuesObj[0];
					
					valuesArray = valuesObj.value.split(valueDelim);
					if (notEmpty(valuesArray)) {
				//		for (valuesIter = 0; valuesIter < valuesArray.length; ++valuesIter) {
				//			tempVals[varName].push(valuesArray[valuesIter]);
				//		}
					//	tempVals[varName].concat(valuesArray);
						tempVals[varName] = valuesArray;
					}
				}
				else {				
					tempVals[varName] = new Array();
				}
			}
			
			if (notEmpty(anExcludedKeyVals)) {
				for (varName in loadedVars) {
					loadedVals[varName] = new Array();
				}			
				copyToIndex = 0;

				for (allKeysIter = 0; allKeysIter < keyValues.length; ++allKeysIter) {
					isExcluded = false;
					for (excludeKeyIter = 0; excludeKeyIter < anExcludedKeyVals.length; ++excludeKeyIter) {
						if (keyValues[allKeysIter] == anExcludedKeyVals[excludeKeyIter]) {
							isExcluded = true;
							break;
						}
					}
					
					if (!isExcluded) {
						//loadedKeyVals[copyToIndex] = keyValues[allKeysIter];
						for (varName in loadedVars) {
							loadedVals[varName][copyToIndex] = tempVals[varName][allKeysIter];						
						}
						++copyToIndex;
					}
				}	
			}
			else {
				//loadedKeyVals = keyValues;
				loadedVals = tempVals;
			}
			
		}
		
		this.getLoadedDataFor = function(aVarName) {
			if ( empty(aVarName) || empty(loadedVals[aVarName]) ) return new Array();
			return loadedVals[aVarName];
		}
		
		
		this.getSelectedDataFor = function (aVarName) {
			if (empty(aVarName)) return new Array();
			
			activeChecksMgr = this.getActiveCheckMgr();
			if (empty(activeChecksMgr)) return new Array();			
			
			return activeChecksMgr.getSelectedDataFor(aVarName);
		}
		
		this.getSelectedDataFor = function (aVarName) {
			if (empty(aVarName)) return new Array();
			
			return this.getSelectedData()[aVarName];
		}		


		this.getAllFormData = function() {
			activeFormMgr = this.getActiveFormMgr();
			if (empty(activeFormMgr)) {
				alert("no active form manager found");
				return new Array();
			}
			
			return activeFormMgr.getAllFormData();		
		}	

		this.getEnteredFormData = function() {
			activeFormMgr = this.getActiveFormMgr();
			if (empty(activeFormMgr)) {
				alert("no active form manager found");
				return new Array();
			}
			
			return activeFormMgr.getEnteredFormData();		
		}	

		
		this.getEnteredFormDataFor = function(aVarName) {
			if (empty(aVarName)) return new Array();
			
			rawValuesArray = this.getEnteredFormData();
			if (notDefined(rawValuesArray)) return rawValuesArray;
			
			rawValuesArray = rawValuesArray[aVarName];
			if (notDefined(rawValuesArray)) return rawValuesArray;
			
			// might need to add some additional processing here...
			return rawValuesArray;		
		}		
		
		this.getDataFor = function (aVarName) {
			if (empty(aVarName)) return new Array();
			
			//return this.getLoadedDataFor(aVarName).concat(this.getSelectedDataFor(aVarName));
			return this.getLoadedDataFor(aVarName).concat(this.getEnteredFormDataFor(aVarName));
		}		
				
		this.saveTempData = function() {
	        
	        if (!productpage_isValidPage(this)) {
        		return false;
    	    }			
			
//			allFormData = this.getAllFormData();
			enteredFormData = this.getEnteredFormData();
			
			for (varName in loadedVars) {

				loadedData = this.getLoadedDataFor(varName);
				// alert("loadedData["+varName+"] = "+loadedData);
				
				//selectedData = this.getSelectedDataFor(varName);
				//alert("selectedData["+varName+"] = "+selectedData);
				
				//formData = this.getFormDataFor(varName);
				if (notDefined(enteredFormData)) {
					formData = new Array();					
				}
				else {
					formData = enteredFormData[varName];
				}
				// alert("formData["+varName+"] = "+formData);
				
								
				valuesToSave = loadedData.concat(formData);

				formElement = document.getElementsByName(loadedVars[varName]);
				if (notEmpty(formElement)) {
					formElement = formElement[0];
				} else {
					formElement = document.getElementById(loadedVars[varName]);
				}
					
				formElement.value = valuesToSave.join(valueDelim);
				// alert("set "+formElement.name+" to store: {"+valuesToSave+"}");			
			}
			
			return true;
		}
		
		
		this.saveTempDataOld = function() {
		//	alert("saveTempData called with this.activeForm="+this.activeForm);
			checksToSaveMgr = this.getActiveCheckMgr();
			if (empty(checksToSaveMgr)) {
				// alert("no information from page to save; just preserving existing values");
			}
			else {
				//checksToSaveMgr.saveSelectedData();
				selectedValues = checksToSaveMgr.getSelectedData();

				// merge loaded (old) data with selected (new) data
				for (varName in loadedVars) {
					if (notEmpty(selectedValues[varName])) {
						if (notEmpty(loadedVals[varName])) {
							//loadedVals[varName].join(selectedValues[varName]);
							// alert("before concat, loadedVals[varName] = "+loadedVals[varName]+", selectedValues[varName]="+selectedValues[varName]);
							loadedVals[varName] = loadedVals[varName].concat(selectedValues[varName]);
							// alert("after concat, loadedVals[varName] = "+loadedVals[varName]);
						//	for (valueIter=0; valueIter < selectedValues[varName].length; ++valueIter) {
						//		loadedVals[varName].push(selectedValues[varName][valueIter]);								
						//	}

						}
						else {
							loadedVals[varName] = selectedValues[varName];
						}
					}
				}
			}
					
			for (varName in loadedVars) {
					
				formElement = document.getElementsByName(loadedVars[varName]);
				if (notEmpty(formElement)) {
					formElement = formElement[0];
				} else {
					formElement = document.getElementById(loadedVars[varName]);
				}
					
				formElement.value = loadedVals[varName].join(valueDelim);
				// alert("set "+formElement.name+" to store: {"+loadedVals[varName]+"}");
			}					
		}		
		
		this.updateErrorCellsGrid = function(anErrorMsgArray) {
			//alert("highlighting errors in grid view");
			
			// note: starting at index 1 because 0 is reserved for a count of the number of errors
			for (var i=1; i < anErrorMsgArray.length; ++i) {
				var selectAndQtyCell = document.getElementById('select_quantity_cell_'+i+'_grid');
				updateCellStyle(selectAndQtyCell, anErrorMsgArray[i]);
				
				if (notEmpty(anErrorMsgArray[i])) {
					hide('qty_text_'+i+'_grid');					
					show('error_qty_text_'+i+'_grid');					
				}
				else {
					hide('error_qty_text_'+i+'_grid');					
					show('qty_text_'+i+'_grid');
				}
			}
		}
				
		this.updateErrorCellsList = function(anErrorMsgArray) {
			//alert("highlighting errors in list view");

			// note: starting at index 1 because 0 is reserved for a count of the number of errors			
			for (var i=1; i < anErrorMsgArray.length; ++i) {
				var listRowCell = document.getElementById('list_row_'+i);
				if (notEmpty(listRowCell)) {
					updateCellStyle(listRowCell, anErrorMsgArray[i]);
				}
				else {
					var listTableCell = document.getElementById('list_table_cell_'+i);
					updateCellStyle(listTableCell, anErrorMsgArray[i]);
				}
				
				var errorMsgCell = document.getElementById('error_msg_node_'+i+'_list');
				if (notEmpty(errorMsgCell)) {												
					var errorImgs = errorMsgCell.getElementsByTagName("img");
					if (errorImgs) {
						for (var imgIter = 0; imgIter < errorImgs.length; ++imgIter) {
							if (notEmpty(anErrorMsgArray[i])) {
								errorImgs[imgIter].style.display = "block";
							}
							else {
								errorImgs[imgIter].style.display = "none";
							}
						}
					}
					else {
						alert("no errorImgs");
					}			
				
					// remove any existing error messages
					var errorChildNodes = errorMsgCell.childNodes;						
					if (notEmpty(errorChildNodes)) {
						for (var nodeIter = 0; nodeIter < errorChildNodes.length; ++nodeIter) {
							if (errorChildNodes[nodeIter].nodeType == TEXT_NODE) { // TEXT_NODE is defined in GraybarCommon.js
								errorMsgCell.removeChild(errorChildNodes[nodeIter]);
							}
						}
					
					}
				
					if (notEmpty(anErrorMsgArray[i])) {
						addErrorStyle(errorMsgCell, 'formError');						
						errorMsgCell.appendChild(document.createTextNode(anErrorMsgArray[i]));
					}
					else {
						removeErrorStyle(errorMsgCell, 'formError');
					}										
				}
				else {
					alert("errorMsgCell is empty");
				}				
			}
			
			
		}
		
		this.updateErrorCells = function(anErrorMsgArray) {
//			alert("this.activeForm = "+this.activeForm);
			if (this.activeForm == "SelectBoxFormGrid") {
				this.updateErrorCellsGrid(anErrorMsgArray);
			}
			else {
				this.updateErrorCellsList(anErrorMsgArray);
			}
			
			var numErrorCells = anErrorMsgArray[0];
			if (numErrorCells > 0) {
				//this.showErrorRows();
				showErrorRows();
			}
			else {
				//this.hideErrorRows();
				hideErrorRows();
			}
		}		
		
		
		listeners = new Array();
						
		this.addProductTableViewPrefListener = function(aListenerObj) {
			listeners[listeners.length] = aListenerObj;
		}
		
		this.setProductTableViewPref = function (aTableType) {
			for (iter = 0; iter < listeners.length; ++iter) {
				listeners[iter].onProductTableViewPrefChanged(currentProductTableViewPref, aTableType);
			}
			
			currentProductTableViewPref = aTableType;
			this.activeForm = formMap[aTableType];
		}
		
/*
		this.addErrorRow = function(anErrorRowId) {
			if (notEmpty(anErrorRowId)) {
				errorRows[errorRows.length] = anErrorRowId;
			}
		}
		
		this.showErrorRows = function() {
			for (var i = 0; i < errorRows.length; ++i) {
				show(errorRows[i]);
			}
		}
		
		this.hideErrorRows = function() {
			for (var i = 0; i < errorRows.length; ++i) {
				hide(errorRows[i]);
			}
		}
*/		
	}