/**
 * code to handle the expansion and collpsing of the listing rows, making last viewed row always visible - note CSS solution
 */
function expandListingRow() {
		this.className = this.className.replace(/collapsedRow/, 'expandedRow');
		collapseAllOtherListingRows(this);
}
function collapseListingRow(rowObj) {
		rowObj.className = rowObj.className.replace(/expandedRow/, 'collapsedRow');
}
function collapseAllOtherListingRows (currRowObj) {
	var listingRows = currRowObj.parentNode.getElementsByTagName("DIV");
	for (i = 0; i < listingRows.length; i++) {
		if ((listingRows.item(i).className.indexOf('listingRow') >= 0) && (listingRows.item(i) != currRowObj)) {
			collapseListingRow(listingRows.item(i));
		}
	}
}

// and loop through the document adding listeners - but only if the row contains a cell with the 'extraInfoContainer' class applied to it
function initExpandingListingRows() {
	var listingRowsConts = document.getElementsByTagName('DIV');
	for (i = 0; i < listingRowsConts.length; i++) {
		if ((listingRowsConts.item(i).className.indexOf('listingRowsCont') >= 0) && (listingRowsConts.item(i).className.indexOf('expandable') >= 0)) {
			// attach the onmouseover listener to all its children rows...
			var listingRows = listingRowsConts.item(i).getElementsByTagName('DIV');
			for (j = 0; j < listingRows.length; j++) {
				if (listingRows.item(j).className.indexOf('listingRow') >= 0) {
					// attach the onmouseover listener to all its children rows...			
					listingRows.item(j).onmouseover = expandListingRow;
				}
			}
		}
	}	
}

// and add routine to be executed on load
onloadEventAppend(initExpandingListingRows);
