
function getElementsByIdPrefix(startNode, prefix) {
	// This function returns an array of elements whose id starts with some prefix.
	// The purpose is to retrieve an array of elements that need to be hidden, or have
	// lines drawn around them, when the "print mode" link is clicked. In IE, we can 
	// just give all hideable elements an id of 'hide' and use getElementsByName('hide').
	// This is because in IE this will return elements that lack a name but that have an 
	// id of 'hide'. FireFox is not so loosey-goosey. Another approach is to use 
	// getElementById('hide-' + i) where i is looped over. This works in, for example, the
	// report distribution schedule form, where we have a small number (< 10) of elements
	// we want to retrieve. In a project page showing reports from different datasets, there
	// could be hundreds of such elements, and no good unique way to label them or loop over them.
	// So, we're stuck doing a recursive descent through the DOM comparing id's to prefix as we go.

	// create array of elements that match -- this will be returned
	var elements = new Array();
	
	if (startNode.id != null) {    // most nodes don't have an id...
		if (startNode.id.substr(0,prefix.length) == prefix) {
			// add this startNode to elements if it matches
			elements = elements.concat(startNode);
		}
	}

	// now look at all of startNodes children, to do the same thing
	for (var i=0; i < startNode.childNodes.length; i++) {
		myChild = startNode.childNodes[i];
		// call this routine recursively, using current child node as the next start node
		elements = elements.concat(getElementsByIdPrefix(myChild,prefix));
	}

	return elements;
}


