// page_Customer.js - javascript for the Customer pages.
//
// Actions:	Search MSDS by number
//			(search key changed)
//		Cancel search by number
//			(empty search key)
//		Search MSDS by description
//			(search key changed)
//		Cancel search by description
//			(empty search key)
//		Select description
//			(from search list)
//
//	NOTE: In the case where a callback is dynamically attached to an object, the object
//	becomes the 'this' pointer for the method.  Thus several calls to displayState() are
//	referenced using the global object pointer 'cs' rather than the this.  In these
//	specific cases, the 'teuker' object assigns select/unselect methods to the onclick()
//	event handler of dynamically created divs.

function CustomerPageObject ()
{}

CustomerPageObject.prototype.removeStockTableRows = function ()
{
//trace('cs.removeStockTableRows()');
	var tbl = document.getElementById('cs_stockTable');
	var lastRow = tbl.rows.length;
	for (var i = lastRow - 1; i >= 1; --i)
		tbl.deleteRow(i);
};

CustomerPageObject.prototype.appendStockTableRow = function (desc, cyl, qty ,part)
{
//trace('cs.appendStockTableRow('+desc+', '+cyl+', '+qty+', '+part+')');
	var tbl = document.getElementById('cs_stockTable');
	var lastRow = tbl.rows.length;
	var row = tbl.insertRow(lastRow);
  
	mr.setText (mr.appendChild (row, "td", {className : 'qty'} ), qty);
	mr.setText (mr.appendChild (row, "td", {className : 'part'}), part);
	mr.setText (mr.appendChild (row, "td", {className : 'cyl'}), cyl);
	mr.setText (mr.appendChild (row, "td", {className : 'desc'}), desc);
}

var cs = new CustomerPageObject;
