/* FORM AUTO PRINT FUNCTION */

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function displayItem(list){

//gives us access to the list to display the items
var finallist = document.getElementById(list);

//random variables to hold new pieces
var elementholder;
var textnodeholder;
var labelholder;

var regex = /^\d+$/;  

//the two arrays of the elements to check
var textboxes, labels;
textboxes = getElementsByClass('quantity_textbox',null,'input');
labels = getElementsByClass('quantity_label',null,'label');

//then we clear out the child nodes from the list
//so we dont have double listings and such
while (finallist.firstChild) {
  finallist.removeChild(finallist.firstChild);
}

//now we iterate through the two lists to see which items are checked
for(x=0; x<textboxes.length; x++){
   if(regex.exec(textboxes[x].value)){
    //will make a new <li> and append the text to it
	
	elementholder = document.createElement('li');
	//textnodeholder = document.createTextNode(textboxes[x].value + " " + labelholder)
	textnodeholder = document.createTextNode(textboxes[x].value + " " + labels[x].firstChild.nodeValue);
	elementholder.appendChild(textnodeholder);
	finallist.appendChild(elementholder);
	elementholder = null;
	textnodeholder = null;
	
   }
}

}
